2025-09-23 7:59 AM
Hello,
I’m working with an ST25R3916 and an ESP32-S3. I ported the RFAL library to the ESP32 (platform.c), and it works — I can successfully read a tag with this setup.
However, I’m struggling to emulate a tag in order to send an NDEF message.
Does anyone know where I could find an example implementation for this?
For more context: when I enable tag emulation, my reader correctly detects the programmed UID, but I can’t manage to retrieve the NDEF.
Thanks in advance.
Solved! Go to Solution.
2025-09-29 2:11 AM - edited 2025-09-29 2:14 AM
Hi,
in Card Emulation, the ST25R3916 hardware handles automatic replies to anticollision frames. Once the Card Emulation is ready for upper layer communication (i.e. once the remote reader has retrieved the Card Emulation UID), the replies to remote commands are handled by the FW. The typical first message being received is RATS where the FW has to reply in less than 5ms. Could you make sure your port to ESP32 schedule the demo_cycle as a dense loop to be able to reply to RATS in less than 5ms?
Also I suggest to enable the DEMO_CARD_EMULATION_ONLY compilation flag.
Printf-like debugging/logging can as well delay the reply to the RATS.
Rgds
BT
2025-09-23 8:07 AM
Hi Baptiste,
An example of Card Emulation code is available in the pairing demo of the ST25 Embedded Library. The X-CUBE-NFC6 also includes Card emulation demo.
See demo_polling.c and demo_ce.c files in those packages.
Rgds
BT
2025-09-26 1:01 AM
Hi,
Thanks for your reply,
I tested with the two files (demo_ce.c and demo_polling.c), but unfortunately it still doesn’t work. With these demos, when I present a tag, it is detected properly. However, when I present a reader (tested with a Flipper Zero and several smartphones), the best I get is the UID — I never receive the NDEF message.
I’ve been stuck on this issue for several weeks now. Could this be related to a hardware problem (custom board), or since I can already read a tag and emulate a UID, does it rather suggest a software issue?
2025-09-29 2:11 AM - edited 2025-09-29 2:14 AM
Hi,
in Card Emulation, the ST25R3916 hardware handles automatic replies to anticollision frames. Once the Card Emulation is ready for upper layer communication (i.e. once the remote reader has retrieved the Card Emulation UID), the replies to remote commands are handled by the FW. The typical first message being received is RATS where the FW has to reply in less than 5ms. Could you make sure your port to ESP32 schedule the demo_cycle as a dense loop to be able to reply to RATS in less than 5ms?
Also I suggest to enable the DEMO_CARD_EMULATION_ONLY compilation flag.
Printf-like debugging/logging can as well delay the reply to the RATS.
Rgds
BT
2025-09-29 2:52 AM
I had a 10 ms delay in the demo_cycle, I changed it to 1 ms and now it works.
Thank you so much !