2022-06-20 12:31 PM
Hi all,
I'm trying to read and write values to an STmicro tag(ST25TA02KB-D, ISO 14443-4) using the X-Nucleo board from a python program. I've tried a number of approaches(waveshare pi hat, standalone PN532 modules, using libnfc and adafruit libraries, to list) but none really work and it's honestly a little out of my depth.
Currently I've built the Linux nfc polling demo included with the X-Nucleo board, but even that fails to run(see attached)
If I had resources or python examples using any of these systems, I could probably figure it out, but all the support I've found seems to apply mainly to mifare classic cards.
If anybody has experience or pointers for any of this I'd be quite grateful to hear it!
Solved! Go to Solution.
2022-06-29 10:20 AM
Hi
st25r3916Initialize is a function inside st25r3916.c.
I suggest to put a breakpoint on it and to step inside. You should enter inside #ifdef ST25R_SELFTEST part of this function, in particular in the /* Check IRQ Handling */ part. If this returns ERR_TIMEOUT, this means the IRQ is not properly handled.
Rgds
BT
2022-06-29 11:22 AM
Ok, So I set a breakpoint at main in the built demo and stepped through- it's looping starting at line 117 as shown below. Running the executable seems to only bring up main.c- and GDB won't open st25r3916.c on it's own. I'm guessing the program jumps to st25r3916.c at some point? But I'm not getting there currently.
2022-06-29 02:14 PM
Hi,
if you do not feel confortable with gdb, I suggest you modify the demoIni() function in demo_polling.c file to add
platformLog("rfalNfcInitialize err = %d\r\n", err);
just after err = rfalNfcInitialize(); (line 182)
If you see err = 4 on the console, this means the IRQ handling is not working properly.
Rgds
BT
2022-07-03 02:04 PM
Thank you, I appreciate that!
So after adding the line and rebuilding, the code outputs "rfalNfcInitialize err = 36", which crosses to "expected hw do not match" in st_errno.h.
2022-07-04 12:15 AM
Hi,
can you check which board is being used i.e. X-NUCLEO-NFC05A1 or X-NUCLEO-NFC06A1 and can you check which firmware package is being used i.e STSW-ST25R013 or STSW-ST25R009?
Does your package contain rfal_rfst25r3911.c or rfal_rfst25r3916.c?
Rgds
BT
2022-07-04 03:52 AM
Hi,
I think you need to debug into st25r3916CheckChipID() to see what it received as ID register. If it is 0x00 or 0xff then I would suspect one of the SPI connections not working. In any case please share the value of ID variable.
Best Regards, Ulysses
2022-07-04 03:26 PM
It's the NFC05A1 with the ST25R013 package, 25r3916. Though I've tried ST25R009 as well, though it returned an error when building.
How might I debug into the checkchipID function? I'm trying to do a similar platformLog approach currently.
2022-07-05 12:15 AM
Hi,
X-NUCLEO-NFC05A1 is based on ST25R3911B NFC reader IC whereas X-NUCLEO-NFC06A1 is based on ST25R3916 IC which is a different chip with a different chip Id.
STSW-ST25R013 is designed to run on ST25R3916 (X-NUCLEO-NFC06A1) but not for ST25R3911B (X-NUCLEO-NFC05A1). Therefore, using STSW-ST25R013 with X-NUCLEO-NFC05A1 will cause an error due to incorrect chip.
If you have a X-NUCLEO-NFC05A1, the corresponding Linux package is STSW-ST25R009.
Rgds
BT
2022-07-05 08:10 AM
Thank you! That was my error, I appreciate it!
I've tried to build ST25R009 but it keeps throwing the below error, an undefined ref to "pthread_create":
My process was first extracting the zip(.xz) file to the home directory, then running "cmake .." and "make" from within its build folder, similar to ST25R0013, which resulted in the output above.
After doing some research I updated pthread using apt-get(it was already the latest version), and tried "make -pthread" and "make -lpthread" when building, with no change.
2022-07-05 08:49 AM
Hi,
It seems the pthread lib is not included by default
In .\en.STSW-ST25R009\rfal_v1.3.0\applications\CMakeLists.txt, can you add:
find_library(LIBPTHREAD_PATH pthread)
and modify the last line of the file to:
target_link_libraries(nfcPoller ${PROJECT_LINK_LIBS} ${LIBPTHREAD_PATH})
This should fix your issue (I cannot test on my side but this should be close to the solution)
Rgds
BT