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.

TM4C1292NCPDT: I2C state handle

Part Number: TM4C1292NCPDT

Hi,

I am working TM4c1292NCPDT microcontroller using TIVA drivers libraries.

I2c master communicating with temperature sensor ,The temperature sensor have the conversation time about 8ms. If i press RESET in the conversation time(8ms) of temperature sensor and after reset if master tries to communicate with temp sensor it gives a arbitration lost error  .How can i handle this type of error from master side

 

  • If i press RESET in the conversation time(8ms) of temperature sensor and after reset if master tries to communicate with temp sensor it gives a arbitration lost error 

    Is this RESET a reset to the MCU or to the temp sensor or to both? Please clarify. 

    If the RESET is not going to both the MCU and the temp sensor then after reset these master and slave pair will go out of sync. Bear in mind, neither one of them knows that the other side was reset in the middle if the reset only goes to one of them individually. 

    libraries.

    Looking at the waveform, it seems that the reset is applied while the master is still owning the bus. As you can see the SCL clock is still low when you apply the reset. If this reset is a controlled reset then I will suggest you first force the master to IDLE state before you apply the reset. In IDLE state, the SCL will be high. 

    If the prior transaction is completed successfully the master will move its its state machine to the IDLE state  and release the bus. This is normally the case when you issue   I2C_MASTER_CMD_SINGLE_SEND or I2C_MASTER_CMD_BURST_SEND_FINISH. If you are in the middle of a burst transaction like I2C_MASTER_CMD_BURST_SEND_START or 2C_MASTER_CMD_BURST_SEND_CONT, the SCL bus will remain low. If you have an error, you can use 2C_MASTER_CMD_BURST_SEND_ERROR_STOP to force a STOP on the master side. 

    This app note will be helpful. https://www.ti.com/lit/pdf/spma073

  • I am only RESETING the microcontroller that's why i am facing this issue. The TEMP sensor don't have any RESET pin.

     How to do this "force the master to IDLE state before you apply the reset"

  • How can i do the controlled reset.

  • I though I just answered in my prior reply. Please read again. I'm pasting here again. 

    If the prior transaction is completed successfully the master will move its state machine to the IDLE state  and release the bus. This is normally the case when you issue   I2C_MASTER_CMD_SINGLE_SEND or I2C_MASTER_CMD_BURST_SEND_FINISH. If you are in the middle of a burst transaction like I2C_MASTER_CMD_BURST_SEND_START or 2C_MASTER_CMD_BURST_SEND_CONT, the SCL bus will remain low. If you have an error, you can use 2C_MASTER_CMD_BURST_SEND_ERROR_STOP to force a STOP on the master side. 

  • Just one note of caution, the slave has no idea that the master is reset. Due to the MCU reset, both the master and the slave are out of sync. You must resync them again. Forcing the master to IDLE state with the bus released does not fully mean the slave will be sync up with the master again.  If the slave is holding SDA low which is evident on your scope capture, the only way to get the slave out of this state is with edges on SCL. Since the I2C module sees this as a different master holding the bus, it will not attempt to drive SCL. You will need to bit-bang the bus. Resetting the module, or time-out of the master does not change the state of the slave. You might want to check with the slave device vendor. Some slave devices may be forced to reset by forcing the bus to certain state for certain duration. Your slave device vendor can provide you this information.

    See below reply by Bob. 

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/954162/tm4c1294ncpdt-problems-resetting-i2c-communication