I designed a device which writes data in a FRAM (I2C protocol) from time to time (tipically each 3 minutes).
After years using using my designed device and after I have finished my code, suddenly yesterday ON BREADBOARD the device showed me an erroneus value.
As example, I expected 939 and I got 537002923 (unsigned long integer) on next time.
I have reviewed tenths of times my code and I am not able to find anything erroneus in it. I checked FRAM and value stored in it was really 53700923 and this value increments correctly by 1 each time. More, starting a new cycle of measurements doen't show any error.
So, after many reviews and thinkings I come to conclussion that surely I got an electric "glitch", maybe because I switched on a lamp locate in my room directly above my desktop, or, maybe if I handled very qucickly the keys on the device (it has four)...
(Of course, I would prefer not thinking that Compiler might fail, and I also like to think that redundancy code performed by mP and Fram is enough for verifyng the transmission between them, and I also assume that mP 18F67K22 waits finishing an instruction before executing a new one).
My conclusion is due that, as example, considering these values:
Code: Select all
939 = 00000000 00000000 00000011 10101011
537002923 = 00100000 00000010 00000011 10101011
So, please, Could you tell me your experiences and technics/solutions/workarounds for dealing with it?
I consider:
- a) recording the value, check now the recorded value, then record it again if is not equal to those intended.
- b) calculate two identical variables (delayed by a second), comparing each one to other before-and-after recording in FRAM, so dismissing the worse variable in case both are different
The problem is that I record many variables, so it is difficult to implement both methods for all of them
Thank you