cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L08xx EEPROM write fail

JJRR
Senior

Dear,

on STM32L083 I use internal eeprom. I found out, that when I use function

HAL_FLASHEx_DATAEEPROM_Program

and during execution of this function the power voltage of mcu falls down (uplugged battery from device) - then in eeprom are saved wrong data (probably only in sectors which I wanted to modify by calling the function above).

I use BOR Level1. Also I tried to activate PVD and in its IRQ callbacks I just added while(1); until the mcu goes to reset.

Is there any solution for that?

Thank you very much, Jan.

1 ACCEPTED SOLUTION

Accepted Solutions
JJRR
Senior

Thank you fo reply.

I have already solved it by mirroring the eeprom memory place. Now my value is stored on 3 places in the eeprom - after reading I compare the 3 values and if any 2 are equal then I take them as correct. It cost more memory area, but it seems like it i working.

View solution in original post

6 REPLIES 6
Peter BENSCH
ST Employee

The problem is that PVD and BOR alone are of no use if the voltage fails at that moment, because the write/erase process must be completed successfully.

Yes, there is a solution: decoupling capacitors with appropriate size to power the STM32L0xx during the full write or erase operation and before the supply voltage goes below the minimum VDD (1.8V with BOR enabled).

Does it answer your question?

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.
JJRR
Senior

Thank you fo reply.

I have already solved it by mirroring the eeprom memory place. Now my value is stored on 3 places in the eeprom - after reading I compare the 3 values and if any 2 are equal then I take them as correct. It cost more memory area, but it seems like it i working.

Increasing the size of the buffer capacitors is not an option because that would be the safest method?

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.

I am not sure if I understand. When I add another capacitors - where is solution? I do not know when the battery is going to unplug..

Well, with the PVD you can continuously check the supply voltage via the PVD_IN and start a write action in case of a voltage drop. Of course, the buffer capacitors must be large enough to successfully complete the write action.

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.

If the problem is resolved, please mark this topic as answered by selecting Select as best under your preferred answer. This will help other users find that answer faster.

/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.