I am getting I2C0 bus arbitration lost error. On probing SDA line, found that it is stuck at low. Even doing a power cycle does not help. Looked into various forums, where it was suggested to toggle the SCL line few times configured as a GPIO. I did the same as listed below:-
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
MAP_GPIOPinTypeGPIOInput (GPIO_PORTB_BASE, GPIO_PIN_3); // I2C data
MAP_GPIOPinTypeGPIOOutput (GPIO_PORTB_BASE, GPIO_PIN_2); // I2C Clk
count = 0;
while(MAP_GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_3) == 0) {
MAP_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2, 0);
//for(i=0;i<1000;i++) ;
SysCtlDelay((120000000/(3 * 1000000)) * 1); //wait 1ms
MAP_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_PIN_2);
//for(i=0;i<1000;i++) ;
SysCtlDelay((120000000/(3 * 1000)) * 1); //wait 1ms
count++;
if(count > 100) //max 100 toggles before giving up to ensure we don't get stuck here
break;
}
After this i initialize I2C peripheral as normal.
The above approach is not resolving my problem. I even configured the I2CSDA as open drain i.e. MAP_GPIOPinTypeGPIOOutputOD(GPIO_PORTB_BASE, GPIO_PIN_2) as someone suggested and even that did not work. Can someone please help me resolve this issue.
Thanks
Sumeet Deo