AnsweredAssumed Answered

How to implement SMBus blockread with LEN=1 on i.MX 6

Question asked by E Strooisma Employee on Jul 23, 2015
Latest reply on Aug 23, 2015 by E Strooisma

My goal is to implement a SMBus blockread operation using the I2C controller of i.MX 6. In this operation the slave indicates the amount of bytes of the transfer by the first byte it returns.

The level for the acknowledge bit needs to be set before starting that transfer. Reading from the I2DR register returns the value of the LAST byte and starts the transfer of the NEXT byte. To set a NACK for the last byte (LEN) of the I2C read operation I have to write to the configuration register (I2CR) before reading byte LEN-1.

I run into a problem when LEN is 1, because in that case I need to write to I2CR before reading the length byte. This is obviously impossible because I do not know in that case that the next byte will be the last one.

 

How could I implement this SMBus with LEN=1 such that the acknowledge bit of the last byte is set properly?

Outcomes