• AVR Freaks

Problem with I2C

Author
dobrosoft
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2019/05/20 04:44:55
  • Location: 0
  • Status: offline
2020/03/26 08:27:24 (permalink)
0

Problem with I2C

Hello, I have strange problem with I2C. Master is PIC32MZ2048efh100 , Harmony 2.06. It works well, but I need to do communication errorless - between i2c slave and i2c master is cable - about 30cm. There is not problem with communication. But I test next situation:
 
When system is communicating, I2C data wire I connect hard to ground for some seconds and then disconnect from ground. From this point i2c is not communicating. All while loops in I2C are protected with timer for situation when slave not answer and not communicating. I got status, that communication with I2C is lost, when data wire grounded to zero. But after disconnect from zero, It look like communication continues. Above situation does not do problem with main application loop, only i2c will not communicate correctly. 
 
In debugging I found that when I will not send stop bit in i2c communication, this will fix the problem. But It's not correct solution. What can cause this problem with I2C ?
#1

3 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18372
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Problem with I2C 2020/03/26 09:13:13 (permalink)
    4 (2)
    What is the Slave? is it a Hardware device? Is you are messing with the Bus you will need to clear the non responding slave.  This is usually done by sending 9 clocks then a stop bit.
    #2
    Paul PortSol
    Super Member
    • Total Posts : 577
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: Newfoundland, Canada
    • Status: offline
    Re: Problem with I2C 2020/03/27 05:28:00 (permalink)
    5 (1)
    Bugs in PIC32MZ I2C hardware.
    See the PIC32MZ errata (on website with datasheet).
    Safer to use I2C BitBang option in MHC (or you have to check PIC's silicon version and workarounds).
     
    **Best check Errata for all PIC features you use to avoid surprises.
     
    Paul
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 18372
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Problem with I2C 2020/03/27 06:11:33 (permalink)
    0
    I am using HW for the PIC32MZ it works fine within the limits of the Errata. But bit bang the clearing locked i2c slaves.
    #4
    Jump to:
    © 2020 APG vNext Commercial Version 4.5