ELECHOUSE PN7160 SPI Board User Guide

September 9, 2024
ELECHOUSE

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

  1. Run command:
    sudo raspi-config

  2. Use the down arrow to select “Interface Options

  3. Arrow down to “P4 SPI

  4. Select “yes” when it asks you to enable SPI

  5. 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

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals