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.

TM4C1237D5PM: Timing of Tiva functions and processing time for operations

Part Number: TM4C1237D5PM

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.

  • Hello Trent,

    Is this for a custom board? If so, are there other master devices on the board? What are the values of your pull-up resistors? Can you share the configuration code for your I2C pins? Is there any cabling involved with the I2C connections?

    Typically I've seen that the I2C_MASTER_ERR_ARB_LOST occurs due to some hardware issue (usually minor), hence those questions.

    Regarding the while loop being stuck and forcing a power cycle, here is a solution you want to consider (note just read the first few posts between Brandon and Amit): https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/444151