I2Cスレーブ動作時のストップ条件検出について

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

cross mob
AkNa_2677371
Level 1
Level 1
5 sign-ins Welcome! First question asked

PSoC5のI2Cをスレーブモードで使用しています。

スレーブでデータの転送中にメインループ内で送信内容が変更されることがあったため、

I2Cの通信が開始するとデータ更新を止め、NACKが検出されると再度更新を開始するプログラムとしました。

しかし、この方式の場合はマスターが何らかの要因で途中でデータ読出しを中止すると、

NACKを受け取ることなく次の通信が開始されることが懸念されます。

このため、マスターが発行したストップコンディションをスレーブで検出し、

この場合もデータ更新を再開するようにしたいと考えています。

ただ、I2Cのマニュアル"I2C Master/Multi-Master/Slave"を見た限りではスレーブで

ストップコンディションを検出する方法が記載されていないのですが、

何らかの方法でストップコンディションを検出することは可能でしょうか。

0 件の賞賛
1 解決策
KyTr_1955226
Level 6
Level 6
250 sign-ins 10 likes given 50 solutions authored

A rough google translation:

I2C of PSoC 5 is used in slave mode.
Because the content of transmission was sometimes changed within the main loop during the data transfer by the slave,
When communication of I2C starts, data update is stopped, and it is set as a program which starts updating again when NACK is detected.

However, in this method, if the master stops data reading midway due to some reason,
There is concern that the next communication starts without receiving NACK.

For this reason, the slave detects the stop condition issued by the master,
In this case, I also want to restart the data update.

However, as far as I2C's manual "I2C Master / Multi-Master / Slave" is seen, it is a slave
Although there is no description on how to detect the stop condition,
Is it possible to detect the stop condition in some way?

If I'm understanding, you want to detect the I2C stop condition.

There is a status register for slave mode listed on Page 52 of the I2C component datasheet that includes a stop status bit:

pastedImage_0.png

Is this what you are looking for?

元の投稿で解決策を見る

0 件の賞賛
2 返答(返信)
KyTr_1955226
Level 6
Level 6
250 sign-ins 10 likes given 50 solutions authored

A rough google translation:

I2C of PSoC 5 is used in slave mode.
Because the content of transmission was sometimes changed within the main loop during the data transfer by the slave,
When communication of I2C starts, data update is stopped, and it is set as a program which starts updating again when NACK is detected.

However, in this method, if the master stops data reading midway due to some reason,
There is concern that the next communication starts without receiving NACK.

For this reason, the slave detects the stop condition issued by the master,
In this case, I also want to restart the data update.

However, as far as I2C's manual "I2C Master / Multi-Master / Slave" is seen, it is a slave
Although there is no description on how to detect the stop condition,
Is it possible to detect the stop condition in some way?

If I'm understanding, you want to detect the I2C stop condition.

There is a status register for slave mode listed on Page 52 of the I2C component datasheet that includes a stop status bit:

pastedImage_0.png

Is this what you are looking for?

0 件の賞賛

上記回答にございますようにI2C_CSRレジスタによりストップコンディションを検知することが可能です。

更にサポートが必要な場合、ご連絡ください。