cancel
Showing results for 
Search instead for 
Did you mean: 

Flash programming

sirpak
Associate II
Posted on February 01, 2014 at 14:38

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-programming
5 REPLIES 5
Posted on February 01, 2014 at 15:09

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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sirpak
Associate II
Posted on February 01, 2014 at 16:19

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?

sirpak
Associate II
Posted on February 01, 2014 at 16:37

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?

Posted on February 01, 2014 at 16:58

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sirpak
Associate II
Posted on February 01, 2014 at 17:04

Lesson learned! 🙂

Thank you very much