Skip to main content
Associate II
August 3, 2026
Question

st25r3911b Tag Detection Issue

  • August 3, 2026
  • 2 replies
  • 19 views

So our System works fine most of the time but sometimes the Reader does not detect the tag and we observe that 
rfalNfcState are just keep fluctuating between RFAL_NFC_STATE_POLL_TECHDETECT and  RFAL_NFC_STATE_LISTEN_TECHDETECT  same as when no tag present in the field of Reader and it is not able to satisfy this if condition.

if( rfalNfcIsDevActivated( rfalNfcGetState() ) ) // this if condition

We observed that even if we do controller reset it doesn’t fix the issue only when we power cycle the reader{st25r3911b} it start working again normally.

I’m attaching the code with this i want your team to review it to let us know what exactly we are doing wrong which leading to this state where our rfal state machine not switching properly, With Restart_flag we are doing reinitialization i want you to review that whatever sequence we are following is correct or not 
 

Main.c  {Rfid Reinitialization sequence}

Please help us fix this issue and could you provide or help us that through software function or any register so that can we reset the reader without need to manually power cycle the reader.

Kindly find the attachments attached of main.c and demo.c.

2 replies

DDSAuthor
Associate II
August 3, 2026

One more observation which we made for interruptregister.status, we have attached the behavior in working state as well as non working state.
Kindly find the attachment below.

Brian TIDAL
ST Technical Moderator
August 3, 2026

Hello,

The following summary reflects the current understanding:

  • The system is based on an STM32 microcontroller (MCU) and an ST25R3911B.
  • The firmware runs under FreeRTOS™.
  • TASK03 runs the NFC demo cycle.
  • Only Type 5 tags are used to store and read data in the tag memory.
  • Restart_flag is set to true when an abnormal condition, for example, a timeout, occurs. This action restarts the ST25R3911B.

The following comments apply to the reviewed code:

  • The priorities of TASK03 and TASK04 do not match the comment.
  • HAL_GetTick() returns a uint32_t unsigned value, whereas t_rfid = HAL_GetTick() - t_0; uses signed arithmetic.
  • The code mixes RF abstraction layer (RFAL) high-layer calls, such as rfalNfc calls, with RFAL low-layer calls, such as rfalNfcvPollerInitialize. This use is not recommended.
  • st25r3911WriteRegister(02, 0x00) and st25r3911OscOn() inside the NFC demo cycle must be used with caution. Is the purpose to suspend the NFC feature temporarily? If yes, simply add a DEMO_ST_SUSPENDED state, enter this state with a rfalNfcDeactivate and exit this state with state = DEMO_ST_START_DISCOVERY;

Please clarify the following points:

  • Does the design use an STM32 Nucleo board with an X-NUCLEO-NFC05A1 expansion board, or a custom board?
  • How is the ST25 IRQ handled?
  • How is SPI communication protected between the ST25 IRQ interrupt service routine and the NFC task?
  • How is the NFC platform timer handled?
  • What is the priority of the FreeRTOS timer task, if it is used? The default timer task priority of 2 usually causes many issues. The priority should be higher than the priorities of the other tasks, typically 48.
  • Is the wake-up mode of the ST25R3911B used?
  • Which NFC features are enabled in RFAL platform.h ? Only RFAL_FEATURE_NFCV seems necessary in this application, and possibly RFAL_FEATURE_WAKEUP_MODE.

To restart the ST25R3911B:

  • Do not call rfalInitializerfalFieldOffrfalNfcvPollerInitialize, or rfalFieldOnAndStartGT.
  • Do not call st25r3911Initialize.
  • Call rfalDeinitialize, and then call demoIni.

To investigate further, connect a logic analyzer to SPI CLK, MOSI, MISO, CS, and ST25 IRQ, and provide the raw trace file.

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.