Topic: Why ACR122 devices are not recommended with libnfc ?
Hello,
As there are many users who ask about ACR122, I would like to clarify why this is a bad idea to use ACR122 (and derivated like Touchatag), at least with libnfc.
First, I have to say these devices are well-packaged, are cheap, have a nice look and work perfectly as RFID @13.56Mhz reader using PC/SC on common platforms as these devices are CCID compliant.
Internally, an ACR122 device is made with an MCU, a NFC chip (PN532) and an antenna.
MCU made the device CCID compliant and provide an USB connection.
Now let's talk about NFC and underlying requierements: to do more than RFID reader, you will need to:
- Poll for different targets (NFC-A, NFC-B, NFC-F and DEP)
- Act as target in ISO/IEC 14443-4 emulation mode (optionnal regarding NFC Forum but very useful to be backward compatible with device that are not able to do P2P)
- Do P2P as defined in "Logical Link Control Protocal" (LLCP) from NFC-Forum
Polling and acting as target need to be cancellable, ie. you start a target emulation but no initiator comes, you will have to abort the target emulation.
Next, LLCP defines some timeouts for command sending/receiving but long timeouts relies on "abortable" commands.
In actual architecture, libnfc directly talk to NFC Chip (PN532).
To do that, libnfc's ACR122 driver passthrough PC/SC (and internal MCU) by using some special commands that allow to send frames directly to the PN532.
So with ACR122, the libnfc relies on PC/SC but there is no timeout on command and no way to cancel a running command in PC/SC API.
Conclusion, we can't do reliable and robust NFC with ACR122 and libnfc.
Of course, any contributions are more than welcome to fully support ACR122 devices in libnfc.