KSDK 1.0.0 I2C API's don't behave correctly if cmdSize == 0

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

KSDK 1.0.0 I2C API's don't behave correctly if cmdSize == 0

846 Views
giacomopetrini
Contributor IV

Hello all,

 

backgroud: I'm trying to interface with a air speed sensor: the MS4525DO.

To start a conversion I need to send through I2C only one byte: the address of the sensor. To read the result I need to send the address and then read the 4 byte of data.

 

The problem is that either: I2C_DRV_MasterSendDataBlocking() and I2C_DRV_MasterReceiveDataBlocking() behave not correctly if cmdSize and txSize (for the Send function) parameters are set to zero.

This because there is no control in the function of the value of cmdSize and txSize and in the ISR there is a if(--master->cmdSize > 0) that of course create problem if master->cmdSize is set to 0 from the beginning.

Same thing for txSize.

 

For the moment the workaround is to set the 2 parameters to 1, so the SendData packet is 3 bytes instead of 1 and the ReceiveData packet is 6 bytes instead of 5. Not a big deal (luckily the sensor accept it anyway) but it uses the bus more than the necessary.

 

I hope that in the next release this will be solved.

 

Best Regards

Giacomo

Labels (1)
Tags (2)
0 Kudos
3 Replies

411 Views
giacomopetrini
Contributor IV

Edit:

in any case it seems that something is not behaving correctly (blue pin toggle, green I2C SCL line)

Immagine.png

the end of I2C_DRV_MasterSendDataBlocking() should be shortly after the end of the packet, but it is circa 1 msec after. This value doesn't change even if I modify the timout setting of the function.

Best Regards

Giacomo

0 Kudos

411 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello giacomopetrini:

KSDK v1.1.0 has just been released. Check this: KSDK 1.1 Release

This version includes enhancements to some drivers, including the I2C. I recommend you to install this version and try it.

Let us know if you experience the same problems or share the code of your application.


Regards!,
Jorge Gonzalez

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

0 Kudos

411 Views
giacomopetrini
Contributor IV

just did :smileywink:.

I'm updating the project to use the KSDK 1.1 right now (and I have a wierd error withthe C++ compiler, but I'll open another thread for this).

Regards

Giacomo

0 Kudos