AnsweredAssumed Answered

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

Question asked by giacomopetrini on Dec 11, 2014
Latest reply on Dec 22, 2014 by giacomopetrini

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