AnsweredAssumed Answered

Can't get I2C_DRV_MasterSendData() to work

Question asked by MIKE WILLIAMS on Jan 6, 2016
Latest reply on Jan 7, 2016 by MIKE WILLIAMS

I'm using a K02 with SDK 1.3.0.  I'm trying to do some basic I2C communication as the Master on bare metal using I2C_DRV_MasterSendData().  I have a breakpoint set in the Master IRQ handler to catch if an ACK wasn't received.

 

If I step into the API call and run to the point where it calls I2C_DRV_SendAddress(), I can see that the slave address is set correctly.  If I try to step into or over this call to send the address, it breaks in the Master IRQ handler saying an ACK wasn't received.  My scope shows that some random byte went out on the bus.  If I delete the breakpoint in the IRQ handler, I can step into the call and again, see that the slave address is correct.

 

I thought maybe the debugger was messing things up so I just let it run past these two lines in my code:

 

ret = I2C_DRV_MasterSendData(I2C_IDX, &I2C_MasterConfig0, NULL, 0, &i2c_data[0], 1);

while (I2C_DRV_MasterGetSendStatus(I2C_IDX, &bytes) == kStatus_I2C_Busy);

 

But that doesn't work either.  This seems like a pretty simple implementation of I2C communication but I can't get it to work. 

 

Any ideas on what to check?

Outcomes