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-07 02:07 AM
"I tried to use EEPROM emulation SW but not working"
So what, exactly, did you try; and how was it "not working" ?
What debugging have you done to find the problem(s)?
"very robust and complicated. Is there some easy way how to do this?"
Likely this is a case of, "do you want it robust, or do you want it easy?"
2022-06-07 02:29 AM
The FLASH chapter in RM describes the procedures for erasing/programming FLASH, so you can write your own implementation to fit your purposes.
JW
2022-06-07 03:18 AM
... and make your own tradeoffs between "robust" and "easy" ...
2022-06-07 04:33 AM
OK, I checked RM. I was not able to port the example from X-CUBE-EEPROM to my CPU. But I found that there are some option bytes and 2 bytes of "user data"... If 2 bytes are enough for me, is it possible to use this easily as data storage? Or these option bytes are used for something different? Thank you
2022-06-07 05:29 AM
I don't think in 'G030 there are any option bytes free for user usage.
JW
2022-06-07 05:41 AM
You are right. Anyway: Bits 7:0 RDP[7:0]: Read protection level
0xAA: Level 0, read protection not active
0xCC: Level 2, chip read protection active
Others: Level 1, memories read protection active
Means that at least this Byte would be possible to use. I do not need any protection so is this possible to use for storage?
2022-06-07 06:23 AM
It does not matter if you need Read Protection - RDP is read by the hardware after every reset and leads to the described effect. So if you e.g. write 0xCC in there and perform a reset, you can no longer access the device, it's a one-way street. As @Community member already wrote, there are no free bytes for the user in the flash option bytes.
Regards
/Peter
2022-06-07 07:09 AM
So the only way is to emulate EEPROM with Flash? Or is some other small space there?
2022-06-07 07:16 AM
Apart from the flash, there is no non-volatile area in the STM32G030 that the user could use as EEPROM.
In the LQFP48 package you would have 20 bytes of backup registers that could be buffered with e.g. a battery or capacitor to VBAT, but in the smaller packages VBAT is hardwired to VDD.
Regards
/Peter