• AVR Freaks

Hot!I2C handshake problem with EFH part

Author
mautry
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2018/05/16 06:59:19
  • Location: 0
  • Status: offline
2020/07/11 18:55:39 (permalink)
0

I2C handshake problem with EFH part

We recently received a new build of product with the latest PIC32MZ2048EFH parts which are exhibiting a handshake problem during the read process.  This problem was not evident with EFG or earlier EFH parts.  Has something changed??  The problem I have is after the MasterNAKSend command, the WaitForACKOrNACKComplete hangs at the end of this snippet.
 
 
for( dataIndex = 0; dataIndex < size; dataIndex++)
{
while(!DRV_I2C0_MasterBusIdle())
{
if(!tek2.I2CTimeout)
{
return false;
}

taskYIELD();
}

DRV_I2C0_SetUpByteRead();
//Set Rx enable in MSTR which causes SLAVE to send data
while(!DRV_I2C0_WaitForReadByteAvailable()) // Wait till RBF = 1; Which means data is available in I2C2RCV reg
{
if(!tek2.I2CTimeout)
{
return false;
}

taskYIELD();
}

*data++ = DRV_I2C0_ByteRead(); //Read from I2CxRCV
if (dataIndex < size - 1)
{
DRV_I2C0_MasterACKSend(); //Send ACK to Slave
DRV_I2C0_WaitForACKOrNACKComplete();
}
} //for

DRV_I2C0_MasterNACKSend(); //last byte; send NACK to Slave, no more data needed

DRV_I2C0_WaitForACKOrNACKComplete(); // wait till NACK sequence is complete i.e ACKEN = 0
#1

5 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18858
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: I2C handshake problem with EFH part 2020/07/11 21:48:35 (permalink)
    0
    Check the part Revision on a programmer.
    You may have the new B2 revision parts.
    If so check the Eratta. And see what’s been fixed and what new things they broke.
    Also my version of harmony are using?
    #2
    mautry
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2018/05/16 06:59:19
    • Location: 0
    • Status: offline
    Re: I2C handshake problem with EFH part 2020/07/12 07:14:07 (permalink)
    0
    This product has been shipped for a couple of years so the harmony version is quite dated, 1.07.  There was no reason to update with the frequency of generated updates, it worked.
    #3
    mautry
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2018/05/16 06:59:19
    • Location: 0
    • Status: offline
    Re: I2C handshake problem with EFH part 2020/07/12 08:15:29 (permalink)
    0
    Yes, it appears to be B2 which is supposed to have fixed I2C issues.
    #4
    NKurzman
    A Guy on the Net
    • Total Posts : 18858
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: I2C handshake problem with EFH part 2020/07/12 12:44:57 (permalink)
    0
    The problem with fixed issues is how the original author did the work around.
    A lot of the early I2C code was garbage.
    But apparently it worked well enough for you.
    You’re going to have to look at what was done in those functions. Hopefully there is a way that will satisfy both revisions of the chip.
    If not you will have to check what revision the chip is and use the proper method For that revision.
    You could try and move up to Harmony 1.11. But I don’t know if that would help. The same for moving up to 2.06. Which may be more difficult depending on what code you have.
    #5
    mautry
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2018/05/16 06:59:19
    • Location: 0
    • Status: offline
    Re: I2C handshake problem with EFH part 2020/07/12 15:10:35 (permalink)
    0
    Thanks for the feedback, it helps.  Moving to another framework would be too difficult at this point but I will see what it will take to get it going again most likely checking rev values for backward compatibility.
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5