Hi,
I am a beginner to TI controller, I have interface 24 inputs to controller via i/o expanders PCA9539, but sometime i face problem of i/o expander looses its configuration and displays all the input, In my application these inputs are nothing but faults of the system like Water overflow fault, low level fault etc.... which I should display on the screen whenever it will occur, but now it is showing all the faults simultaneously...so i think the i/o expander hang in this case shows all faults or i am wrong in i2c configuration. Please go through the code and help me if you can.
/*********************************************************************************************
* Function: I2C_Configure
* Description: Configures three IO Expander chips to input and output as per functionality
*
********************************************************************************************/
void I2C_Configure(void)
{
//Configure U48 TCA9539 with Both Ports as Output
I2C_Slave_Configure_Write(EXP_0_Addr, 0x00, 0x00);
//Configure U49 TCA9539 with Port0 as Output and Port1 as Input
I2C_Slave_Configure_Write(EXP_1_Addr, 0x00, 0xFF);
//Configure U50 TCA9539 with Both Ports as Input
I2C_Slave_Configure_Write(EXP_2_Addr, 0xFF, 0xFF);
}
Here is an Initialization calls
//======================================================================
//I2C init (PB2 -> SCL) (PB3 -> SDA)
//======================================================================
GPIOPinTypeI2CSCL(I2C_PORT, EXP_SCL_PIN); // I2CSCL
GPIOPinTypeI2C(I2C_PORT, EXP_SDA_PIN);
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
GPIOPadConfigSet(I2C_PORT,EXP_SDA_PIN,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_OD);
HWREG(I2C0_BASE + I2C_O_MCR2) |= I2C_MCR2_GFPW_M; // Set to 31 clock glitch filter
HWREG(I2C0_BASE + I2C_O_MCR) |= I2C_MCR_GFE;
I2CMasterInitExpClk(I2C0_BASE, SysCtlClockGet(), false);// "False", 3rd argument, specifies slow transfer mode of 100Kbps i.e.STANDARD Mode