AnsweredAssumed Answered

MQX4.2 doesn't support slave I2C.

Question asked by Mark Kalior on Feb 22, 2016
Latest reply on Jun 28, 2016 by adir cohen

I am using K20 running MQX4.2 connected to the I2C bus in slave mode (and always in slave mode).


My application requires the I2C master to send the device address and a control byte, the K20 responds with 20 bytes.

If the master sends an I2C write, the K20 sees the control byte (fread(..)).   If the master sends I2C read, the K20 never returns from the fread(...) (I'm expecting the fread to return the Control byte) and thus never sends it data (fwrite(...)).


I suspect the MQX4.2 slave I2C code does not support the I2C control byte, which is base I2C protocol.


I have tried to send the control byte in one I2C transaction (write), then the I2C read transaction.   The read transaction doesn't work either. 



....ioctl(..., IO_IOCTL_I2C_SLAVE_MODE, ...);


...ioctl(...,IO_IOCTL_SET_RX_REQUEST, 1);



...fread(...); // looking for the control byte

...ioctrl(...., IO_IOCTL_I2C_STOP);  // done

...fwrite(...); // data to send to the master.

...ioctrl(...., IO_IOCTL_I2C_STOP);  // done