cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

AkNa_2677371
New Contributor

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

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

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

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

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

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

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

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

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

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

0 Likes
1 Solution
KyTr_1955226
Valued Contributor

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?

View solution in original post

0 Likes
2 Replies
KyTr_1955226
Valued Contributor

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?

View solution in original post

0 Likes
TakashiM_61
Moderator
Moderator

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

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