ELECHOUSE PN7160 SPI Board User Guide
- September 9, 2024
- ELECHOUSE
Table of Contents
ELECHOUSE PN7160 SPI Board
Required Items
- Raspberry Pi [1] running raspbian distribution.
Hardware Setup
Connection
PN7160 SPI | ——–Raspberry PI 4 |
---|---|
MOSI | #19 MOSI |
MISO | #21 MISO |
NSS | #24 NSS |
SCK | #23 SCLK |
IRQ | #16 GPIO23 |
VEN | #18 GPIO24 |
VDD | #1/#17 3.3V PWR |
VANT | #2/#4 5V PWR |
GND | #6 GND |
DWL | #22 |
Software Setup
Use Raspbian (https://www.raspberrypi.org/software/operating-systems/). Guidelines to set up Linux environment on raspberry pi can be found here: https://www.raspberrypi.org/documentation/installation/installing-images/).
Below is the step-by-step procedure run from the Raspberry Pi to add software support for PN7160:
Enable SPI interface
-
Run command:
sudo raspi-config
-
Use the down arrow to select “
Interface Options
“ -
Arrow down to “
P4 SPI
“ -
Select “
yes
” when it asks you to enable SPI -
Use the right arrow to select the <
Finish
>button.
To verify the SPI interface is enabled, enter the following command ls /dev/spi*
.
The Pi should respond with “/dev/spi0.0
” which represents the user-mode SPI
interface to which is connected the PN7160.
Install necessary tools
Execute the command:
sudo apt-get install autoconf automake libtool git
Clone Linux libnfc-nci library repository
Execute the command:
git clone <https://github.com/NXPNFCLinux/linux_libnfc-nci.git> -b NCI2.0_PN7160
Configure the library
Execute the commands:
cd linux_libnfc-nci ./bootstrap ./configure
Set the library to map SPI interface
Edit linux_libnfc-nci/conf/libnfc-nxp.conf
file to update NXP_TRANSPORT and
NXP_NFC_DEV_NODE settings as shown below:
`###############################################################################
TRANSPORT Type
0x00 - I2C /SPI for noraml nxpnfc driver
0x01 - Not Used, kept to align with Android code
0x02 - ALT_I2C
0x03 - ALT_SPI`
`NXP_TRANSPORT=0x03
###############################################################################
NXP HW Device Node information
NXP_NFC_DEV_NODE="/dev/spidev0.0" `
Build and install the library
Execute the commands:
make sudo make install export LD_LIBRARY_PATH=/usr/local/lib
To make this last setting permanent, run the following command:
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> .bashrc
Run the demo application (built and installed together with the library during previous step)
To simply display all data collected from remote NFC device (Peer, reader/writer or card), run the demo application in “poll mode” executing the command:
nfcDemoApp poll
For more details about the demo application modes execute command:
nfcDemoApp --help
For more detailed information about the demo application, but also for additional example applications, please refer to [2].
References
- GitHub - NXPNFCLinux/linux_libnfc-nci: Linux NFC stack for NCI based NXP NFC Controllers
- Teach, learn, and make with the Raspberry Pi Foundation
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>