Easy set-up of NFC on Raspberry Pi

Document created by Jeremy Geslin Employee on Aug 14, 2018Last modified by Jeremy Geslin Employee on Feb 25, 2019
Version 3Show Document
  • View in full screen mode

This document describes step-by-step how to run NFC on Raspberry Pi platform.

 

Hardware setup:

You need:

   - Raspberry Pi (any model except Pi zero) : 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:

                                 

                                                         

 

 

Software setup:

Use Raspbian (https://www.raspberrypi.org/downloads/raspbian) or any other Linux distribution (guidelines to set up Linux environment on raspberry pi: https://www.raspberrypi.org/documentation/installation/installing-images/).

 

Step by step procedure:

  • Enable i2c support:

       On Raspbian:

  1. Run "sudo raspi-config"

  2. Use the down arrow to select "5 Interfacing Options"

  3. Arrow down to "P5 I2C"

  4. Select "yes" when it asks you to enable I2C

  5. Also select "yes" if it asks about automatically loading the kernel module

  6. Use the right arrow to select the <Finish> button

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

 

  • Install necessary tools:

        On Raspbian execute the command "sudo apt-get install autoconf automake libtool"

  • Clone Linux libnfc-nci library repository:

        Execute the command "git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git"

  • Configure the library:

        Execute the commands:

     - "cd linux_libnfc-nci"

     - "./bootstrap"

     - "./configure --enable-alt"

  • Build and install the library:

        Execute the commands:

     - "make"

     - "sudo make install"

  • Run demo application (built and installed together with the library during previous step):
    Execute the command "nfcDemoApp <arg>". To simply display all data collected from remote NFC device (Peer, reader/writer or card), execute the demo application in poll mode executing the command "nfcDemoApp poll". For more details about the demo application modes execute command "nfcDemoApp --help".

 

One step further:

  • Set environment variable to reference library installation:

        Execute command: "export LD_LIBRARY_PATH=/usr/local/lib"

       - 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"

 

Additional information:

  • Another Platform ?

       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

         -> Follow guidelines provided in the related documentation: https://www.nxp.com/docs/en/application-note/AN11767.pdf

       Running Android ?

         -> Follow guidelines provided in the related documentation: https://www.nxp.com/docs/en/application-note/AN11690.pdf

Attachments

    Outcomes