AnsweredAssumed Answered

I2C slave mode on KL02Z with processor expert and Kinetis I2C2_LDD

Question asked by George Addison on Apr 19, 2016
Latest reply on Jun 27, 2016 by Marek Neuzil

Hi all,

 

I am using an MKL02Z32VFM4 micro-controller for my project, programming it through the KDS (3.2.0) and PE (3.0.2.b151214). I am using the Kinetis I2C2_LDD component for I2C communications, set to slave mode, running at 93.623kHz at address 0x2A. However, I am not entirely sure how to use the component when it comes to implementing my code. When a master tries writing data to the slave, it enters the I2C2_OnSlaveRxRequest() function in Events.c. I then try receiving the data with:

res = I2C2_SlaveReceiveBlock(&deviceData, &data, 1U);

if (res != ERR_OK) {

     return ERR_FAILED;

}

but every time I2C2_SlaveReceiveBlock() returns 0x08, which is ERR_BUSY /*!< Device is busy. */

Do I need to generate an acknowledgement of the master addressing the slave before attempting to read the data? And if so, how would I go about doing this? I feel as though I am missing some steps here, can anyone point me in the right direction?

 

Many thanks,

 

George

Outcomes