cancel
Showing results for 
Search instead for 
Did you mean: 

I have STM32G030J6 with 32kB Flash and I need emulate EEPROM. Is it possible?

Stastny.Petr
Associate III

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.

14 REPLIES 14

"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?"

The FLASH chapter in RM describes the procedures for erasing/programming FLASH, so you can write your own implementation to fit your purposes.

JW

... and make your own tradeoffs between "robust" and "easy" ...

Stastny.Petr
Associate III

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

I don't think in 'G030 there are any option bytes free for user usage.

JW

Stastny.Petr
Associate III

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?

Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Stastny.Petr
Associate III

So the only way is to emulate EEPROM with Flash? Or is some other small space there?

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.