MuPiBox Documentation MuPiBox NG

Connecting a PN532 directly to Raspberry Pi – SPI and UART

Wire a PN532 NFC reader to MuPiBox NG using the Raspberry Pi GPIO header, enable SPI or UART and assign tags.

The PN532 reads 13.56 MHz NFC tags such as MIFARE Classic and NTAG. MuPiBox NG can use PN532 over USB serial, SPI0 GPIO or GPIO UART. The direct GPIO drivers are implemented; a user successfully tested FTDI USB-UART and GPIO UART with a physical PN532 and tag on 14 November 2026. Physical SPI testing is still pending. PN532 over I²C is not available as a selectable reader.

SPI0 (hardware test pending)

UART has now been verified with real hardware. SPI works the same way on Raspberry Pi 4 and Pi 5 without involving Bluetooth or the serial login console, but is not yet hardware-verified. On the red PN532 module pictured in the discussion, switch to SPI (DIP switch 1 OFF, switch 2 ON). Confirm that this matches your board's revision.

PN532 pinPhysical Pi pinBCM function
VCC13.3 V
GND6GND
SCK23GPIO11 / SCLK
MOSI19GPIO10 / MOSI
MISO21GPIO9 / MISO
SS24GPIO8 / CE0

For CE1, wire SS to physical pin 26 / GPIO7 and select /dev/spidev0.1 instead. No separate IRQ or reset wire is required by the NG SPI driver.

In the existing boot config.txt (/boot/firmware/config.txt or /boot/config.txt) add once under [all]:

dtparam=spi=on

Reboot, then check ls -l /dev/spidev0.0. Seeing the device only confirms that the SPI interface is enabled; it does not prove the PN532 is connected. The installer configures the spi group and device access but does not switch on SPI without consent.

Alternative: UART (GPIO14/15)

Use the HSU/UART mode (on the pictured DIP board, both switches OFF). Cross TX/RX:

PN532 pinPhysical Pi pinBCM function
VCC13.3 V
GND6GND
TXD10GPIO15, Pi RXD
RXD8GPIO14, Pi TXD

UART runs at 115200 baud, 8N1, no flow control. Set enable_uart=1 in the existing boot config, disable any serial login/kernel console using that port, and reboot. Before editing boot arguments, make a backup; check cat /proc/cmdline and any enabled serial-getty@ service.

  • Pi 3/4: GPIO14/15 typically use /dev/serial0 (often /dev/ttyS0). Bluetooth can remain enabled, but the mini-UART needs a stable clock.
  • Pi 5: /dev/serial0 may point to ttyAMA10 on the separate debug header, not GPIO14/15. After enable_uart=1 use /dev/ttyAMA0 for the 40-pin GPIO header and verify the pin mapping.

Check ls -l /dev/serial0 /dev/ttyAMA0 /dev/ttyS0; pinctrl get 14 15 can help. The mupibox service user must be in dialout, configured by the installer.

Activate the reader in MuPiBox NG

  1. Open Hardware → RFID, enable RFID and select PN532 GPIO SPI or PN532 GPIO UART.
  2. Click Scan for readers. The list contains available Linux interfaces, not positively detected PN532 chips.
  3. Select /dev/spidev0.0 for SPI CE0 (or /dev/spidev0.1 for CE1), /dev/serial0 for a typical Pi 4 UART, or /dev/ttyAMA0 for the Pi 5 header UART.
  4. Click Connect. The driver queries the PN532 firmware and configures the reader. A successful connection verifies communication.
  5. Hold a compatible 13.56 MHz tag to the antenna. The Last card field should show its UID; then assign it to media or actions as described in RFID setup.

Only one reader can be active at a time. The selected transport and device path are saved and restored after a reboot.

Troubleshooting

SymptomCheck
No spidev0.0SPI boot setting and reboot
SPI initialization failsDIP setting, 3.3 V, CE pin, SCK/MOSI/MISO, ground, other SPI devices
UART initialization failsCrossed TX/RX, UART DIP setting, 115200 baud, disabled serial console; Pi 5 must not use ttyAMA10
Permission deniedService user's spi or dialout group and udev rules
No UIDUse a 13.56 MHz card: PN532 cannot read 125-kHz tags
Pin conflictReview GPIO inventory for SPI GPIO7–11 or UART GPIO14/15

I²C: MuPiHAT already uses GPIO2/3. I²C permits multiple addresses, but PN532 I²C timing/clock-stretching needs specific support; MuPiBox NG does not implement this transport yet. Use SPI or UART.

See also GPIO reference, RC522 SPI and RFID setup.

© 2026 MuPiBox