PN7150 NFC Controller on i.MX8M mini evk running Yocto

Document created by Jeremy Geslin Employee on Mar 27, 2019Last modified by Jeremy Geslin Employee on Apr 10, 2019
Version 2Show Document
  • View in full screen mode

This documents describes how to add the NFC support to i.MX8M mini evk running Yocto.

Hardware setup:

The i.MX8M mini evk (see i.MX 8M Mini Evaluation Kit | NXP) featuring Raspberry Pi compliant connector, the OM5578/RPI PN7150 demo kit can be used to perform this porting (see NFC Development Kits for Arduino and more|NXP). However a small modification must be done because some of the signals required by PN7150 are not mapped to i.MX8M mini expansion connector pins.

OM5578 IRQ signal must be mapped to Raspberry Pi connector pin #19 and OM5578 IRQ signal must be mapped to Raspberry Pi connector pin #21.

See below a picture of the modification:

Then, the two boards can fit together as shown in the picture below:

Quick start using demo image:

The demo image including support for PN7150, is based on i.MX Linux 4.14.78_1.0.0 BSP software release (see i.MX Software | NXP).

Related documentation can be downloaded from here: https://www.nxp.com/webapp/Download?colCode=L4.14.78_1.0.0_LINUX_DOCS.

Just flash the demo image (downloaded from here: https://www.nxp.com/lgfiles/updates/NFC/LINUX_L4-14-78_IMAGE_MX8MMEVK.zip) following guidelines from i.MX_Linux_User's_Guide document (part of L4.14.78_1.0.0_LINUX Documentation package mentioned above).

Then in a terminal you can run the demo application included in the image executing the command:

   # nfcDemoApp poll

Approaching the NFC tag, provided as reference in the OM5578 demo kit, to the NFC Antenna will trigger such display:

 

 


Adding PN7150 support to imx-linux-sumo release:

Pre-condition is to have L4.14.78_1.0.0 release installed and already built as described in i.MX Yocto Project User's Guide (part of L4.14.78_1.0.0_LINUX Documentation package mentioned above) :

    $ repo init -u https://source.codeaurora.org/external/imx/imx-manifest  -b imx-linux-sumo -m imx-4.14.78-1.0.0_ga.xml

    $ repo sync

    $ MACHINE=imx8mmevk DISTRO=fsl-imx-xwayland source fsl-setup-release.sh -b build_dir

    $ bitbake fsl-image-validation-imx

 

Then to add PN7150 support to your imx-linux-sumo environment, follow below step by step guidelines:

    $ git clone https://github.com/NXPNFCLinux/meta-nxp-nfc.git 

  • Define hardware connection between CPU and PN7150 in device-tree adding the following lines to file build_dir/tmp/work-shared/imx8mmevk/kernel-source/arch/arm64/boot/dts/freescale/fsl-imx8mm-evk.dts:

@@ -227,6 +227,8 @@
                        fsl,pins = <
                                MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL                  0x400001c3
                                MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA                  0x400001c3
+                               MX8MM_IOMUXC_ECSPI2_MOSI_GPIO5_IO11             0x41
+                               MX8MM_IOMUXC_ECSPI2_MISO_GPIO5_IO12             0x41
                        >;
                };
 
@@ -747,6 +749,13 @@
        pinctrl-0 = <&pinctrl_i2c3>;
        status = "okay";
 
+       pn54x: pn54x@28 {
+               compatible ="nxp,pn547";
+               reg = <0x28>;
+               interrupt-gpios = <&gpio5 11 0>;
+               enable-gpios = <&gpio5 12 0>;
+       };
+
        pca6416: gpio@20 {
                compatible = "ti,tca6416";
                reg = <0x20>;

  • Add the meta-nxp-nfc layer to the build definition updating file build_dir/conf/bblayers.conf with:

BBLAYERS += " ${BSPDIR}/sources/meta-nxp-nfc"

  • Add the meta-nxp-nfc layer components to the image definition updating file build_dir/conf/local.conf with:

IMAGE_INSTALL_append = " kernel-module-nxp-pn5xx nxp-nfc-bin "

  • Re-build the linux kernel:

    $ bitbake -f -c compile linux-imx && bitbake -f -c deploy linux-imx

  • Build meta-nxp-nfc layer:

    $ bitbake nxp-nfc

  • Re-build the complete image to include the modifications:

    $ bitbake fsl-image-validation-imx

Then you can flash the updated image to your i.MX8M mini evk and run the demo application as described in above "Quick start using demo image" chapter.

 

Reference:

This porting have been done (demo image and instructions) following guidelines provided in AN11679_PN71xx_Linux_Software_Stack_Integration_Guidelines document.

1 person found this helpful

Attachments

    Outcomes