I am attempting to write to a register on a TC664 fan controller. To write to DUTY (register 0x06), I need to write 0x1B, 0x06, and the data byte (in this case 0x0F) to the I2C bus.
I am using a TM4C129ENCPDT in a TQFP128 package.
I am using the following code:
I2CMasterSlaveAddrSet(I2C0_BASE, TC66x_I2C_ADDR, 0); I2CMasterDataPut(I2C0_BASE, 0x06); I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START); while(I2CMasterBusy(I2C0_BASE)); I2CMasterDataPut(I2C0_BASE, 0x0f); I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH); while(I2CMasterBusy(I2C0_BASE)); if(I2CMasterErr(I2C0_BASE) != I2C_MASTER_ERR_NONE) { ERR_PRINTF("tc66x: i2c error (0x%08x) while adjusting duty\r\n", I2CMasterErr(I2C0_BASE)); }
The problem I'm having is about 70% of the time the register command 0x06 is not written and instead only the slave address followed by 0x0F is written. It seems as if the internal data FIFO is not being emptied correctly or that the busy command returns too early.
I'm attaching two scope screenshots, first shows the correct write sequence and the second shows an incorrect write sequence. I2C decode is in green.
No error appears to be detected by I2CMasterErr.
Any assistance appreciated.