PIC32MX I2C NACK ON ALL READS

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
unity-control
Posts: 52
http://meble-kuchenne.info.pl
Joined: Wed Sep 08, 2021 10:36 pm
Has thanked: 26 times
Been thanked: 11 times

PIC32MX I2C NACK ON ALL READS

Post 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 2197 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 2197 times
Thanks for taking a look at this!

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: PIC32MX I2C NACK ON ALL READS

Post 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.

unity-control
Posts: 52
Joined: Wed Sep 08, 2021 10:36 pm
Has thanked: 26 times
Been thanked: 11 times

Re: PIC32MX I2C NACK ON ALL READS

Post 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 2156 times
Cheers!
R

unity-control
Posts: 52
Joined: Wed Sep 08, 2021 10:36 pm
Has thanked: 26 times
Been thanked: 11 times

Re: PIC32MX I2C NACK ON ALL READS

Post 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...

LeighM
Valued Contributor
Posts: 394
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 69 times
Been thanked: 208 times

Re: PIC32MX I2C NACK ON ALL READS

Post 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)

Post Reply