cancel
Showing results for 
Search instead for 
Did you mean: 

ST25R3916B with Antenna Multiplexer – RFAL_worker() timing and FreeRTOS task separation?

MERSI
Associate III

Hi everyone,

I’m currently working with the ST25R3916B NFC reader and controlling up to 6 external antennas via a multiplexer. The antennas are activated sequentially, i.e., I switch between them one after another in a polling loop.

However, I’m experiencing an issue where not all antennas work reliably in every cycle. Sometimes an antenna seems unresponsive or is not detected by a test card, even though it worked in earlier cycles.

I suspect that the problem might be related to RFAL_worker() not being called frequently enough.

Could that be the root cause?

My current architecture is based on FreeRTOS, and I’m considering the following approach:

Run RFAL_worker() continuously in a dedicated FreeRTOS task, perhaps at a high frequency or short interval.

Run the other NFC logic (polling, tag handling, antenna switching, etc.) in the main task or another thread.

My questions:

1. Is it safe and recommended to call RFAL_worker() in a separate FreeRTOS task while performing the rest of the NFC logic in another task?

2. Do I need to use mutexes or other synchronization mechanisms to protect access to shared RFAL state? 

3. Has anyone successfully implemented a similar architecture with the ST25R3916 and multiple antennas?

Any input, guidance, or example setups would be greatly appreciated!

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

The FreeRTOS_polling demo in the ST25R Embedded Library provides an example of the RFAL operating under FreeRTOS.

The application and the RFAL operate within the same task. An ISR task with a higher priority manages the ST25R3916B interrupt pin. This ISR task is notified by the interrupt handler using vTaskNotifyGiveFromISR.

The communication with the ST25R3916B is safeguarded using taskENTER_CRITICAL() and taskEXIT_CRITICAL().

It is recommended to follow this software architecture.

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.

View solution in original post

1 REPLY 1
Brian TIDAL
ST Employee

Hi,

The FreeRTOS_polling demo in the ST25R Embedded Library provides an example of the RFAL operating under FreeRTOS.

The application and the RFAL operate within the same task. An ISR task with a higher priority manages the ST25R3916B interrupt pin. This ISR task is notified by the interrupt handler using vTaskNotifyGiveFromISR.

The communication with the ST25R3916B is safeguarded using taskENTER_CRITICAL() and taskEXIT_CRITICAL().

It is recommended to follow this software architecture.

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.