apache / apache/nuttx

[BUG] drivers/contactless/PN532: Incorrect UID Readings, Timeouts, and Documentation issues

Open
#15,942 10 comments 0 reactions 0 assignees View on GitHub
Arch: all Area: Drivers OS: Linux Type: Bug
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

**Summary**
The PN532 driver for NFC/RFID tag reading appears incomplete, undocumented, and unreliable. It exhibits multiple issues, including incorrect UID readings, broken timeout handling, and limitations on UID length.

**Environment**
Hardware: PN532 NFC reader via SPI
MCUs tested: STM32F4, Raspberry Pi Pico (with added local driver support)
Test code: [Pastebin link](https://pastebin.com/kirXhWUL)

**--Issues Observed--**

**Incorrect UID Readings**
The first byte of the UID is unique, but the rest remain the same across all NFC tags.
This suggests a possible bug in the driver’s UID parsing or response handling.

**Polling for New Cards Fails**
When polling for new NFC cards, the driver frequently returns timeout errors.
Timeout settings appear to be non-functional.

**UID Length Restriction**
The driver only returns 4-byte UIDs, whereas the PN532 is capable of providing longer UIDs.

**Concerns and Next Steps**
The driver is very old and poorly documented, making it difficult to diagnose and fix issues.
I have previously written a PN532 driver with similar (or more) functionality. Given the state of this driver, would it make more sense to fix these issues or port my own driver instead?

### On which OS does this issue occur?

[OS: Linux]

### What is the version of your OS?

Arch Linux x86_64, Kernel: 6.13.4-arch1-1

### NuttX Version

Master

### Issue Architecture

[Arch: all]

### Issue Area

[Area: Drivers]

### Host information

_No response_

### Verification

- [x] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.