I2C Bus - Loss of arbitration fault comes for single master bus.

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Bus - Loss of arbitration fault comes for single master bus.

Jump to solution
971 Views
CEPL_Dev
Contributor III

Hi,

      I've been trying to interface a capacitive touch controller IC from ATMEL (AT42QT1070) with #Kinetis MKE04Z128‌ MCU through #I2C bus. The routine for reading data from the device is as follows.

1. START I2C

2. Send device slave address with write bit.

3. Send address of memory location which we wish to read.

4. STOP I2C

5. START I2C

6. Send device slave address with read bit.

7. The device will then send an ACK followed by the data byte.

8. Master sends NACK to end data transfer.

9. STOP I2C

I'm running this routine continuously in a loop to read from the device. But sometimes in the loop, when I change the master to receive mode, instead of receiving data from the slave, the data buffer shows the last data sent to the slave which is the slave address with read bit. As i stepped in to the code while trying to debug, I found out that the SDA line was held low by the slave while the master wants it to be high during the address transmission. So the master goes to Loss of Arbitration fault and communication halts.  This is not happening every-time I run this routine, It's random, but once it happens the bus goes idle and thus communication halts.

The bus lines are pulled up using 4.7 K resistors (Tried 10K too). I tried different baud rates from 100KHz to 400KHz (which is the maximum as per IC datasheet)

What could be the issue with the slave to hold the SDA low? How do we solve this issue?

Regards
Prasanth
Labels (2)
0 Kudos
1 Solution
476 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Prasanth,

    Before you want to change the master to receive mode, please try to send the STOP signal at first, then send the read command, and try it again, whether you still have problems or not?

    If you still have problems, please also give me the I2C bus wave about the normal working and problem wave.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
477 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Prasanth,

    Before you want to change the master to receive mode, please try to send the STOP signal at first, then send the read command, and try it again, whether you still have problems or not?

    If you still have problems, please also give me the I2C bus wave about the normal working and problem wave.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
476 Views
CEPL_Dev
Contributor III

Hi Kerry,

Sending the STOP signal before changing the master to receiver mode solved the 'incorrect data in buffer issue' , but I was still getting the loss of arbitration fault randomly after a few cycles of running the same routine. I made a bus release function to release the bus held low by the slave by changing the I2C lines to GPIO and sending clock pulses through the SCL line until the slave releases the bus. This worked fine but later I found out the root cause of this fault was a noisy power supply, which might've interfered with the logic in bus lines. Replacing the supply solved the issue permanently.

Thank you so much for helping.

- Prasanth

Regards
Prasanth
0 Kudos
476 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Thanks a lot for your root problem solution sharing, the stable power supply is really very important.

Actually, when you meet the problem, use the oscilloscope to check the I2C bus very help you to find the problem, if the power supply is not stable, the I2C wave may be distorted.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos