Page 1 of 1

PIC32MX I2C NACK ON ALL READS

Posted: Sat Sep 18, 2021 11:41 pm
by unity-control
Hi there,

Seems I2C module (hardware mode 100Kbit) on PIC32MX130F064D is not acknowledging any READ at all. Is this a known issue? I'm running latest FC9 version.

I have enabled Slew Rate as well as SMB options, but same issue is seen.

I have attached scope trace highlighting the issue.
SDS00001.png
SDS00001.png (28.26 KiB) Viewed 2244 times
The I2C READ routine is exactly the same as the one from the I2C sample FCX files we've been using for years.
I2C_READ.jpg
I2C_READ.jpg (46.17 KiB) Viewed 2244 times
Thanks for taking a look at this!

Re: PIC32MX I2C NACK ON ALL READS

Posted: Tue Sep 21, 2021 10:56 am
by BenR
Hello,

When reading bytes the ack is used as a flag to let the slave know if any more bytes are going to be read. This is the "Last" parameter of the Receive Byte macro.

If last is set to 0 then the byte should be acked and if last is set to 1 then the byte is nacked.

Hopefully this helps.

Re: PIC32MX I2C NACK ON ALL READS

Posted: Tue Sep 21, 2021 3:38 pm
by unity-control
Hi Ben,

Thanks for clarifying, this makes sense! All is working perfectly well now :-)
SDS00002.png
SDS00002.png (45.37 KiB) Viewed 2203 times
Cheers!
R

Re: PIC32MX I2C NACK ON ALL READS

Posted: Tue Sep 21, 2021 6:29 pm
by unity-control
Just noticed the line stays low, so always 1 is needed for last ReceiveByte and should I assume there will never be an ACK? I guess this is how I2C works... I was expecting always an ACK, but I was wrong it seems...

Re: PIC32MX I2C NACK ON ALL READS

Posted: Wed Sep 22, 2021 8:26 am
by LeighM
Yes, as Ben said, on receiving the last byte (from Slave to Master) a NAK is sent (to tell the Slave that no more bytes required)