I was using known working code, and suddenly, after a few days of things working properly, I started getting no tag reads whatsoever when setting setPassiveActivationRetries(0x01); in the iso14443a_uid example.
Alternate behavior observed: It would read the tag once fine, then hang on the next readPassiveTargetID(); after a tag was read.
I enabled some of the debugs in the library, and saw there was NO ACK FRAME messages when it tried to send data to the PN532.
I made changes in Adafruit_PN532.cpp:
Under line 335 where it says // I2C TUNING
I changed this on line 336:
delay(SLOWDOWN); (Original line in 1.3.1)
to delay(1); (My modification.)
This means a delay of 1ms no matter what interface you're using. I'm using SPI. Before the modification, the library would only delay if you're using i2c. This fixed my issue.
I have board v1.3, I am using library 1.3.1. I see this behavior on two separate Adafruit PN532 boards. Both 1.3. This fixed the issue on both of them. I'm using a ESP32-S3-DevKitC-1 with both boards (Not the same one, this issue exists on two independent adafruit boards with a different ESP32-S3-DevKitC-1 on each.
The weirdest part is it WAS WORKING on one of the setups without the delay a few days ago, and was working solidly for a few days so it wasn't a fluke. I'm guessing the PN532 is just on the hairy edge of responding fast enough.
Let me know if I should pull request this, I'd be happy to. I have tested it with the iso14443a_uid example with and without the library modifications several times. It reliably breaks/fixes things when I remove/add that delay(1);
I was using known working code, and suddenly, after a few days of things working properly, I started getting no tag reads whatsoever when setting setPassiveActivationRetries(0x01); in the iso14443a_uid example.
Alternate behavior observed: It would read the tag once fine, then hang on the next readPassiveTargetID(); after a tag was read.
I enabled some of the debugs in the library, and saw there was NO ACK FRAME messages when it tried to send data to the PN532.
I made changes in Adafruit_PN532.cpp:
Under line 335 where it says // I2C TUNING I changed this on line 336:
delay(SLOWDOWN); (Original line in 1.3.1)
to delay(1); (My modification.)
This means a delay of 1ms no matter what interface you're using. I'm using SPI. Before the modification, the library would only delay if you're using i2c. This fixed my issue.
I have board v1.3, I am using library 1.3.1. I see this behavior on two separate Adafruit PN532 boards. Both 1.3. This fixed the issue on both of them. I'm using a ESP32-S3-DevKitC-1 with both boards (Not the same one, this issue exists on two independent adafruit boards with a different ESP32-S3-DevKitC-1 on each.
The weirdest part is it WAS WORKING on one of the setups without the delay a few days ago, and was working solidly for a few days so it wasn't a fluke. I'm guessing the PN532 is just on the hairy edge of responding fast enough.
Let me know if I should pull request this, I'd be happy to. I have tested it with the iso14443a_uid example with and without the library modifications several times. It reliably breaks/fixes things when I remove/add that delay(1);