Other Parts Discussed in Thread: PCA9555
Hi,
I am trying to communicate with IO Expander chip (PCA9555) via I2C. I need to read a register. I have initialized my I2C0 Port and I can see some partial communication on the scope as well.
As can be seen in the picture, I am first writing and then reading, However I dont see any data being transferred from Master to slave during the write operation and similarly No data is coming out from Slave to master during the Read operation however I do see the Slave is Asserting the ACK signal on both transactions.
Here is the Read Operation diagram for IO-Expander (PCA9555)
Here is my code;
void DCCT_I2C_Init(void)
{
//I2C0 Module initialization
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_I2C0)){} //Wait for I2C0 Module to stabilize
I2CMasterEnable(DCCT_I2C_BASE);
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, DCCT_I2C_SCL_PIN);
GPIOPinTypeI2C(GPIO_PORTB_BASE, DCCT_I2C_SDA_PIN);
ROM_I2CMasterInitExpClk(DCCT_I2C_BASE, sys_clock, true);
}
uint8_t I2C_read(uint32_t ulBase, uint8_t chip_address, uint8_t internal_address)
{
ROM_I2CMasterSlaveAddrSet(ulBase, chip_address, false); // Specify slave address with read request set to false
//SysCtlDelay(1000);
ROM_I2CMasterDataPut(ulBase, internal_address); //Place the Internal register address
ROM_I2CMasterControl(ulBase, I2C_MASTER_CMD_SINGLE_SEND); // Initiate send of 1Byte character from Master to Slave
while (!(ROM_I2CMasterBusy(ulBase))); //Wait till end of transaction
SysCtlDelay(1000);
ROM_I2CMasterSlaveAddrSet(ulBase, chip_address, true); // Specify slave address with read request set to true
SysCtlDelay(1000);
ROM_I2CMasterControl(ulBase, I2C_MASTER_CMD_SINGLE_RECEIVE);// Initiate send of character from Master to Slave
while (!(ROM_I2CMasterBusy(ulBase))); //Wait till end of transaction
SysCtlDelay(1000);
return (uint8_t)(ROM_I2CMasterDataGet (ulBase)); //Read from FIFO
}
I thank you all for your time and help.
Regards.

