AnsweredAssumed Answered

Question about LS1021a I2C

Question asked by Jian Wu on Jan 23, 2015
Latest reply on Jan 28, 2015 by Jian Wu

Hello,

 

I am working on the LS1021A I2C Host and I2C device driver. Following the I2C programming guideline in LS1021A Reference Manual Rev C.1.pdf  04/2014. I use Freescale LS1021A TWR board Rev C1 board to debug.

 

-- I2C host driver: I based our existed mx-i2c driver and modify I2C registers size and MDIS, IBAL and IBIF clearing bit.

Host mode issue :

Start bit and slave address+R/W bit can be sent to I2C slave device and also can get ACK from I2C slave device when tracking on i2C bus line with scope.

But in master transmit mode(I2C1_IBCR = 0x70, I2C1_IBSR= 0xA0), when data is written to the IBDR, a data transfer isn't initiated correctly.  I can't see date transmit on I2C bus line. After write I2C_IBDR, I2C_IBSR=0xA5,  I got Transmit interrupt (TCF) and slave transmit interrupt(SRW)-- Note: this SRW interrupt suppose not to be happened in master mode. 

In master receive mode (I2C1_IBCR = 0x60, I2C1_IBSR= 0x24),  when read I2C_IBDR register, Next byte receiving isn't initiated.  I can't see date transfer on I2C bus line. After read I2C_IBDR, I2C_IBSR=0xA4.  I got Transmit interrupt (TCF) and slave transmit interrupt(SRW). 

 

-- I2C slave driver 

I use Aardvark I2C device as I2C host. Slave mode issue is similar to Host mode issue.

I can get IAAS interrupt (for slave address matching interrupt )every time when Aardvark host write and read,  but I only can get seldom non-IAAS interrupt (data transfer interrupt ). So some time I2C slave can't transmit/receive any data,  Some time I2C slave can only transmit/receive 1 byte data.  I think the issue looks I2C data register IBDR can't initiated correctly as its doc mentioned. In slave transmit mode, when data is written to the IBDR, a data transfer isn't initiated;  In slave receive mode, reading this register doesn't  initiates next byte data receiving. 


I tested Uboot I2C host driver, it works fine. So I think there is something wrong in my drivers' transmit/receive sequence. I followed Figure26-41.Recommanded i2C interrupt service routine flowchart and 26.6.3.2 Transmit/Receive sequence part in LS1021A Reference Manual Rev C.1.pdf  04/2014.


Could you please give me some suggestion about my issue? SRW interrupt suppose not to be happened in master mode, why I got SRW interrupt in I2C host mode? Why I2C_IBDR can't initiate correctly?

 

Thanks, Jian

Outcomes