This document describes step-by-step how to run NFC on Raspberry Pi platform.
- Raspberry Pi (any model) : https://www.raspberrypi.org/products/:
- OM5578(PN7150 demokit) in RPi configuration (or OM5577(PN7120 demokit)
Then simply assemble boards together, stacking OM5578RPI (or OM5577RPI) to Raspberry Pi expansion connector:
Use Raspbian (https://www.raspberrypi.org/software/operating-systems/) or any other Linux distribution (guidelines to set up Linux environment on raspberry pi: https://www.raspberrypi.org/documentation/installation/installing-images/).
On Raspbian:
Run "sudo raspi-config"
Use the down arrow to select "5 Interfacing Options"
Arrow down to "P5 I2C"
Select "yes" when it asks you to enable I2C
Also select "yes" if it asks about automatically loading the kernel module
Use the right arrow to select the <Finish> button
Select "yes" when it asks to reboot
The system will reboot. when it comes back up, log in and enter the following command "ls /dev/*i2c*".
The Pi should respond with "/dev/i2c-1" which represents the user-mode I2C interface.
On Raspbian execute the command:
sudo apt-get install autoconf automake libtool git
Execute the command:
git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git
Execute the commands:
cd linux_libnfc-nci
./bootstrap
./configure --enable-alt
Execute the commands:
make
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib
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
Execute command:
export LD_LIBRARY_PATH=/usr/local/lib
You may wan't to make this setting permanent by adding it to your .bashrc file for instance :
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> .bashrc
Several simple examples demonstrating use of the linux_libnfc-nci library for different use cases (Reader, Peer to peer, Host Card Emulation) are given as reference: https://github.com/NXPNFCLinux/linux_libnfc-nci_examples
- Simply clone the repository
git clone https://github.com/NXPNFCLinux/linux_libnfc-nci_examples.git
- Browse to the targeted example:
cd linux_libnfc-nci_examples/xxx_example
- Build the example:
make
- Run the example
./xxx_example
Using UDOO NEO (with OM5577 or OM5578 in Arduino configuration) ?
-> Follow step-by-step procedure, just updating src/halimpl/pn54x/tml/i2c/phTmlNfc_alt.h file to set CONFIGURATION flag to value 2, before building the library
Using BeagleBone Black (with OM5577 or OM5578 in BBB configuration) ?
-> Follow step-by-step procedure, just updating src/halimpl/pn54x/tml/i2c/phTmlNfc_alt.h file to set CONFIGURATION flag to value 2, before building the library
Using other Linux platform or others OM5578/OM5577 demokits configuration ?
-> Follow step-by-step procedure, just updating src/halimpl/pn54x/tml/i2c/phTmlNfc_alt.h file to set CONFIGURATION flag to value 0 and defining I2C_BUS, PIN_INT and PIN_ENABLE flags according to the HW connection, before building the library