我已經繼承了STM32的eeprom庫,用於使用HAL_I2C_Mem_xxx庫的i2c器件。 我注意到,對於每個保存的參數,它都有2個副本。 所以共有3次相同的值。I2C EEPROM中的冗餘值和冗餘系統
我想知道這是否是一種安全機制,以避免錯誤的數據被寫入/讀取,以及如果這是當使用超過i2c eeprom的藝術狀態。
什麼是不完全清楚的是下面還有:
1. After each read call, all the 3 values are read and if the return state from the HAL_I2C_Mem_Read is different than HAL_OK, all the 3 values are overwritten in the memory with a default value --> shouldn't be better to retry a read call first?
2. If the read call returns 3 different values, all the 3 values are overwritten with a default value --> this could be the safest solution
3. If the last one in memory is equal to 1 of the 2 values and within boundaries, the last one in mem is copied to the one which is different so all 3 of them are equals. If outside boundaries the default is written in all of them.
4. If the first two are equal and the first in memory is within boundaries, the first one is written in the last one in memory.If outside boundaries the default is written in all of them.
是這一切真的需要越來越大呢?
問候,
請您提供一些代碼位在閃存中實現eeprom? – Luigi
@Luigi我在答案中添加了信息;) –