| 数据搜索系统,热门电子元器件搜索 |
|
PM0212 数据表(PDF) 14 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
PM0212 数据表(HTML) 14 Page - STMicroelectronics |
|
14 / 22 page ![]() Programming STM8 Flash microcontrollers PM0212 14/22 Doc ID 022351 Rev 2 Note: It is mandatory to execute steps 2 to 4 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. Fast block programming operation The following sequence is required to perform a fast block program sequence (block programmed without previous erase): 1. Unlock the memory if not already done. The UBC option byte can be read to check if the block to program is not in the UBC area. If necessary, reprogram it to allow programming the targeted block. 2. Write 0x10 in FLASH_CR2 (FPRG bit active). 3. Write all the data bytes of the block you want to program starting with the very first address of the block. No read or write access to the program memory is allowed during these load operations as they might corrupt the values to be programmed. The programming cycle starts automatically when the complete block has been written. 4. Check the WR_PG_DIS bit in FLASH_IAPSR to verify if the block you attempted to program was not write protected (optional). 5. To check if the program operation is complete, poll the EOP bit in FLASH_IAPSR from program memory. EOP is set to ‘1’ when the block program 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 4 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: The memory block must be empty when performing a fast block programming operation. 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). 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. 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 4 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. |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| 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 |