Mini Wang

MQX 3.8.1 I2C Master mode question

Discussion created by Mini Wang on Dec 6, 2012


I meet some problem when I use MQX I2C.

The environment is [MQX3.8.1] & [CW10.2].

I2C mode is master mode.



I would like to read one byte, but it transmit 2 bytes.

I have searched the information on this forum, there is a similar issue to mine. But it's happened in MQC 3.6.0 and slave mode. The code seems not the same, so I can't fix my issue with the solution.

please refer:  I2C Slave sample code


In _ki2c_polled_rx_tx funtion, there is a dummy read after send the receive requested, is it necessary?

Because this dummy read so I always see the extra waveform from my oscilloscope. I'm not familiar with I2C driver, don't know how to fix this issue.

(location-> C:\Program Files\Freescale\Freescale MQX 3.8\mqx\source\io\i2c\polled\i2c_pol_ki2c.c)



When I call I2C_ReadByte(0x34,0x26). Although it transmit 2 bytes after the receive request, I can get the right return value : 0x0E, and the data/clock bus are fine(all high).



But when I call I2C_ReadByte(0x34,0x27), I can't get the return value, cause the data bus keep low after the sceond byte is read.



Why it's different result when I call the same funtion?

I have tried many address/offset, only I2C_ReadByte(0x34,0x26) can retrun the right value so far.



the attached file: I2C.c is my code that refer to the sample code and document. In this file, only the I2C_WriteByte function is OK. If any one familiar with I2C, please help me to check is it any problem with my code? Thank you very much.


Thank you in advance.



Original Attachment has been moved to: