cancel
Showing results for 
Search instead for 
Did you mean: 

Read/Write to STmicro ISO 14443-4 tags using X-Nucleo and raspberry pi

JMilk.1
Associate III

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!

27 REPLIES 27
Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
JMilk.1
Associate III

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. 0693W00000Nt4TnQAJ.png 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.

Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
JMilk.1
Associate III

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.

Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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

JMilk.1
Associate III

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.

Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
JMilk.1
Associate III

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

0693W00000QKU7kQAH.pngMy 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.

Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.