PN5180 to Raspberry Pi
| PN5180 | Pi |
|---|---|
| 5V | 5V |
| 3.3V | 3.3V |
| RST | GPIO 7 (SPI Chip Select 1) (26) |
| NSS | GPIO 8 (SPI Chip Select 0) (24) |
| MOSI | GPIO 10 (SPI0 MOSI) (19) |
| MISO | GPIO 9 (SPI0 MISO) (21) |
| SCK | GPIO 11 (SPI0 SCLK) (23) |
| BUSY | GPIO 25 (22) |
| GND | GND |
| GPIO | Not Connected |
| IRQ | GPIO 23 (16) |
| AUX | Not Connected |
| REQ | Not Connected |
For reference:
The number at the end of each RPi connection is the physical pin location (the small darker number beside each pin in the diagram below)

(courtesy of pinout.xyz)
As of now, the only complete software implementation of the PN5180's feature-set is NXP's in-house library. It supports all cards (with the exception of iClass cards, which do work on the Arduino library, see PN5180 to Arduino and ESP32) and, more importantly, supports card emulation.
⚠️ That said, their latest implementation uses the deprecated sysfs gpio interface, which is slated for removal some time in the near future.
Make sure that SPI is enabled. If it's not, enable it in the raspi-config utility under Interface Options.
NxpNfcRdLib_PN5180_v07.10.00_Pub.zipls /sys/class/gpio, one of the files/directories should be named gpiochipNUMBER. Said number if your offset value.Platform/DAL/boards/Board_PiPn5180.h. This file requires 2 patches.
#define PHDRIVER_PIN_RESET 16 becomes #define PHDRIVER_PIN_RESET 512+16, and so on for the rest of the pins in that definition block. (the code in red is what should be there.)
#define PHDRIVER_LINUX_USER_SPI and comment out #define PHDRIVER_LINUX_KERNEL_SPI.
Board_PiPn5180.h, we can finally compile the demos. Make sure that gcc and cmake are installed (sudo apt install them if they aren't). Then in the root folder of the project (the ComplianceApp, Examples, NxpNfcRdLib and etc folders should be visible), run the following commands:
mkdir _buildcd _buildcmake ..make all_build/Examples/. A description of each example can be found in AN11802.pdf.Our own fork of the pyPN5180 library. Current aim is to re-implement features that are missing from ATrappMann's library.
Differences between SPI handling between Arduino's SPI library and Linux's spidev (and by extension the python wrapper). SPI transfers deassert chip select between transmissions by default, which is not allowed on the PN5180 (see below). Solution: use xfer2 instead of xfer.
The whole transmit buffer shall be written at once as well. No NSS assertion is allowed during data transfer. PN5180A0XX-C1-C2, page 19