Electronic Components Datasheet Search
  New Zealand  ▼
ALLDATASHEET.CO.NZ

X  

PM0051 Datasheet(PDF) 20 Page - STMicroelectronics

Part # PM0051
Description  How to program STM8S and STM8A Flash program memory and data EEPROM
PDF  27 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

PM0051 Datasheet(HTML) 20 Page - STMicroelectronics

Back Button PM0051 Datasheet HTML 16Page - STMicroelectronics PM0051 Datasheet HTML 17Page - STMicroelectronics PM0051 Datasheet HTML 18Page - STMicroelectronics PM0051 Datasheet HTML 19Page - STMicroelectronics PM0051 Datasheet HTML 20Page - STMicroelectronics PM0051 Datasheet HTML 21Page - STMicroelectronics PM0051 Datasheet HTML 22Page - STMicroelectronics PM0051 Datasheet HTML 23Page - STMicroelectronics PM0051 Datasheet HTML 24Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 20 / 27 page
background image
Programming STM8 Flash microcontrollers
PM0051
20/27
Doc ID 14614 Rev 3
Block erase operation
The following sequence is required to perform a block erase sequence:
1.
Unlock the memory if not already done.
The UBC option byte can be read to check if the block to erase is not in the UBC area.
If necessary, reprogram it to allow erasing the targeted block.
2.
Write 0x20 in FLASH_CR2 (ERASE bit active), and 0xDF in FLASH_NCR2 (NERASE
bit active).
3.
Write '0x00 00 00 00' to any word inside the block to be erased using a LOAD
instruction.
4.
Check the WR_PG_DIS bit in FLASH_IAPSR to verify if the block you attempted to
erase was not write protected (optional).
5.
For devices with RWW capability, poll the HVOFF bit in FLASH_IAPSR register for the
start of erase operation (high voltage mode). HVOFF is reset when the erase operation
starts, thus indicating that the memory is ready for RWW.
6.
To check if the erase operation is complete, poll the EOP bit in FLASH_IAPSR from
program memory. EOP is set to ‘1’ when the block erase operation has completed. To
avoid polling the EOP bit, an interrupt can be generated when EOP is set.
Note:
It is mandatory to execute steps 2 to 5 from RAM.
Caution:
EOP and WR_PG_DIS bits are cleared by reading the FLASH_IAPSR register. It is
consequently strongly recommended to perform one single read operation to the
FLASH_IAPSR register to check the values of these bits.
Caution:
FLASH_CR2 and FLASH_NCR2 must be written consecutively to be taken into account. If
only one register is set, both are forced to their reset values, causing the erase operation to
be performed at byte level.
4.3
Word programming
Both main program memory and data EEPROM can be programmed and erased at word
level. Word operations are performed in the same way as block operations. They can be
executed either from program memory or from RAM.
When a new word program operation starts, EOP and WR_PG_DIS bits of FLASH_IAPSR
register are automatically cleared.
Contrary to word programming of the Flash program memory, the word programming of data
EEPROM with RWW feature (when available) does not stop program execution. The EOP
bit can then be used to know if the previous operation has completed. This bit is
automatically reset when reading FLASH_IAPSR.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com