TWR-K65F180M I2C Send/Receive Not Working

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

TWR-K65F180M I2C Send/Receive Not Working

606 Views
savoca
Contributor I

Hi,

 

I'm using a TWR-K65F180M board and trying to communicate with an MPU I've attached to PTE18/PTE19 SDA/SCK. Whenever I run:

 

I2C_DRV_MasterSendData(i2cCom1_IDX, &i2cCom1_MasterConfig0, NULL, 0, wrBuf, sizeof(wrBuf));

 

or

 

I2C_DRV_MasterReceiveData(i2cCom1_IDX, &i2cCom1_MasterConfig0, NULL, 0, rdBuf, sizeof(rdBuf));

 

I get a return of kStatus_I2C_Success, however the buffer is always empty when data is normally expected.

 

Under linux my driver works perfectly for this chip, using standard I2C API:

 

uint8_t buf[8];

struct i2c_msg msg[] = {

     .addr = client->addr,

     .flags = I2C_M_RD,

     .len = sizeof(buf),

     .buf = buf,

};

i2c_transfer(client->adapter, msg, 1);

 

Also, calls like this loop forever:

I2C_DRV_MasterGetSendStatus(i2cCom1_IDX, NULL);

I2C_DRV_MasterGetReceiveStatus(i2cCom1_IDX, NULL);

 

Additionally, I can't seem to communicate with the internal accelerometer either, using similar methods.

 

KDS 3.0.0 / PE 3.0.1 / KSDK 1.3.0

 

There doesn't seem to be any documentation on how I should be setting this up, not that I'm asking to have my hand held here or anything... But if there's something here I'm missing please help so I can use the Freescale platform.

Labels (1)
0 Kudos
2 Replies

338 Views
savoca
Contributor I

Update: It seems I can read '0xff' from i2c using:

I2C_DRV_MasterReceiveData(i2cCom1_IDX, &i2cCom1_MasterConfig0, NULL, 0, data, sizeof(data));

while (I2C_DRV_MasterGetReceiveStatus(i2cCom1_IDX, NULL) != kStatus_I2C_Success) {}

However when I specify a cmd arg/len in place of "NULL, 0", the operation hangs on the while loop. Standard I2C writes also fail.

0 Kudos

338 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Alex Deddo:

Please confirm if you have enabled the Open Drain setting for the I2C pins (PTE18/PTE19). See my latest reply at the next discussion:

Re: I2C on KDS and configuring the component

If that is not the cause please share your test project so I can give it a try from my side and find what is wrong.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos