Ashok G

KSDK: I2C slave driver unable to detect stop conidtion

Discussion created by Ashok G on Oct 8, 2018
Latest reply on Oct 11, 2018 by Fang Li


There is an issue exists in KSDK 2.0 I2C slave driver when master sends repeated start I2C slave driver fails to detect the stop condition and also event "kI2C_SlaveCompletionEvent" is generated in the callback function when stop is detected.


Stop detection is failing when Random read condition sent by master. See the picture Random Read



After looking closely in to I2C_SlaveTransferHandleIRQ() function, i found a bug in the code which fails to detect in stop condition.



handle->isBusy is set to false when NAK is sent by master after reading data from slave. This flag is checked in stop dection before calling callback function. Since this flag is already cleared when NAK is received, it is not calling the callback function with the event 'kI2C_SlaveCompletionEvent'.


Work around:

Clear the handle->isBusy only if stop condition is detected. Here is the code snippet with the commented the flag .

File: fsl_i2c.c