PN7150 on Raspberry Pi 5

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PN7150 on Raspberry Pi 5

2,873 Views
zblocker
Contributor I

I'm trying to get a PN7150 working on a Raspberry Pi 5 on Bookworm. I followed the 7160 porting process described here (https://community.nxp.com/t5/NFC-Knowledge-Base/Porting-PN7160-NCI2-stack-to-Raspberry-Pi-5-OS-Bookw...), hoping it would transfer, but it's not working. The nfcDemoApp binary compiles and runs, but doesn't detect anything.

Should that process work for a 7150 as well? If not, what modifications are needed?

Attached is a debug log from nfcDemoApp.

0 Kudos
Reply
11 Replies

2,836 Views
zblocker
Contributor I

Following the linked instructions, nfcDemoApp compiles, but a poll command fails with the following message.

CUSTOM> too many i2c read errors: ABORTING...
NfcService Init Failed
Leaving ...

Attached is debug output.

0 Kudos
Reply

2,768 Views
KaiLi
NXP TechSupport
NXP TechSupport

Hello @zblocker 

The post that I sent you is a success story, but you failed. From the logs, you can see that there are too many I2C errors and I2C communication is not established. What is the kernel version on your side?

0 Kudos
Reply

2,756 Views
zblocker
Contributor I

Kernel version is 6.12.20+rpt-rpi-2712. This is the stock kernel from the Pi OS image.

0 Kudos
Reply

2,738 Views
KaiLi
NXP TechSupport
NXP TechSupport

Hello @zblocker 

Linux is constantly improving the kernel versions. Kernel versions that are bigger as 6.1 don't support anymore the GPIO toggling via file access. Since together with new Raspberry pi OS (bookworm) they deploy the kernel version 6.6 this can lead to errors while executing the PN7150/PN7160 examples.

User can see the errors in log connected to i2c_read and i2c_write failures. The reason for this is that GPIO access in /system/class/gpio/ don't exist anymore and this due to that system is not toggling VEN, DWNL_REQ, IRQ pins. Since those pins are important for communication and resetting the device we can't work without them.

In the attached zip you can find the changes we did to address this issue. We change the file GPIO access with gpiod.h library that is becoming the standard for GPIO handling in Linux (https://libgpiod.readthedocs.io/en/latest/index.html).

User need to do following things to make this code working:

Follow steps in PN7160 Linux porting guide to download the code
Apply 64-bit patch in case 64-bit OS is used
Replace the Makefile.am with the one in zip
Replace NfccAltTransport.h and NfccAltTransport.cc in src/nfcandroid_nfc_hidlimpl/halimpl/tml/transport with the two files in the attached zip
Run following two commands
sudo apt-get install gpiod
sudo apt-get install libgpiod-dev
Follow the installation guide to build the example
Run the examples
Be aware that this code is just a test code and it was not scanned with Black Duck scan so can't be shared outside NXP, but you can use it to guide the customer to solve the problem. We are already working with R&D to release this to GitHub. This zip shall not be used in release, since we didn't do any verification/validation. The only test we did is basic sanity check to see if functionality is working.

0 Kudos
Reply

2,715 Views
zblocker
Contributor I

Having followed the PN7160 porting guide and then applied the files from the provided zip, nfcDemoApp compiles and runs, but it doesn't detect a nearby NFC card. In the debug log, I do see some errors like this:

phNxpNciHal_print_res_status: response status =STATUS_SYNTAX_ERROR

 

Debug log attached.

0 Kudos
Reply

2,617 Views
KaiLi
NXP TechSupport
NXP TechSupport

Hello @zblocker 

please refer to the attached project.  It runs on Raspberry Pi 5,  64bit.
hope it helps.
0 Kudos
Reply

2,584 Views
zblocker
Contributor I

When I untar this and run "sudo make install", again, it compiles and runs, but detects nothing. Attached is all the output I see in the terminal.

 

What steps can I take to figure out what's wrong?

0 Kudos
Reply

2,564 Views
KaiLi
NXP TechSupport
NXP TechSupport

Hello @zblocker 

Your situation is so strange. Is the PN7150 what you are using NXP development board?

0 Kudos
Reply

2,503 Views
zblocker
Contributor I

Yes, it is.

0 Kudos
Reply

2,486 Views
KaiLi
NXP TechSupport
NXP TechSupport

Hello @zblocker 

Ok, it's clear. Let me build the same platform and test.

0 Kudos
Reply

2,851 Views
KaiLi
NXP TechSupport
NXP TechSupport

Hello @zblocker 

For your question, it's recommended that you can read this post (Easy set-up of NFC on Raspberry Pi - NXP Community) which is dedicated for PN7150, and after that if still question please update to us.

0 Kudos
Reply