Hi,
I try to access a I2C device in polling mode but until now without any success. Only one byte 0x3C is sent and this byte does not have to do anything with the data I try to transmit. So that's what I'm doing at the moment:
Initialisation:
- set up correct PIN-muxing
- set up I2C1 module clock
- disable I2C by clearing EN-bit in register I2C_CON
- reset I2C by setting bit SRST in register I2C_SYSC
- disable auto-idle mode by celaring bit AUTOIDLE in register I2C_SYSC
- set the I2C clock to 400 kHz
- set own address 1 in register I2C_OA
- enable I2C by setting EN-bit in register I2C_CON
- wait until bit RDONE in register I2C_SYSS is set to see if reset of I2C was completed
- set mode "Master" and "Transmit" my setting bits MST and TRX in register I2C_CON
- set slave-address 0x1E by writing it into register I2C_SA
Then transmission is done this way:
- set the number of bytes (3) to be transferred by writing them into register I2C_CNT
- read back register I2C_CNT to see what amount of bytes really can be transferred
- wait for bus being free by waiting for bit BB in register I2C_IRQSTATUS_RAW going to 0
- initiate for transfer by writing bits STT, STP, TRX and MST into register I2C_CON
- now in a loop until all three bytes have been sent:
-
- wait until bit XRDY in register I2C_IRQSTATUS_RAW is set
- write next data byte to be transmitted into register I2C_DATA
- write a 1 into bit XRDY in register I2C_IRQSTATUS_RAW to clear the XRDY state
This whole procedure does not result in a valid data transmission. So what could be wring here?
PS: I'm asking this question independent from any software platform, I'm doing this with my own implementation, so this is not specific to any TI software.