How to tell when I2C transmission is complete?

Discussion to talk about software related topics only.
Post Reply
tk1390
Posts: 23
Joined: Thu Apr 13, 2017 10:15 am

How to tell when I2C transmission is complete?

Post by tk1390 »

Hi,

I currently attempting to configure an interrupt based I2C slave on the MOD5234. I am anticipating various commands as variable length writes from a slave and need to concatenate the bytes received into some sort of command. The master will write a command consisting of multiple bytes. The slave is then responsible for processing this command and returning a response after a significant amount of time, say 1 second for the sake of this example.

The issue here is that I would like to NACK during the processing of the command until the response has been generated.

After looking at the ISR in the i2cmulti.cpp file, I don't see anything that indicates to the slave that the write transaction has been completed.

Looking at the register map provided, the I2C Status Register (I2SR) provides a IBB that indicates if a stop signal has been detected. My current path forward is to check this status bit in the main loop and add something that configures the ACK/NACK behavior based on what state the slave is currently in.

Is there a better accepted way of checking when a write transaction has been completed?

Thanks!
Post Reply