MKE02Z64 I2C issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKE02Z64 I2C issue

560 Views
davideferrario
Contributor II

Hello,

I'm working on a project that use MKE02Z64VLC4 MCU and I2C0 bus as master to communicate with two devices.

I'm using MCUXpresso Software Development Kit Rev. 2.6.0 and I2C_MasterTransferNonBlocking.

What I see is that I2C seems to be a little unstable. I am making an heavy use of I2C.

What I see is that I2C works for a while at startup; but after some seconds the "I2C_MasterTransferNonBlocking" routine is getting "kStatus_I2C_Busy" result.

I tried to debug a little and I see that the cause is into "I2C_MasterStart" function; the first if statement of this function is true and then I get "kStatus_I2C_Busy" result:

/* Return an error if the bus is already in use. */
if (0U != (statusFlags & (uint32_t)kI2C_BusBusyFlag))
{
    result = kStatus_I2C_Busy;
}

I tried to search for some example of I2C Master in interrupt with error handling but I can not find something.

0 Kudos
1 Reply

509 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Davide,

It seems there is no example shows how to deal with it.  kStatus_I2C_Busy is caused by I2Cx->S.BUSY register bit. When busy, it is set by hardware, which means a start condition is detected on bus. It is cleared when a stop condition is detected on bus. Please use a oscilloscope to check the waveform. I guess a previous communication sequence was not ended correctly.

Regards,

Jing

0 Kudos