cancel
Showing results for 
Search instead for 
Did you mean: 

EEPROM Emulator causes hard fault

20jmorrison
Associate II

MCU: 

STM32H753VI

 

Scenario:

Requirements specify that I must use internal flash memory to store error counters for our fault management system. I was going to directly write to flash memory using the built in HAL commands, but found that most people seem to use the EEPROM Emulator (specifically the one STM provides in their example). As far as I can tell, the reason people use the EE is because it provides wear leveling, and an easier to use interface for utilizing flash memory to store variables. I would like to use the EE mainly because of the wear leveling, as that is important in our specific application.

 

Problem:

I have been able to successfully use the EE on our MCU to store our error counters. However, I sometimes encounter a hard fault, and when it happens seems to be completely random. When stepping through the code, I found that the hard fault sometimes occurs when calling EE_Init(), sometimes when calling EE_WriteVariable(), and sometimes when calling EE_ReadVariable(). When using the Fault Analyzer, I am given the details "Bus, memory management or usage fault (FORCED)" and "Precise data access violation". I also checked ECC registers to see if any flags were being raised (as I noticed on another related post that their hard fault was ECC related), and sure enough, an ECC error is detected in bank 2 of flash memory.

 

What I've Tried

- Erasing the flash memory using the cubeProgrammer seems to fix the issue, at least temporarily. But erasing the flash memory each time defeats the purpose of using flash memory, as it is critical we do not lose track of our error counters for our fault management system.

- Another similar post mentioned checking and clearing the RDS and RDP errors prior to erase/write operations. I was not able to try this, as I couldn't figure out how to do it. The same post also mentioned disabling interrupts before using the EE. This still resulted in a hard fault.

- Changing line 394 of eeprom.c in function EE_ReadVariable from 

Address = Address - 32;

   to 

Address = Address - 64;

   This still resulted in a hard fault.

 

Question

- How can I avoid ECC errors when using the EEPROM Emulator on the H7?

- How do I check and clear the RDS and RDP errors, as another post suggested?

Using an external EEPROM is not an option for us. Ideally, I would like to get this EEPROM Emulator working, but if anyone has any different approaches, that would still be appreciated.

@heveskar, I found a couple of your posts with basically the same issue. Did you ever find a solution, or did you end up modifying your design to include an external EEPROM?

1 ACCEPTED SOLUTION

Accepted Solutions
BarryWhit
Senior III

How many write/erase cycles has your chip experienced during its lifetime, esp. during test and development?

Sometimes people make the naive mistake of performing a "stress test" of the flash system, thereby killing it.

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.

View solution in original post

2 REPLIES 2
BarryWhit
Senior III

How many write/erase cycles has your chip experienced during its lifetime, esp. during test and development?

Sometimes people make the naive mistake of performing a "stress test" of the flash system, thereby killing it.

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.

Hello Barry,

Thank you for the prompt response. This particular chip that I have been doing the testing and development with has probably gone through roughly 1k cycles.

Today I am going to test with another one of our H7's to see if the problem is only with that one particular chip.

However, in production, the MCU flash memory is going to need to go through about 6k cycles in its lifetime.