2015-05-28 02:13 AM
hi
in my software, define a section named ''My_SECTION'' and put just a function on it. in IAR .icf file define that section write in address 0x08050000. I used debugger, function is correctly wrote in 0x08050000 and has 16 byte length. All other functions are wrote from address 0x08003000. when MCU power on , In main() function, I want to erase function that wrote in address 0x08050000. when erase page at address 0x08050000, page doesn't erase, but if erase just page after or before that, it is erase correctly . I think pages that programed, is locked. Is it possible to erase a page that some of execution code write on it? #flash #stm32f103 #erase2015-05-28 07:04 AM
Should erase the same way any other sector.
You'd want to double check if you have write protected any of the sectors, and that you are correctly unlocking, and clearing pending status.2015-05-29 08:51 PM
my erase function:
FLASH_Unlock(); delay_us(100); FLASHStatus = FLASH_ErasePage(PgAdd); ----- this code execute from flash memory and correctly erase pages 0x08050800 and 0x0804f800;2015-05-30 02:39 AM
OK, thanks clive1.
when i use this code: FlashRead((uint32_t)(0x08050000),SecSize,Buffer_In); FLASH_Unlock(); FLASH_ErasePage(0x50000); FlashRead((uint32_t)(0x08050000),SecSize,Buffer_Out); //----------------- Buffer_Out equal Buffer_In, page does not erase. but when use below code pageerase correctly
: FlashRead((uint32_t)(0x08050000),SecSize,Buffer_In); FLASH_Unlock(); FLASH_ErasePage(0x50000);FLASH_Lock(); // difference
with above code.
FlashRead((uint32_t)(0x08050000),SecSize,Buffer_Out); //------------