The PN532 is a highly integrated transmission module for contactless communication at
13.56 MHz including microcontroller functionality based on a 80C51 core with 40 Kbytes
of ROM and 1 Kbyte of RAM.
The PN532 combines a modulation and demodulation concept completely integrated for
different kinds of contactless communication methods and protocols at 13.56 MHz
(particularly Near Field Communication NFC), with an easy-to-use firmware for the
different supported modes and the required host interfaces.
The PN532 includes a switch to power an external SAM connected to S2C interface. It is
controlled by the embedded firmware.
AN10609_3
PN532 C106 application note
HOST
CONTROLLER
Interface with host controller : SPI or I2C or HSU.
Possibly one or two additional lines (H_REQ, IRQ).
This document intends to allow the customer getting quickly started with the PN532. It
summarizes commands needed to use the PN532 as a reader, as a card, or in a NFC
peer-to-peer communication. It gives an overview on possible interfaces with the host
controller.
Detailed description of the PN532 firmware can be found in the PN532 User manual (cf.
References table below).
Full description of the PN532 IC can be found in the PN532 Datasheet.
This document underlines differences between PN532C104 (p revious version not
produced anymore) and PN532C106.
The PN532C106 main differences compared with PN532C104:
“Low battery” mode is the start up mode of PN532C106. It is described page 21.
AN10609_3
PN532 C106 application note
- Possible host interface: HSU, I2C or SPI mode 0 (no more SPI mode 1, 2, 3)
- “Low battery” mode
References
Ref.number Document name
1 PN532 C106 user manual UM0701-02
2 PN532 Product Datasheet 115430.pdf
3 NFC Transmission Module Antenna and RF
7 NFCIP-1 specification ISO/IEC 18092 or ECMA340 specification
Glossary
NFC Near Field Communication
HSU High Speed UART
SMX Philips SmartMX (Memory Extension)
PCR Power, Clock and Reset controller
SAM Secure Access Module
MINT Multiple Interfaces
PMU Power Management Unit
DEP Data Exchange Protocol (see reference 7)
The PN532 is based on an 8051 core, with 40 Kbytes of ROM and 1Kbyte of RAM. The
chip contains a contactless UART, a contactless front end, a “PCR” block that controls
clocks and power.
It can be connected to the host controller in I2C, SPI or HSU (High Speed UART). One or
two more lines (IRQ and H_REQ) can be added. The interface is selectable using I0 and
I1 pins.
A SAM companion chip can be attached using S2C interface.
A part of the IC can be powered directly from a mobile battery (VBAT between 2.7V and
5.4V). The Pad power supply (PVDD) must be between 1.6V and 3.6V.
The SAM power supply SVDD is provided by the PN532.
At start up, the normal mode must be selected by connecting P35 and IRQ as defined
below. The two other modes (RF field on and Emu Joiner) are special modes useful only
for tests purposes.
No external resistors are required on P35 and IRQ pins.
Interface Selection Pin
P35 IRQ
Normal mode 1 1
Normal mode 1 0
EmuJoiner 0 1
RF field On 0 0
(pin #19) (pin #25)
DVDD/VBAT PVDD
DVDD/VBAT GND
GND PVDD
GND GND
AN10609_3
PN532 C106 application note
Three interfaces are available: I2C, SPI and HSU (high speed UART). The interface is
selectable by hardware (pin I0 and I1).
Interface Selection Pin
I0 I1
(pin #16) (pin #17)
HSU 0 0
GND GND
I2C 1 0
DVDD GND
SPI 0 1
GND DVDD
The embedded software manages the communication with the host controller (I2C, SPI,
or HSU interface, protocol on the host link) and the communication on the RF side.
P31 is not used to choose between handshake or standard mode: PN532C106
implements only handshake mode, whatever P31 configuration (It can be let not
connected).
2.2.1.2 SPI
Only SPI mode 0 is implemented in PN532C106. Consequently, P30 (pin 24) and P33
(pin 33) states don’t configure anymore the SPI mode. They can be let not connected
To stay in LowVbat mode, NSS must be kept in high state even when PVDD is not
present (NSS low is a wake up condition).
2.3 Host link protocol
No changes compared to PN532C104. Refer to [1] and [8]
The protocol used on host link is fully described in the PN532 User manual (cf.
References table on page 4)
AN10609_3
PN532 C106 application note
2.3.1 Standard frame
A basic exchange consists in a command frame sent by the host controller to the PN532,
an ACK frame sent by the PN532 as soon as the command is correctly received, and a
response frame, read by the host controller (polling mechanism or use of IRQ).
Fig 3. Normal exchange between host controller and the PN532
The information frame has an extended definition allowing exchanging more data
between the host controller and the the PN532 (theoretically up to 64kB).
In the firmware implementation of the the PN532, the maximum length of the packet data
is limited to 264 bytes (265 bytes with TFI included).
The structure of this frame is the following:
AN10609_3
PN532 C106 application note
0000FFTFILCSPD0 PD1……...DCSPDn00
FFLEN
FFLEN
M
L
Normal Packet Length Checksum : Fixed to FF value
Normal Packet Length: Fixed to FF value
Postamble
Packet Data Checksum
Packet Data
Specific TFI
Packet Length Checksum
Packet Length
Start of Packet Code
Preamble
Fig 6. Extended Information frame
The normal LEN and LCS fields are fixed to the 0xFF value, which is normally
considered as an erroneous frame, due to the fact that the checksum does not fit.
The real length is then coded in the two following bytes LEN
(MSByte) and LEN
ML
(LSByte) with:
LENGTH = LEN
x 256 + LEN
ML
coding the number of bytes in the data field (TFI and
PD0 to PDn)
¾LCS1 Packet Length Checksum LCS byte that satisfies the relation:
Lower byte of [LEN
+ LEN + LCS] = 0x00,
ML
¾DATALENGTH-1 bytes of Packet Data Information
The first byte PD0 is the Command Code.
The host controller, for sending frame whose length is less than 255 bytes, can also use
this type of frame.
But, the the PN532 always uses the suitable type of frame, depending on the length
(Normal Information Frame for frame <= 255 bytes and Extended Information Frame for
frame > 255 bytes).
Using Low Vbat functionality and SPI interface requires the following work around.
1. In case LowVbat functionality is not required
Always keep PVDD (and Vbat) present. Proceed as described in paragraph 2.5.2
2. In case LowVbat functionality is required
The interface pins will be used to achieve LowVbat mode. Therefore they must be connected to the host
controller.
Before switching off the host controller, change I0 to 1 and I1 to 0 (this put the PN532 in I2C
configuration)
Host sends a reset pulse (minimum 20ns, see datasheet p209) to PN532 via RSTPD_N
Wait a time off (2ms, see datasheet p209)
The PN532 will go in LowVbat mode and stays in this mode (25µA)
AN10609_3
PN532 C106 application note
Î An external reader can communicate with the SMX as a card
To wake up the PN532 (to exit LowVbat mode) and recover SPI communication
Host controller change I0 to 0 and I1 to 1 (restore SPI configuration)
Host controller sends a reset pulse (minimum 20ns) to PN532 via RSTPD_N
Wait a time off (2 ms)
Host controller sets NSS wake-up (high to low, CSN)
Î SPI communication can be performed (e.g. send command SAMConfiguration ’14 01’ to
switch to standard mode).
When changing I0 and I1, the internal configuration of pins 27, 28, 29, 30 (interface lines) is changed. See
table in paragraph 2.4.4 Default pin configuration.
Warning: It is also possible to switch to I0 and I1 to 0 (HSU). The advantage is that only I1 need to be
toggle. But in this mode, pin 28 MOSI/TX is strongly push pulled to high by PN532, which can prevent the
communication between the host controller and other chips on the SPI bus.
The PN532 is slave. A Status byte (Bit 0 of Status byte) indicates if the PN532 is ready to give a response
or not. First byte sent on MOSI by the host controller indicates which operation will be performed:
xxxx xx10 : Read (by the host) Status byte
xxxx xx01 : Write data (transmission from the host to the PN532)
xxxx xx11 : Read data (transmission from the PN532 to the host)
After having sent a command, the host controller must wait for bit 0 of Status byte equals 1 before reading
the data from the PN532.
Bytes are transmitted LSB first.
NSS must be toggle as shown in the user manual (reference 1) or in the next figures.
2.4.2.4 SPI waveforms
SPI waveforms for GetFirmware version command (example with SPI freq. 500 kHz).
Consequently, the default pin configuration is as described in the PN532 datasheet. (The
default pin configuration is not changed by the PN532C106 firmware).
Pin Configuration Additional information
I0 Input Connect directly to DVDD or to GND (no need of
I1
PVDD Power pin Externally supplied regulated voltage, 1.6V to 3.6V
RSTPD_N Input NFC reset signal. (Low state = reset)
P30 / UART_RX Quasi bi directional No need of external resistor.
P31 / UART_TX
P32_INT0
P33_INT1
P34 / SIC_CLK
P35
external resistor)
RSTPD_N must never exceed min(3.6 V, VBAT)
When connected to the P5CN072, to be used in Virtual
Card mode, P34 / SIC_CLK shall be connected to
P5CN072 I02
P70_IRQ Quasi bi directional No need of external resistor.
In the Application Note P70_IRQ will be written as IRQ
when used as interrupt line.
In I2C mode: Quasi bi directional No need of external resistor. MISO / P71
MOSI / SDA /
HSU_TX
NSS / P50_SCL /
HSU_RX
In SPI: Push pull No need of external resistor
In HSU: Quasi bi directional No need of external resistor
In I2C mode: Quasi bi directional No need of external resistor. SCK / P72
In SPI: Input No need of external resistor.
In HSU: Quasi bi directional No need of external resistor
In I2C mode: Open drain Use pull up, 1k/V. E.g. for PVDD = 3.3V, 3.3 k pull-up.
In SPI: Input No need of external resistor
In HSU: Push pull No need of external resistor
In I2C mode: Open drain Use pull up, 1k/V. E.g. for PVDD = 3.3V, 3.3 k pull-up.
In SPI: Input
Use resistor bridge or LDO and pull up to be able
•to keep NSS high even when PVDD =
0 (to stay in LowV
2.5.1 LowVbat mode (PN532C106 start up default mode)
PN532C106 starts in “Low Vbat” mode.
In this mode, the PN532C106 is in virtual card mode when an external field is
present, and in power down mode otherwise. In this mode, an external reader can
communicate with the SMX (connected to PN532C106 via its S2C interface).
¾ No interrupt (IRQ) will be returned by PN532C106 to its host controller.
¾ The host controller cannot wake up PN532 using HREQ/P32 line (pin 32).
2.5.2 To go out Low Vbat mode (i.e. to wake up PN532C106 after start up)
To go out “Low Vbat” mode, there are three conditions
• PVDD must be present.
• More over, to wake up the PN532C106, the host controller must
• In I2C
Send PN532 I2C address (48h). The PN532 will stretch low the SCL line during
1 ms (can be less depending on the quartz). The host controller shall wait for the
end of the stretching.
• In SPI
Set NSS low during 1 ms (can be less depending on the quartz)
• In HSU
Send a preamble 55 55 00 00 00 00 00 FF then Len LCS ….
• The ho st controller must send one of the following commands (using the wake up
conditions described just above)
− Either it wants to stay in virtual card mode. Then it shall send a command to
enable the interrupt generation (IRQ) by PN532C106. (The IRQ warns the host
controller that a transaction occurred between an external reader and the SMX).
The command to send is “SAM Configuration” with parameter Mode = virtual (02h)
and parameter IRQ use = yes (either put value 01h or omit the parameter).
So the command is ‘14 02 00’ (or ‘14 02 00 01’)
− Or it wants to go to normal mode. Then it shall send “SAM Configuration” with
parameter Mode = normal (01h). So the command is ‘14 01’
Once woken up, any command can be send like in PN532C104 (with handshake
mode)
NB: As soon as PVDD is present, the host controller must send a command to
enable the interrupt generation (IRQ) by PN532C106. (The IRQ warns the host
controller that a transaction occurred between an external reader and the
SMX). The command to send is “SAM Configuration” with parameter Mode = virtual
(02h) and parameter IRQ use = yes (either put value 01h or omit the parameter)
14 02 00 (or 14 02 00 01)