Thank you very much for your response. I switched to using transport mode 0x02 directly instead of the kernel driver mode 0x00, and now it seems to work better. Occasionally, it still freezes, but it might be related to access to the /sys/class/gpio class. On my board, I’m already using kernel 6.6, and I recompiled it with that class enabled since libnfc-nci relies on it to access the pins.
I also found a document explaining how to make the library compatible with the new GPIO access method via gpiochip (libgpiod) at this link:
https://community.nxp.com/t5/NFC-Knowledge-Base/Porting-PN7160-NCI2-stack-to-Raspberry-Pi-5-OS-Bookw...
I tested it on a Raspberry Pi 5, and it works. Now I need to try it on the other board, which is an STM32MP157F-DK2, to see if it stops freezing.
However, I still have an issue. In my project, I need to read sector 1 at block 0 of a MIFARE Classic 1K card, obviously with authentication. I wrote a small C program using the libnfc-nci library. I authenticate successfully and then read the sector, but occasionally, the first byte returns FF instead of the correct value. Other times, it returns correctly.
I don't understand whether this could be interference on the bus, but the strange thing is that it always affects that specific byte, never the others. I tried using an oscilloscope to analyze the signal, but the trace is too long, and I can't capture the relevant part. A logic analyzer would be helpful, but unfortunately, I don't have one available.
What could I try?
Best regards.