This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Good day,
I am attempting to use the TCA6424A IO Expander when interfacing with the CC3220SF MCU as the master. Both devices are Texus Instruments ICs.
the issue I am facing is that after the first write trancaction on the I2C bus, I am able to further communicate with the TCA6424A.
Steps to reproduce are as follows:
After putting the SCL & SDA lines on the oscilliscope, I noticed the following:
void i2c_init(void) { I2C_Params i2cParams; I2C_init(); I2C_Params_init(&i2cParams); i2cParams.bitRate = I2C_100kHz; strak_i2c = I2C_open(neroSTRAKv1_I2C0, &i2cParams); if (strak_i2c == NULL) { //while (1); UART_PRINT("I2C Failed to initialize !\r\n"); } else { UART_PRINT("I2C initialized\r\n"); } }
#################################################################
uint32_t iox_write_axsem_cs_pin_config(void)
{
uint8_t txBuffer[2];
// uint8_t rxBuffer[1];
I2C_Transaction i2cTransaction;
txBuffer[0] = IOX_CMD_CONFIG_P0;
txBuffer[1] = PORT0_DIR_MASK;
i2cTransaction.slaveAddress = I2C_IOExpander_Addr >> 1; //read
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 2;
//i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 0;
if (I2C_transfer(strak_i2c, &i2cTransaction))
{
UART_PRINT("IOX AXSEM pin output config complete\r\n");
return 1;
}else
{
iox_reset();
UART_PRINT("IOX AXSEM pin output config failed\r\n");
return 0;
}
###########################################################33}
void twi_recover(uint8_t pulses)
{
GPIO_PinConfig pinConfig_sda;
GPIO_PinConfig pinConfig_scl;
GPIO_setConfig(pinI2C_SDA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH);
GPIO_setConfig(pinI2C_SCL, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH);
uint8_t i = 0;
uint8_t j = 10;
for (i = 0; i < pulses ; i++)
//while(1)
{
// GPIO_write(pinI2C_SDA, 0);
// //usleep(j);
// __delay_cycles(67);;
GPIO_write(pinI2C_SCL, 0);
//usleep(j);
__delay_cycles(67);
// GPIO_write(pinI2C_SDA, 1);
// //usleep(j);
// __delay_cycles(67);;
GPIO_write(pinI2C_SCL, 1);
// //usleep(j);
__delay_cycles(67);
}
I2C_close(strak_i2c);
i2c_init();
usleep(500000);
}
########################################
main()
{
GPIO_init();
iox_init_pins(); //Once taken out of reset all lines are inputs with pull up
SPI_init();
UART_init();
I2C_init();
iox_write_axsem_cs_pin_config();
sleep(1);
twi_recover(9);
sleep(1);
iox_write_axsem_cs_pin_config();
sleep(1);
while(1);
}
TRX Bobby said:Hey Nishant,"After putting the SCL & SDA lines on the oscilliscope, I noticed the following:"
Can you provide us with the scopeshot?
Thanks,
-Bobby
Sorry Bobby, i don’t have the probe shots with me this weekend, but basically I see the scl & sda lines toggling correctly for the first write transaction, meaning I see the stop bit, start bit and correct data on the lines. After the stop condition the scl & sda lines are pulled high for a period of 300ms after which the SDA is driven low. There after (at 12.5s intervals) there is a 300ms hi pulse on the sda and then it is driven low again.
This is the shot showing the first write transaction after which the data line goes low
This is the shot showing the data line pulsing hi every 12s after the data line went low
This is the shot of what happens on the data lines when the first write transaction was successful
This is a shot of read transaction
It looks like the TCA6424A is ACKing when written to and can be read from properly. I do not suspect the issue is from the TCA6424A. I'll reassign this post to someone in the MCU side to take a look at this.
Hopefully they can take a look at your code and see if anything is wrong.
Thanks,
-Bobby
Hi,
Further to what I have observed, it seems like the issue is only occurring when I write to the configuration register (0x0C) .
Writing to the Polarity Inversion register gives no issues.
Thanks