What are possible reasons for NVM data corruption during embedded controller shutdown?

Thread Starter

naseeam

Joined Jan 4, 2017
79
Consider a typical autonomous embedded Steering Control Module. This controller is mounted in a Commercial Truck. It assists in keeping the vehicle in it's lane.

During transition to sleep mode, real camera calibration data is written from RAM to NVM. This data written to NVM is corrupted. What are possible reasons that corrupt NVM data?

  1. Brown out condition
  2. Reset
  3. Power loss
  4. Any other reason that cause NVM corruption during controller transitioning to sleep mode.


How to find out if NVM data is corrupted? After controller wakes up, does it calculate checksum of real calibration values in the NVM and if calculated checksum doesn't match checksum stored in NVM, it is concluded that NVM is corrupted?
 

Papabravo

Joined Feb 24, 2006
21,159
Consider a typical autonomous embedded Steering Control Module. This controller is mounted in a Commercial Truck. It assists in keeping the vehicle in it's lane.

During transition to sleep mode, real camera calibration data is written from RAM to NVM. This data written to NVM is corrupted. What are possible reasons that corrupt NVM data?

  1. Brown out condition
  2. Reset
  3. Power loss
  4. Any other reason that cause NVM corruption during controller transitioning to sleep mode.


How to find out if NVM data is corrupted? After controller wakes up, does it calculate checksum of real calibration values in the NVM and if calculated checksum doesn't match checksum stored in NVM, it is concluded that NVM is corrupted?
It can do this, but IMHO it is an unreliable method.
 

Thread Starter

naseeam

Joined Jan 4, 2017
79
>> It can do this, but IMHO it is an unreliable method.
What is reliable method to find out that NVM is corrupted?
 

MrChips

Joined Oct 2, 2009
30,720
There are steps one can take to improve reliability.

1) Write checksum and verify on power up.
2) Write data with error detection and correction.
3) Write data twice with checksum.
4) Write data three times and do majority vote.
5) Any combinations of all of the above.
 

Papabravo

Joined Feb 24, 2006
21,159
>> It can do this, but IMHO it is an unreliable method.
What is reliable method to find out that NVM is corrupted?
One step above a checksum would be a Cyclic Redundancy Check (CRC). The probability of detecting errors is much greater than with a simple checksum.
One step above that you be using an Error correcting Code (ECC) so that you could not only detect the errors, but correct them as well
Beyond that I am certain there are additional methods that I have not even heard about.
Tri-modular redundancy never hurts if you can afford the resources.
 

dl324

Joined Mar 30, 2015
16,846
During transition to sleep mode, real camera calibration data is written from RAM to NVM. This data written to NVM is corrupted. What are possible reasons that corrupt NVM data?
You're not giving us much to work with. Many things could contribute to NVRAM getting corrupted. Almost all of them are going to be due to a design flaw.
 

olphart

Joined Sep 22, 2012
114
There are steps one can take to improve reliability.

1) Write checksum and verify on power up.
2) Write data with error detection and correction.
3) Write data twice with checksum.
4) Write data three times and do majority vote.
5) Any combinations of all of the above.
I'd also be sure that xfer to NVM has enough power/time to finish. I've used a schottky diode feeding a big (~220-470uF) to power just the uC & flash (they were separate), tag an interrupt line before the diode to signal uC to Save NOW. The write checksum & verify on power up was all I needed. You can only go too small on the cap, it pends on how much to save.
 
Top