Skip to content

Receiving Response instead of ACK #85

Closed
@joshwapohlmann

Description

@joshwapohlmann

Using ESP32 dev kit, Platformio, library version 1.2.2

During initialization I receive the following sequence instead of an ACK

0x0 0x3F 0xDF 0xFF 0xE9 0xAF

The code executed so far is

Adafruit_PN532 nfc(PN532_SS);
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();

With build_flags = -DPN532DEBUG the serial monitor shows

Sending : 0x0, 0x0, 0xFF, 0x2, 0xFE, 0xD4, 0x2, 0x2A, 0x0, 
Sending : 0x0, 0x0, 0xFF, 0x2, 0xFE, 0xD4, 0x2, 0x2A, 0x0, 
No ACK:  0x0 0x3F 0xDF 0xFF 0xE9 0xAF
No ACK frame received!

I checked the PN532 user manual.
Normally, whatever state it is in, it should abort ANY prior command when receiving a new command (page 38).
This is clearly the case (i also checked with a logic analyzer) when retrieving the firmware version.

After this, the code correctly waits for the IC to be ready

// Wait for chip to say its ready!
  if (!waitready(timeout)) {
    return false;
  }

where it reads the status register until it is RDY.

After this, bool Adafruit_PN532::readack() is called.
In the manual on page 45 the procedure is explained.

The code follow this exactly

if (spi_dev) {
    uint8_t cmd = PN532_SPI_DATAREAD;
    spi_dev->write_then_read(&cmd, 1, ackbuff, 6);
  }

According to the manual, even in case of a syntax error, it will respond with an ACK.
This means, the received data is the response to a prior command. Therefore an ACK was missed.
It is unclear how and where it happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions