2022-06-07 01:55 AM
I need permanently save configuration data (several bytes only) in STM32G030J6 in SO8N package. I tried to use EEPROM emulation SW but not working - very robust and complicated. Is there some easy way how to do this? There is no other EEPROM and no possible to connect.
2022-06-13 12:21 AM
I found a solution - I can use:
const uint32_t variable_X = 0xABCDDCBA;
But is it possible to say the compiler where should be this constant located? I do not need exact location, I only need to keep always the same the location in Flash when I make some pogram changes and recompile.
2022-06-13 12:56 AM
> But is it possible to say the compiler where should be this constant located?
This is toolchain-dependent. If you use gcc-based toolchain, you should modify the linker script to include a custom section placed at a particular address, and then place the variable in question into that section.
I'm not sure whether there is some simple example out there, but this is a recurring question in this forum so you may want to search here.
JW
2022-06-19 12:25 AM
For EEPROM emulation use array of structs, mapped to last FLASH page.
On power-on find last non-empty record (not equal to 0xFF), on every write increment record index, after last - erase whole page, and start from beginning.
According to my tests real number of page write cycles is 200000..400000 for STM32F030, so if record size is 20 bytes, you can get real 10..20 mln cycles - even better than many external EEPROMs...
2022-06-19 01:50 AM
2022-06-19 02:10 AM
I agree, at extreme temperatures (over 80..100deg.C) number of cycles can be significantly lower (leakage current increases exponentially).
I tested at 22deg and 60deg - no detectable difference, in my applications MCU rarely heats over 40deg...