Labs / Electronic modules

GraftSense - PN532-Based NFC Communication Module (Open Version)

Author: Li Zisheng · Source: FreakStudio open documentation, v1.3 · License: CC BY 4.0 · Driver code (communication/pn532_driver): MIT License

Contents
PN532
PN532 I2C

I. Module Introduction

The PN532-based NFC communication module uses the PN5321A3HN/C106,55 as its main control chip, supports multiple communication modes including I2C, HUS, and SPI (switchable via pin configuration of SEL0 and SEL1), and is equipped with expansion interfaces, I2C interface, SPI interface, UART wiring terminals, etc. It also integrates a filter circuit, a crystal oscillator circuit, an antenna circuit, and a 5V-to-3.3V level conversion circuit.This module is an RFID reader that supports reading and writing Mi, UID, CUID, FUID, as well as bracelets and mobile phones with NFC function. It is compatible with 3.3V communication level, with the main communication mode being HSU (UART) at a baud rate of 115200. It is suitable for scenarios such as NFC tag reading and writing, access control identification, and mobile payment, providing a flexible and reliable hardware solution for near-field wireless communication applications.

II. Introduction to Major Chips

PN5321A3HN/C106,55 is a high-performance NFC controller chip from NXP, which supports the 13.56MHz frequency band, is compatible with multiple contactless protocols, and can implement modes such as card reader and card emulation. It is equipped with SPI, I2C, and UART interfaces, featuring high integration and low power consumption, and is suitable for near-field communication scenarios such as payment terminals and access control systems.

2.1 Chip Overview

PN532 80C51 13.56MHz 6
PN532
PN532 80C51 40 1 2.7 5.5V
PN532
PN532 2.1

PN532 is a 13.56MHz contactless communication transceiver module based on the 80C51 microcontroller core. It supports 6 operating modes including card reader/writer, card emulation, and peer-to-peer communication, and is compatible with protocols such as ISO / IEC 14443A / MIFARE and Felica. It integrates functions such as demodulation/decoding and RF level detection, with a maximum communication rate of up to 424kbit/s;It supports SPI, I²C, and high-speed UART as three host interfaces, featuring a low-power mode, a wide 2.7-5.5V power supply range and other characteristics; it can also be externally connected to a security IC, making it suitable for scenarios such as mobile portable devices and consumer applications.

2.2 Pin Definition

PN532 1 TVSS1 TX1 TX2 TVSS2 SCK/P72 MISO/P71 NSS/P50_SCL/HSU_RX P70_IRQ
PN532 TX1 TX2 1
PN532 P30/UART_RX P70_IRO NSS/P50_SCL/HSU_RX MISO/P71 21 23 24
PN532 P72 30 P31 31

2.3 Functional Block Diagram

PN532 80C51 TX1 TX2

Typical Scenarios (Taking NFC Communication as an Example):

2.4 Performance Parameters

PN532 2.7 5.5V 3.4V 0V

The key points in the table are as follows:

GraftSense - PN532-Based NFC Communication Module (Open Version)
309 PN532

2.5 Reference Circuit

PN532 C1 C2

This is PN5321A3HN/C106,55 the application circuit of the chip, and the functions of each part are as follows:

2.6 Chip Configuration

PN532 1 0
PN532 I0_I1 1 0 I2C 72 00 27 28 01
I0_I1 6103h int1_pol pad_I1 pad_I0 1 0 P33_INT1 PN532

PN532 supports switching among three host interfaces: HSU, SPI, and I²C, which is implemented through the coordination of the pin levels of I0 / I1 and the Config I0_I1 register: first, the Config I0_I1 register reads the actual levels of the pad_I0 and pad_I1 bits corresponding to the I0 and I1 pins, then copies them to the selif[1:0] bits.Select the interface according to the combination of selif[1:0](00 corresponds to HSU, 01 corresponds to SPI, 10 corresponds to I2C). Meanwhile, set the enselif bit of the register to 1 to enable the MIF module to drive the corresponding pins; finally, the pins of different interfaces will automatically switch to the corresponding working modes (e. g. I²C is in open-drain mode, SPI is in input/push-pull mode), so as to complete the switching of the three Communication Protocols.

This paper mainly introduces the High-Speed Universal Asynchronous Receiver/Transmitter (HSU); as for IIC and SPI, only partial contents are presented herein. For relevant materials, please refer to the datasheet in the attachment.

2.7.1 High Speed Universal Asynchronous Receiver/Transmitter (HSU)

High-speed Universal Asynchronous Receiver/Transmitter (HSU) provides a high-speed link to the host (up to 1.288 Mbit/s).

HSU is a full-duplex serial port. Equipped with a receive buffer, this serial port, in combination with the FIFO manager, can receive multiple bytes without being restricted by the CPU real-time constraints. However, if the receive FIFO remains unread by the CPU and the number of received bytes exceeds the capacity of the receive FIFO, the newly incoming bytes will be lost.

Both the receive and transmit data registers of the HSU are accessed by firmware via the FDATA register of the FIFO manager. Writing data to FDATA loads the transmit register, while reading data from FDATA accesses the separate receive register.

This Universal Asynchronous Receiver/Transmitter (UART) features the following characteristics:

2.7.1.1 Operation Mode

HSU only supports one operating mode, which has the following characteristics:

2.7.1.2 HSU Baud Rate Generator

To achieve high-speed transmission rates, the HSU has its own baud rate generator, which consists of a prescaler and a counter. The prescaler is located before the counter, and its function is to frequency-divide the count signal to expand the range of the counter (at the cost of reducing resolution). The division coefficient of the prescaler is equal to 2 to the power of HSU_PRE [8:0](see Table 113 on page 77), so the division coefficient ranges from 1 (2^0) to 256 (2^8). The combination of these two modules defines the bit duration and bit sampling.

2.7.1.3 HSU Preamble Filter

After three consecutive characters (00,00, FF) are received, the received characters will be sent to the FIFO manager. When a frame ends and before a new frame arrives, the firmware shall write a logic 1 to the frame start bit of the HSU_CTR register to reactivate the preamble filter. If the firmware does not write a logic 1, all characters of the frame, including the preamble, will be sent to the FIFO manager.

2.7.1.4 HSU Wakeup Generator

The HSU wake-up generator is a 3-bit counter that increments on each rising edge of the HSU_RX pin. When the counter reaches 5, the hsu_on signal is set to logic 1 to wake up the PN532. This module is extremely useful in soft power-down mode. Firmware should reset this counter by writing a logic 1 to the res_wu bit of the HSU_CTR register before entering soft power-down mode.

2.7.1.5 HSU_STA Register

The special function register (SFR) HSU_STA is the status register of the HSU.

HSU_STA Register (SFR: Address ABh) Bit Allocation

Bit76543210
Symbolset_bit--disable_preambirq_rx_over_enirq_rx_fer_enirq_rx_overirq_rx_fer
Reset00000000
AccessRWRRRWRWRWRWRW

HSU_STA bit description

BitSymbolDescription
7set_bitDuring a write operation, if set to logic 0, bits set to logic 1 in the write command are written as logic 0 to the register; if set to logic 1, bits set to logic 1 in the write command are written as logic 1 to the register.
6 to 5-Reserved
4disable_preambPreamble filter disable. When set to logic 1, this bit disables preamble filtering, i.e. any byte received on the HSU_RX line is transferred to the FIFO manager.
3irq_rx_over_enFIFO overflow interrupt enable. When set to logic 1, this bit enables interrupt generation when irq_rx_over is set to logic 1. Bit IE1_5 of register IE1 must also be set to logic 1 to enable the corresponding CPU interrupt.
2irq_rx_fer_enFraming error interrupt enable. When set to logic 1, this bit enables interrupt generation when irq_rx_fer is set to logic 1. Bit IE1_5 of register IE1 must also be set to logic 1 to enable the corresponding CPU interrupt.
1irq_rx_overReceive FIFO overflow interrupt. Set to logic 1 when the FIFO manager is full (rcv_jack set to logic 0) and the HSU shift register is ready to send another byte to the FIFO manager.
0irq_rx_ferFraming error interrupt. Set to logic 1 when a framing error is detected. Framing error detection is based on stop bit sampling. This bit is set to logic 1 when the stop bit is expected to be logic 1 but is sampled as logic 0.
2.7.1.6 HSU_CTR Register

This register controls the configuration of the HSU.

Bit allocation of HSU_CTR register (SFR: address ACh)

Bit765:043210
Symbolhsu_wu_enstart_frametx_stopbit[1:0]rx_stopbittx_enrx_ensoft_reset_n
Reset0000001
AccessRWRWRWRWRWRWRW

HSU_CTR bit description

BitSymbolDescription
7hsu_wu_enHSU wake-up enable. When set to logic 1, this bit re-activates the NSS/SCL/HSU_RX rising edge counter. When the counter reaches 5, the hsu_on signal is activated. This signal is one of the possible wake-up event signals in the PCR module. Firmware should set this bit in the PCR register to logic 1 before requesting soft power-down mode. In soft power-down mode, bit HSU_on_en of the PCR wake-up register (see Table 144 on page 97) must also be set to logic 1 to enable the corresponding PN532 wake-up.
6start_frameEnable the preamble filter for the current frame. When set to logic 1, this bit indicates that a new frame is about to arrive. This re-activates the preamble filter (if enabled), meaning the first three "00 00 FF" characters are not sent to the FIFO manager.
5:04tx_stopbit[1:0]Defines the number of stop bits during transmission. These two bits define the number of stop bits inserted at the end of a transmitted frame. The number of stop bits transmitted equals tx_stopbit + 1.
3rx_stopbitDefines the number of stop bits during reception. This bit defines the number of stop bits expected at the end of a received frame. The number of stop bits expected during reception equals rx_stopbit + 1.
2tx_enEnable HSU transmission. When set to logic 1, this bit enables character transmission. When set to logic 0, transmission is disabled only after the current transfer completes.
1rx_enEnable HSU reception. When set to logic 1, this bit enables character reception. When set to logic 0, reception is disabled only after the current reception completes.
0soft_reset_nHSU reset. When set to logic 0, this bit disables the clocks of the HSU_RX control, HSU_TX control and baud rate generator modules.
2.7.1.7 HSU_PRE Register

This register is used to configure the prescaler of the baud rate generator. The prescaler can expand the range of the counter at the cost of reducing resolution. The division coefficient of the prescaler ranges from 1 (2^0) to 256 (2^8).

Table 115. Bit Allocation of HSU_PRE Register (SFR: Address A4h)

Bit76543210
Symbol000hsu_prescaler[7:0]0000
Reset00010000
AccessRWRWRWRWRWRWRWRW

HSU_PRE bit description

BitSymbolDescription
7 to 0hsu_prescaler[7:0]Combined with HSU_CNT, defines the HSU baud rate. Baud rate = fclk / ((hsu_prescaler + 1) * hsu_counter)
2.7.1.8 HSU_CNT Register

This register is used to configure the counter of the baud rate generator.

Bit allocation of HSU_CNT register (SFR: address A5h)

Bit76543210
Symbol000hsu_counter[7:0]000
Reset00010000
AccessRWRWRWRWRWRWRWRW

Table 118. Bit Description of HSU_CNT

BitSymbolDescription
7 to 0hsu_counter[7:0]Combined with HSU_PRE, defines the HSU baud rate. Baud rate = fclk / ((hsu_prescaler + 1) * hsu_counter)

The following is the recommended table for HSU data rates:

Table 119. Recommended HSU Data Rate Table

Target data rateHSU_CNT valueHSU_PRE valueActual HSU data rateMinimum recommended host HSU frequencyMaximum recommended host HSU frequency
96000x710x18951693269706
192000x9D0x0B191891859219726
384000x650x06383633761039126
576000x9D0x02575795642858730
1152000xEB0x00115404113096117712
2304000x760x00229831225234234427
4608000x3B0x00459661450467468854
9216000x1D0x00959172916468963875
12880000x150x00129142912656001317257

2.7.2 IIC Communication

PN532 I2C 100kHz 400kHz 5

This section describes the PN532 I2C interface: it is a master/slave mode I2C bus interface (with built-in shift register, timing generation, and slave address recognition functions), supporting the 100kHz I2C standard mode and 400kHz fast mode; it supports wake-up via the " General Call + W " command, but does not support the hardware version of General Call (GC+ R).

Its I2C interface has the following key features: it supports master/slave I2C bus, is compatible with standard/fast modes, can wake up the PN532 via its own address, and can wake up the device with the " General Call + W " command.

In addition, this I2C module is controlled by 5 readable and writable registers, including the control register (I2CCON), the status register (I2CSTA), the data register (I2CDAT), the slave address register (I2CADR), and the I2C wake-up condition control register (I2C_wu_control).

I2C PN532
PN532 I2C
PN532 I2C 5
I2C 7 8 1 I2CSTA 81
PN532 I2C P50_SCL
I2C P50_SCL I2CADR I2CCON 1

PN532 I2C supports four modes: master transmit, master receive, slave receive, and slave transmit, and features two transmission modes: "master sends data to slave (the master sends the slave address first, and the slave acknowledges byte by byte)" and "slave sends data to master (the master sends the slave address first, the slave sends data after acknowledging, and the master acknowledges byte by byte except for the last byte)"; in practical applications, the PN532 I2C is usually configured as a slave. In slave mode, it monitors its own address and the general call address to trigger an interrupt, and can also switch to master mode when the bus is idle; if arbitration is lost in master mode, it will switch back to slave mode.In the master transmission mode, PN532 generates clocks and start/stop signals. It is required to initialize the registers before entering this mode, first transmit the "slave address + write bit", and receive an acknowledgment after each byte transmitted; the entire process is handled via interrupts and status codes.

PN532 I2C

PN532 's I2C wake-up mode is only available when its I2C is configured as a slave, and it is a dedicated circuit designed to wake the device from soft power-down mode; before entering soft power-down, this wake-up module must be enabled, the wake-up condition selected, and the PCR has the I2C wake-up event enabled; during soft power-down, this module monitors the I2C bus, and after recognizing its own address and a valid command, it generates an acknowledge, pulls low SCL, configures I2C as slave transmit/slave receive mode and triggers wake-up; after wake-up, the firmware must identify the wake-up source and disable this module before the normal I2C can be used;To enable GC+ W wake-up, you need to set the I2CADR LSB to 1, and enable the write command wake-up function before entering soft power-down mode.

PN532 I2C I2CCON D8h 2 EN1
77 I2CCON 1 I2C P50_SCL
I2C PN532
77 I2CCON 1 0 I2C CR2 CR1 CR0 10 CPU_CLK/20

I2CCON is an PN532 8-bit read-write register used to control the core logic of the I2C interface: among them, CR[2] and CR1[1:0] jointly determine the clock frequency in master mode;ENS1 controls the enable of the I2C interface (set to 0 to disable the interface and put it in high-impedance state, set to 1 to enable it);STA controls the start condition (setting it to 1 in master mode will detect bus idle and generate a start signal);STO controls the stop condition (setting it to 1 in master mode sends a stop signal, which can be used for error recovery in slave mode);SI is the serial interrupt flag (hardware sets it to 1 to trigger an interrupt, which requires firmware to set it back to 0);AA is the acknowledge flag (when set to 1, it will return an acknowledge in scenarios such as receiving its own address and general call address), and these bits collectively implement the enable, clock, start/stop control, interrupt and acknowledge management of I2C.

PN532 I2CSTA 8 3 0 5 26 F8h I2C 1
PN532 I2C 0 7 F8 1 I2CSTA

I2CSTA is an PN532 8-bit read-only register: its lower 3 bits are fixed to 0, and the upper 5 bits store the status codes of the I2C interface (there are 26 types in total, and the value after reset is F8h, indicating no valid status); when I2C enters the corresponding status, hardware will set the SI interrupt flag to 1. At this point, I2CSTA presents a valid status code and triggers an interrupt, and this status code will remain until the firmware clears SI to 0. Its status change lags behind that of SI by one CPU cycle.

The corresponding finite-state machine logic is: in idle state, SI = 0, and I2CSTA is F8h; when SI = 1, it enters the "interrupt / status available" state, and I2CSTA loads the corresponding status code; after firmware processing, SI is set to 0, and the system returns to the idle state.

2.7.3 SPI Communication

PN532 8 5MHz 1 0
14 PN532
PN532 1
PN532
PN532 0
PN532 122 123
0 1 PN532
PN532 1

PN532 SPI Communication: It operates in slave mode, complies with Motorola SPI standard, and supports synchronous half-duplex 8-bit bus communication (max. 5MHz), which is managed by two registers: SPIControl (for control enable, clock phase/polarity, and interrupt) and SPIstatus (for monitoring the FIFO empty, overflow, and ready status).

Communication selects operations (write FIFO, read status, read FIFO, etc.) via the lower 2 bits of the first byte, and is initiated by the falling edge of NSS; when reading the status, the status is loaded into the shift register and returned, reading FIFO means fetching data from the FIFO and sending it to the host, writing FIFO means the host sends data to be stored in the receive FIFO (with MISO held at 0);SPIstatus the "ready" flag is set to 1 by the firmware to prompt the host that data transmission is available.

2.8 PCB Routing Precautions

None.

III. Circuit Engineering

3.1 Circuit Source Engineering

To obtain the source project of the circuit, please follow the official account [Freak Embedded]

3.2 Module Usage Instructions

SCH_Schematic1_BeiDou Navigation Module Based on Air530Z-V1.0.0_2025-11-10.pdf 2.2 MB

PN532 PN523-based V1.0

In this module, MRX (corresponding to the UART RXD pin of the MCU) is physically connected to the PN5321A3HN/C106,55 TXD pin, and MTX (corresponding to the UART TXD pin of the MCU) is physically connected to the PN5321A3HN/C106,55 RXD pin;This is because UART serial communication follows the "cross-transmit-receive" rule — the transmit end (TX) of both communication parties needs to be connected to the receive end (RX) of the other party; this design ensures correct bidirectional transmission of UART serial data between the MCU and PN5321A3HN/C106,55.

It is particularly important to note that when using this module, MRX is directly connected to the UART RXD of the MCU, and MTX is directly connected to the UART TXD of the MCU. Do not cross-connect them under any circumstances.

NFC (Near Field Communication) is a short-range wireless technology operating at 13.56 MHz with a communication distance of no more than 4 centimeters, jointly developed by Philips (now NXP), Nokia and Sony. It is essentially an upgraded version of RFID (Radio Frequency Identification) technology, but integrates the three functions of reader, card and peer-to-peer communication onto a single chip.

PN532

NFC has three operating modes:

13.56MHz

The main categories of NFC cards are as follows:

Protocol typeCommon nameCommon card examplesTypical use
ISO/IEC 14443 Type AType A cardMifare Classic (S50/S70), Mifare UltralightAccess cards, campus cards, NFC stickers
ISO/IEC 14443 Type BType B cardID cards, some bank IC cardsGovernment, finance
ISO/IEC 15693Long-range cardI-Code seriesProduct traceability, warehouse management
FelicaSony cardSuica (Japanese transit card), Felica LiteJapanese payment, transit

To ensure compatibility across devices such as mobile phones, NFC Forum has defined Tag 1 to Tag 5 five types of tags, which are essentially "wrappers" for the aforementioned protocols:

Tag typeUnderlying protocolFeaturesCommon uses
Tag1Type ALow cost, small capacityDisposable tags
Tag2Type ARewritable, small capacityNFC stickers (most common)
Tag3FelicaHigh securityJapanese devices
Tag4Type A/BLarge capacity, strong encryptionFinancial IC cards, high-end access control
Tag5ISO15693Long-range identificationProduct tags

Classified by encryption capability (which determines whether read/write operations are supported), NFC cards can be categorized into the following types:

PN532 is a multifunctional NFC chip from NXP, built on the 8051 microcontroller, supporting 6 operation modes and 3 host interfaces (SPI / I2C / USART), making it the top choice for DIY enthusiasts. PN532 supports almost all mainstream NFC cards, as it can emulate a wide range of card readers:

However, there are also some NFC cards that PN532 does not support:

Simply put, PN532 only supports IC cards rather than ID cards:

ComparisonIC cardID card
Operating frequencyMostly 13.56MHz (high frequency)Mostly 125kHz (low frequency)
Read/write characteristicsReadable and writable, with built-in memory chip and encryption logicRead-only, stores only a fixed unique card number, no storage / write capability
Security attributesSupports encryption algorithms (e.g. MIFARE encryption logic), enables data exchangeNo encryption, card number easily copied, identification only
Core functionIdentification + data storage / transactions (e.g. access control + payment)Basic identification only (e.g. plain access control, attendance)

We can make a distinction through the following methods:

Also, when using PN532, the following points should be noted:

3.3 Application Experiment

Here, we use the GraftPort-RP2040 development board for testing, and the PN532-based NFC communication module uses the UART interface to communicate with the main controller.

Here, we first use the HY2.0-4P cable to connect the module to the GraftPort-RP2040 development board's UART0 interface:

GraftPort-RP2040 v1.0 HY2.0-4P

The module connections are shown in the following table:

Development Board Pins

Module Pins

Description

Pin 8

MTX

UART0 data transmission line, corresponding to the transmit pin of the development board

Pin 9

MRX

UART0 data transmission line, corresponding to the receiving pin of the development board

At the same time, we also need to purchase one in advance IC card for read-write verification test:

PN532

Here, we need to search for the relevant driver packages on uPyPI: https://upypi.net/zh/

106

Enter pn532_driver to search, and the following will be displayed:

pn532_driver 1.0.0 PN532 2026-02-13

Click to copy the local installation command:

pn532_driver PN532 1.0.0 2024 02 13

Import the module driver library code via the mip tool. Below are the usage commands for the mpremote tool:

mpremote mip install https://upypi.net/pkgs/pn532_driver/1.0.0

Import the PN532 NFC module driver - MicroPython test code, then copy the following main.py code into our project:

# MicroPython v1.23.0
# -*- coding: utf-8 -*-   
# @Time    : 2025/9/4 3:50 PM
# @Author  : 缪贵成
# @File    : main.py
# @Description : Driver test file for the PN532-based NFC module. Tests Mifare Classic cards (e.g., transit cards): ID reading, Block4 authentication, read/write

# ======================================== Import Modules =========================================

import time
from machine import UART, Pin
from uart import PN532_UART
from pn532 import MIFARE_CMD_AUTH_A

# ======================================== Global Variables ============================================

# ======================================== Functions ============================================

# ======================================== Custom Classes ============================================

# ======================================== Initialization configuration ===========================================

time.sleep(3)
print("FreakStudio: Test NFC module functionality")

# UART initialization (adjust to the actual hardware pins)
uart = UART(1, baudrate=115200, tx=Pin(8), rx=Pin(9))
# Optional: Reset pin
# reset_pin = Pin(15, Pin.OUT)

# Create a PN532 instance
nfc = PN532_UART(uart, reset=None, debug=True)

# Initialize the PN532
print("Initializing PN532...")
# nfc.reset()

# Get the firmware version
try:
    version = nfc.firmware_version
    print("PN532 firmware version:", version)
except RuntimeError as e:
    print("Failed to read firmware version:", e)
    time.sleep(3)

# Configure SAM (for card reading)
nfc.SAM_configuration()
print("PN532 SAM configured")
time.sleep(3)

# ======================================== Main Program =============================================

while True:
    try:
        print("---- Waiting for card (Mifare Classic) ----")
        uid = nfc.read_passive_target(timeout=1000)

        if uid is None:
            print("No card detected")
            time.sleep(2)
            continue

        print("Card detected UID:", [hex(i) for i in uid])
        time.sleep(2)

        # ==================== Mifare Classic Test ====================
        key_default = b"\xFF\xFF\xFF\xFF\xFF\xFF"
        block_num = 4

        if nfc.mifare_classic_authenticate_block(uid, block_num, MIFARE_CMD_AUTH_A, key_default):
            print(f"Block {block_num} authentication successful")
            time.sleep(1)

            data = nfc.mifare_classic_read_block(block_num)
            if data:
                print(f"Read block {block_num} data:", [hex(i) for i in data])
            time.sleep(1)

            test_data = bytes([0x01] * 16)
            if nfc.mifare_classic_write_block(block_num, test_data):
                print(f"Successfully wrote block {block_num}: {[hex(i) for i in test_data]}")
            time.sleep(1)
        else:
            print(f"Block {block_num} authentication failed")
            time.sleep(1)

        # ==================== Low Power Test ====================
        print("Entering low power mode...")
        if nfc.power_down():
            print("PN532 entered low power mode")
        time.sleep(2)

        print("Waking up...")
        nfc.reset()
        print("Wake up complete")
        time.sleep(2)

    except Exception as e:
        print("Error:", e)
        time.sleep(2)

In the code above, it is mainly used to verify the interaction capability of Mifare Classic type IC cards: the program first initializes the PN532 module, obtains its firmware version and configures the card reading mode, then waits for a card in a loop. After detecting a card, it reads the card's unique identifier UID, then authenticates the 4th Block Storage area of the card with the default key. After the authentication is completed, it reads the data of this area, writes test data, and finally tests the low-power mode switching of the module (waking it up after entering low-power mode).

To flash the code, open a terminal and use the mpremote tool to connect to the main controller; the output is as follows:

PN532 Block4

It can be seen that when our IC card is placed on top of the module, the Raspberry Pi Pico successfully reads the NFC and prints the result to the terminal:

As can be seen from the terminal output, the program repeatedly executes the "wait for card - detect card" loop, and no card is detected in some rounds (displayed as No card detected);When a Mifare Classic card is detected, the card's UID is successfully read, authentication of Block4 is completed using the default key, after reading the original data of this block, test data consisting entirely of 0x01 is written, then the PN532 is successfully made to enter low-power mode and wake up, which practically verifies the functional validity of the PN532 in terms of target IC card identification, storage area authentication, data read/write, and power consumption control.

IV. Drivers

pn532_driver.zip 19 KB

None.

VI. Revision History

Document Version

Date of Modification

Modifier

Modified Content

v1.0

2025-11-11

Ling Gaoxing

Initialize the document

v1.1

2025-12-29

Li Zisheng

Added application experiments and production files

v1.2

2025-12-31

Xin Ruili

Create an open version of the document based on the internal document version v1.1.

v1.3

2026-03-29

Xin Ruili

An application experiment section has been added

VII. Relevant Materials

7.1 Chip Datasheet

PN532_C1.pdf 1.7 MB

7.2 Unique Icons for PCB Silkscreen

PN532