PSoC5LP内のEEPROM制御について

Tip / ログイン to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
TeMa_2997106
Level 6
Level 6
Distributor - TED (Japan)
10 likes received 10 solutions authored 250 replies posted

PSoC5LP内にあるEEPROMに対して、16Byte未満の複数ByteをNon-Blockingで一括書込みしたいと考えています。

指定位置のデータを変更した後、EEPROM_StartWrite()を呼べば実現できると考えていますが正しいでしょうか。

※この関数がBlocking呼び出しなのかNon-Blocking呼び出しなのかがわかりませんでした。

もし、Non-Blockingではない、もしくは一括で書き込みできない場合は、

どのように処理すればよいでしょうか。

宜しくお願いします。

0 件の賞賛
1 解決策
AikoO_51
Moderator
Moderator
Moderator
100 sign-ins First question asked 50 solutions authored

結論から言うと、16 Byte未満の複数Byteの書き込みが可能で、且つブロッキングコードでないAPIはありません。

まずEEPROM_StartWrite API についてですが、EEPROMコンポーネントで自動生成されるEEPROM.cファイル内にAPIの説明について下記の記載があります。

*  This function does not block. The function returns once the SPC has begun

*  writing the data. This function must be used in combination with

*  EEPROM_1_Query(). EEPROM_1_Query() must be called

*  until it returns a status other than CYRET_STARTED. That indicates that the

*  write has completed. Until EEPROM_1_Query() detects that

*  the write is complete, the SPC is marked as locked to prevent another

*  SPC operation from being performed.

*  Starts a write of a row (16 bytes) of data to the EEPROM.

APIの処理内容でもブロッキングコードにはなっていないのですが,16 Byte固定での書き込みになります。

 

PSoC CreatorにあるPSoC5LPEEPROMサンプルコードで使用されているEEPROM_WriteByteAPIは、Byteごとに書き込みを行うのですが、処理が終わるまでブロックされます。

ですので、どのような処理を希望するかによりますが、Non-Blockを諦めてEEPROM_WriteByte を使用し、16 Byte 未満の希望のByte数のdataを書き込むという選択や、EEPROM_StartWrite APIを使用して16 Byteに満たない分のByte数を補うcodeを作成するなどの工夫が必要になります。

以上の点を考慮して、どのような処理にするかご検討ください。

Aiko Ohtaka
Infineon Technologies

元の投稿で解決策を見る

0 件の賞賛
4 返答(返信)