2014-02-01 05:38 AM
Hi All,
I am working on STM32F103.When I program the device using system boot loader I save also some user data at the address 0x9800.Now I would like to re-program these data with the on-line application using FLASH_ProgramWord function, but I noticed it is not possible as Flash is mapped at 0x0800 0000.Is there any other way to program these data?Many thanks,Marco #flash-programming2014-02-01 06:09 AM
I'm not sure I fully understand the question.
When the STM32 boots from FLASH, it does so by shadowing that memory at address zero. That is to say the FLASH is visible a both 0x08000000+ and 0x00000000+Does your 0x00009800 data also appear at 0x08009800? If it does, then program it at the latter address.2014-02-01 07:19 AM
Thanks,
I didn't know about the shadowing.Now I am programming one word at 0x08009800,but the FLASH_ProgramWord returns me 2 that is FLASH_ERROR_PG.Do you know what can it be?2014-02-01 07:37 AM
Maybe now I have understood. That flash address was already programmed with a data, that I try to over-write. So maybe before I have to erase the page, then programming the data. Am I right?
2014-02-01 07:58 AM
Yes, the cells in question must be in an erased state (0xFFFF), if you wish to program them. The erase occurs on a page level, so you must either write data blocks incrementally at the end of where you left off before, or erase the whole page, and start over, re-writing the other original data you wish to retain.
2014-02-01 08:04 AM
Lesson learned! :)
Thank you very much