I am having an issue with the I2C module in the TM4C1237D5PM part. I have communication working but intermittently i get an error on the bus (I2C_MASTER_ERR_ARB_LOST). The code detects the error and does a peripheral reset. This is intermittent at best and even after the error occurs and the peripheral is reset we still see this error. and at some point the processor gets stuck in a while loop waiting for the master to say it is no longer busy. This causes the need for a power cycle. once power is cycled we return to normal operation for a while but eventually this error occurs again. The fix i have found is to insert wait loops into the code at certain points to allow enough time for everything to function properly.
error producing portion of code:
I2CMasterSlaveAddrSet(I2C0_BASE, address, false); I2CMasterDataPut(I2C0_BASE, cmdRegister); I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND); while(I2CMasterBusy(I2C0_BASE)) osThreadYield();
error free code:
I2CMasterSlaveAddrSet(I2C0_BASE, address, false);
I2CMasterDataPut(I2C0_BASE, cmdRegister);
I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND);
I2CBusFreeDelay();
while(I2CMasterBusy(I2C0_BASE)) osThreadYield();
I2CBusFreeDelay();
I2CBusFreeDelay(); = loop for 500 cycles.
When a peripheral is accessed and asked to do things time and clock cycles will pass but i can't find any specifics on how long that time is (clock cycles to assert and execute commands). Is there any information i can get to tell me how long these functions will take before they are fully asserted? My current application is not timing critical and low speed is ok but, in the future it may not be. I2C is the only place i have noticed but i need to know if there are any other areas that i may be on the edge of acceptable timing. If this information exists it would be great to have for all Tiva functions.
Thanks in advance for any help.