Hi All,
I implemented an iso15693 inventory16 command based on a SPI interface with a
PN5180 reader.
The command works well. Every tag in scope is found, although collisions happen.
The problem Is the command take almost a second long for few tags, too long for my application.
This Is because of 1ms delay after assert NSS pin before transfer or wait for busy pin high. I tried microsecondsDelay with values under 1000us, but it didn't found any tag.
The spi protocol described in pn5180 datasheet says nothing about delay, just wait for busy pin.
Any help?
Post your code and a wiring diagram!
Without the code I don't understand why a delay of 1ms should result in a one second read out.
Thanks pylon for your attention,
Here some details
Esp32 DevKitC
VSPI bus, Mosi 23, Miso 19, CLK 28, CS 5, busy 21 AND Rst 22.
Pn5180 SPI protocol:
- Assert NSS to low
- Perform data exchange
- Wait until BUSY Is high
- Deassert NSS
- Wait until BUSY Is low
Send AND Receive (base of any pn5180 CMD)
// Sending
- waitForPinValue(busyPin, LOW, timeout)
// pn5180 Is not busy, wait for low, pin check interval 10us, timeout 10ms. - digitalWrite(nssPin, LOW); // Assert NSS
- delayMicrosends(1000); // delay(1)
- Spi->transfer // sending data
- waitForPinValue(busyPin, HIGH, timeout);
- digitalWrite(nssPin, HIGH); // Deassert NSS
- waitForPinValue(busyPin, LOW, timeout);
- if (receive) // CMD has response
// Receiving (half duplex protocol)
8.1. waitForPinValue(busyPin, LOW, timeout);
8.2. digitalWrite(nssPin, LOW); // Assert NSS
8.3. delayMicrosends(1000); // delay(1)
8.4. Spi->transfer // receiving data
8.5. waitForPinValue(busyPin, HIGH, timeout);
8.6. digitalWrite(nssPin, HIGH); // Deassert NSS
8.7. waitForPinValue(busyPin, LOW, timeout);
Every PN5180 command calls Send AND Receive above at least once. But INVENTORY16 Is a complex command which calls Send AND Receive hundreds of times, depending on tags number, slot collisions, etc. One millisecond (lines 3 AND 8.3) delay matters.
I tried delayMicroseconds(value) with values under 1000us AND inventory16 fails, some tags are not found.
I also tried just waitForPinValue(busyPin, low, 10) after transfering to deassert NSS, but that never happens, the protocol has to be followed.
I moved líne 3 to before líne 5, AND the inventory16 still works perfectly. That blew my mind.
Thanks for any help.
According to the datasheet the time from NSS low to start clocking out the first bit must be at least 72ns, way less than the 1ms you propose.
That doesn't make sense. You wait 1ms before waiting that BUSY gets high?
Maybe you should post actual code instead of pseudo code.
Dear Pylon, i found where the problem was.
Testing wiring i realized the busy wire was faulty connected, so the behaviour was erratic. I got the wire fixed, removed the delayMicroseconds lines, AND Inventory16 goes much faster now.
Thanks for your time.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.