Hi,
I'm trying to drive a PN5180 from a raspberry Pi, using the library, but I'm getting the following error and am unable to figure out the reason. I triple checked the build instruction in the PDF and the connections to the board.
pi@raspberrypi:~/SW369321/_build/Examples/NfcrdlibEx1_BasicDiscoveryLoop $ ./NfcrdlibEx1_BasicDiscoveryLoop
BasicDiscoveryLoop Example:
Line: 123 Error - (0xF181) has occurred in NFCLIB
I get the error both with board plugged to the RPi, and I also tested with nothing plugged in to see if a different error is presented.
It seems that something is wrong in the interaction with the RPi when using the board config for the PN5180, as opposed to the board config for the RC663; as you can see in the screenshots below, when compiling against the board config for the RC663 I can see the library tries to initialize the board via SPI, whereas for the board config for the PN5180 there is no communication at all on the SPI bus.
RC663 Board Config
PN5180 Board Config
I did enable SPI as requested by the manual, is there anything else that needs to be changed on the RPi, or maybe a known incompatibility with the version of Raspbian and the kernel I'm running?
Many thanks
This is on a clean RPi install with version as below:
For anyone facing this issue as well, I was able to modify it and run the first discovery loop example on my rpi 02w and my pn5180.
In Platform/DAL/boards/Board_PiPn5180.h you should change the gpio pins to match your pi's corresponding gpio numbers in the sysfs interface.
For my pi, I had to offset all of them by 512 because that was the base-N that was in my gpiochip (per https://www.kernel.org/doc/Documentation/gpio/sysfs.txt) (you can find it by seeing the number after gpiochip in /sys/class/gpio/gpiochipX)
So the line
#define PHDRIVER_PIN_RESET 16
becomes
#define PHDRIVER_PIN_RESET 512+16
and so on for the rest of the pins.
I also commented out #define PHDRIVER_LINUX_KERNEL_SPI and uncommented #define PHDRIVER_LINUX_USER_SPI to disable the bal driver. yes it's slower but the latest commit for the driver is from 9 years ago, so that's the best one can do.
I attached a diff file for my raspberry pi, but it might not work on yours because of the different gpio base number, you can refer to it for the changes in the code.
Hope this helps.
I also have the same problem.
DiscoveryLoop Example:
Line: 135 Error - (0xF181) has occurred in NFCLIB
Hi,
I could not solve it unfortunately, I reverted to writing my own library in python (https://github.com/fservida/pyPN5180) but it is a very rough attempt at just getting the UID from a card; it works sufficiently for my application so I did not dig further. Feel free to try it out, and maybe use it as a base for more functionality.
I'd also be very interested in an official answer from NXP about that.
Cheers
I have exactly the same issue (except for error happening on line 135) and I'd be interested to know how did you manage to solve it.
Official response from NXP support is welcome too.