2017-06-15 33 views
0

HAL_I2C_Mem_xxxライブラリを使用しているi2cデバイスのSTM32用のeepromライブラリを継承しました。 私が気づいたことは、保存された各パラメータに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. 

は、このすべてが本当に、今日必要とされている:完全に明確ではない何

は、同様に、次のでしょうか?

よろしく、

答えて

0
I was wondering if this is a safety mechanism to avoid wrong data to be written/read 
and if this is the state of the art when using an eeprom over i2c. 

まあ、私はあまりにもSTM32 +のEEPROMを備えたアプリケーションで作業し、正確にこれらの同じ質問を持っていた、いくつかの検索の後、私はEEPROMとして、値のチェックのいくつかの種類が必要ですことをfouldています彼らはbitflipにsuccsetibleであり、データの完全性(ECCとして)を保証するより洗練された方法がありましたが、この方法は効果的で実装が容易であることが証明されていますので、私の意見ではこれが "仕事をする"でしょうEEPROMにデータを格納するためにエンジンECUによって使用さえも)。

また、私はパラメータを格納するためのEEPROMを使用してあきらめたと私は代わりに、私はEEPROMをエミュレートします、PCBに未実装のEEPROMを残します私の場合は1、2、3、4

にあなたのポイントに同意します(I2Cは時々実際にはバギーです)

私はまだ私のEEPROMエミュレーションをコーディングしていますが、それは動作している方法に基づいていますST(http://www.st.com/en/embedded-software/stsw-stm32010.html)のアプリケーションノートAN2594に記載されています。 また、ANに記述されたコードは、私のコンピュータにでislocated HALライブラリパッケージに含まれている:STM32Cube_FW_F1_V1.4.0 \プロジェクト\ STM32F103RB-ヌクレオ\アプリケーション\ EEPROMの\のEEPROM_Emulation

+0

あなたは、コードの一部のビットを提供してもらえフラッシュでeepromを実装するには? – Luigi

+0

@Luigi答えに情報を追加しました;) –