Zum Inhalt springen

WSAL16958 – PN532 NFC HAT/en

Aus JW Tech Wiki

Documentation notice: This technical documentation was independently rewritten from an archived supplier source. Check technical details and commands against the product version and manufacturer documentation before use.

Summary

The PN532 NFC HAT adds NFC capability to the Raspberry Pi via I2C, SPI or UART. The module is based on the PN532 chip operating at 13.56 MHz and supports ISO/IEC 14443A/B and MIFARE cards.

Related products at JW Tech

Technical overview

  • Operating voltage: 3.3 V / 5 V; factory serial baud rate 115200 bps
  • Supported standards: ISO/IEC 14443A, MIFARE; ISO/IEC 14443B in reader mode
  • The PN532 chip contains a C51 microcontroller core with 40 KB ROM and 1 KB RAM
  • Three interfaces selectable via jumpers (I0/I1) and DIP switch: SPI, I2C or UART
  • SPI mode: I0=L, I1=H; NSS to D4 (BCM); RSTPDN to D20
  • UART mode: I0=L, I1=L; TX/RX to the Pi's serial pins
  • I2C mode: I0=H, I1=H; SCL/SDA to the Pi's I2C pins
  • Python and C demo code located under ~/raspberrypi/ after extracting the 7z archive
  • Module wake-up requires sending a fixed HEX frame over the serial interface
  • Expected result: UID of a nearby card is printed

Commands and examples – verify before use: 

sudo raspi-config
cd ~/raspberrypi/python/ && sudo python3 example_get_uid.py
cd ~/raspberrypi/c/example/ && sudo make && ./rpi_get_uid.exe
wget https://files.waveshare.com/upload/6/67/pn532-nfc-hat-code.7z && 7z x Pn532-nfc-hat-code.7z -r -o./Pn532-nfc-hat-code

Notes and version constraints

  • The module can only read/write unencrypted or known-password protected cards; encrypted cards cannot be cracked
  • Simulated cards have their first ID byte fixed to 0x08
  • I2C communication may fail when multiple I2C devices are connected because the PN532 may use Clock Stretching
  • If D4 is used by other programs, SPI should not be used
  • The demo expects specific pin assignments; deviations require manual adjustment
  • Testing without a Raspberry Pi requires a USB-to-serial adapter
  • Version-sensitive steps: demo files must be adapted per board type

Source and revision record

  • PN532 NFC HAT - Waveshare Wiki
  • Source revision: 107792
  • Captured: 2026-08-31T03:56:51+00:00
  • SHA-256: bd93d607202f676084e7aee7278fa4496113854c09216f111ca49874e8ffb1a4