2011-03-16 08:09 PM
How to programming ROP option byte via swim?
#programmer #stm82011-05-17 06:12 AM
to write on option byte area you need to set7reset bit 7 of FLASH_CR2/FLASH_NCR2 register. Remenber to enter keys on FLASH_DUKR register before.
If ROP is activated, remove it writing 00h on 4800h then reprogram option bytes as you prefer. Note that removing ROP, whole program memory is erased.
brazov2
2011-05-17 06:12 AM
Thanks Mr brazov.
I Solved this problem
STM8L15x devices are some different than others. My code is below. swim_enter(); delay_10xus(Time_us(10000)); icp_eeprom_unlock(); swim_write_register(STM8_FLASH_CR2, (STM8_FLASH_CR2_ERASE)); swim_write_register(0x4800, 0x00); delay_10xus(Time_us(6000)); swim_write_register(STM8_FLASH_CR2, (STM8_FLASH_CR2_OPT)); swim_write_register(0x4800, 0xAA); Thanks a lot..2011-05-17 06:12 AM
Hi Kim yongsu,
Please could I have a copy of your code, I am trying to make my own programmer but I cannot make it yet, I would like to know if you can share your code to implement it in my programmer. Thank you very much2011-05-17 06:12 AM
Hello,
Do you have any schematic for such a STM8 programmer? I'd like to build one for me. Thanks2013-10-18 03:00 AM
Hello!
Help please!STM8S003F3The sequence of operations Read out protection ENABLED'' write_Byte(FLASH_DUKR,0xAE); write_Byte(FLASH_DUKR,0x56); write_Byte(FLASH_CR2,0x80); write_Byte(FLASH_NCR2,0x7F); uint32_t time_set = 3000; while(time_set-- != 0) { if(read_Byte(FLASH_IAPSR)&(1<<3)) { wait_time(2000); write_Byte(OPTION_BYTE,0xAA); } }''Upon reboot, the MC, reading OPTION_BYTE returns 0xAA,after the restart, reading OPTION_BYTE and the Flash returns 0x71The sequence of operations Read Out Protection DISABLED'' write_Byte(FLASH_DUKR,0xAE); write_Byte(FLASH_DUKR,0x56); write_Byte(FLASH_CR2,0x80); write_Byte(FLASH_NCR2,0x7F); uint32_t time_set = 3000; while(time_set-- != 0) { if(read_Byte(FLASH_IAPSR)&(1<<3)) { wait_time(2000); write_Byte(OPTION_BYTE,0x00); } }''After recording OPTION_BYTE MC stop responding to any action. SWIM interface does not work.