STM32F4 Flash rewrite variables
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-10-22 4:35 AM
Posted on October 22, 2014 at 13:35
Hello.
I use STM32F4 and CoIDE. I use Flash sector 11 (because problem with linker when use sector 2) for store application parameters.I write code...FLASH_Unlock();FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR);FLASH_EraseSector(FLASH_Sector_11, VoltageRange_3);FLASH_ProgramWord(0x080E0000, 12);FLASH_Lock();But, this is work only first time (after sector erase).How to rewrite variable without sector erase?Best regards,Cool Happy #stm32f #rewrite #flash #eeprom
Labels:
- Labels:
-
EEPROM devices
-
Flash
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-10-22 5:07 AM
Posted on October 22, 2014 at 14:07
But, this is work only first time (after sector erase).
How to rewrite variable without sector erase?
You can't. Flash is designed to be only sector-erasable. Either use external EEPROM chips, which are byte/word erasable, or use an algorithm to work around your problem. For instance, write consecutive blocks/datasets, and use two Flash sectors in ping-pong mode. But keep in mind, the number of guaranteed erase/write cycles of Flash is limited.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-10-22 5:11 AM
Posted on October 22, 2014 at 14:11
According to RM0090 rev.7, ch.3.6.4 on p.86:
Successive write operations are possible without the need of an erase operation whenchanging bits from ‘1’ to ‘0’. Writing ‘1’ requires a Flash memory erase operation.
JW
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-10-22 5:41 AM
Posted on October 22, 2014 at 14:41
:(((
OK. How to setup linker for this... sector 2 and sector 3 are eeprom, others main code?Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-10-22 5:57 AM
Posted on October 22, 2014 at 14:57
You'd have to create two discontinuous sections/segments, and direct specific sections/objects/functions into them.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
