I am using the SDK 2.0 I2C driver with FreeRTOS on a KL16. I am setting up as an I2C slave. I am finding that the driver is not properly detecting stop events when the master is reading data from the slave. Instead the driver continues to send data to the D register and eventually returns an NAK event.
Using an I2C sniffer I can see that the bus did, in fact, send a stop and moves on to communicating to the next device on the bus. For now my solution has been to remove the ifdef I2C_HAS_STOP_DETECT and force the kI2C_SlaveCompletionEvent when I know the entire packet has been read by the master. But I would rather it did not work this way.
The code is nearly identical to the freeRTOS I2C example.
Hi David,
I am sorry, but I don't think you have to remove the ifdef I2C_HAS_STOP_DETECT and force the kI2C_SlaveCompletionEvent, because the i2c slave interrupt handler sets this event when STOP flag is set, please kindly refer to the following for details.
and kI2C_StopDetectFlag is checked in I2C_SlaveGetStatusFlags().
Hope that helps,
Best regards,
Kan