cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the ST25R95 on an IRQ basis?

JNieu.1
Associate II

Hello,

How do I use the S25R95 on an IRQ/Callback basis?

What I have found so far is that there are three callbacks (UpperLayer, PreTxRx, PostTxRx) you can use for the ST25R95, but these are only available during the regular polling/running process.

I am looking for a way to have the ST25R95 initiate so that it runs in a silent mode always checking if there is an NFC device near. And when there is, it sends a signal via a pin like IRQ_OUT.

I currently have the situation where I'm required to continuously poll the device to see if there is an active device, but I want my main program not to have to do that. I want it to be checking for a, probably GPIO IRQ input and then respond to that using the functions to read information from the NFC Device.

Is this possible, and if so, what would be the solution to do so?

Kind regards,

Joey

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

the RFAL is portable among different MCU.  X-CUBE-NFC3 provides by default the support of NUCLEO-L476RG, NUCLEOF401RE and NUCLEO-F103RB but it can be easily ported on other STM32 boards including NUCLEO-G070RB. I've attached the STM32CubeMX project file used on NUCLEO-L476 so that you can easily replicate the setup on NUCLEO-G070RB.

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

11 REPLIES 11
Brian TIDAL
ST Employee

Hi,

you can use the Tag Detector feature of the ST25R95. In this mode, the ST25R95 monitor the RF and once a tag is nearby, the IRQ_OUT is triggered. Then the various activities (technology detection, anticollision and activation are performed

This mode is demonstrated in the polling demo of the X-CUBE-NFC3 package when pressing the blue user button on the Nucleo, the ST25R95 enters the tag detection mode (aka wake up mode) and the following logs are displayed on the serial console:

Toggling Wake Up mode ON

Wake Up mode started

Wake Up mode terminated. Polling for devices <---- RF conditions have been modified when a tag is nearby,the IRQ_OUT is triggerred

ISO14443A/NFC-A card found. UID: 0201A465842000 <-- result of polling of the tag

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.
JNieu.1
Associate II

Hi Brian,

In the demo it doesn't run on an IRQ base though, it will still continuously run the demoCycle in main.c. That's the main thing I want to avoid, I want the main setup to be done during an initialization phase. And when the IRQ Handler is triggered (thus IRQ_OUT is pulled low) I want it to continue the rest of the process to read the tag. After that I want it to go back to where it was in an idle state waiting for the IRQ Handler. None of these things should happen in my main loop, but all on initialization / reinitialization after a trigger and the trigger itself.

Kind regards,

Joey

Brian TIDAL
ST Employee

Hi,

once the wake up mode is on, you can get rid of the demoCycle until the IRQ_OUT is received. Outside the wake up mode, the rfalNfcWorker has to called on a regular basis to run the various state machines.

Just for my understanding, what is the main loop doing when not doing NFC?

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.
JNieu.1
Associate II

Hi Brian,

The main loop is running a different state machine, with it's own conditions to switch states. One of them being the NFC, which I want to have to switch the state only on an interupt base.

Kind Regards,

Joey

Brian TIDAL
ST Employee

Hi,

I see. So I would suggest:

  1. modify the discParam.wakeupEnabled    = true; in demoIni()
  2. run the demoCycle until demoNotif() signals RFAL_NFC_STATE_WAKEUP_MODE. Change the main Loop state and wait for IRQ_OUT
  3. when IRQ_OUT occurs goto 2

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.
JNieu.1
Associate II

Hi,

Just to understand it right, the rfalNfcWorker still has to be called on a regular basis so it has to be in a kind of polling loop. You cannot run it on an interupt basis.

I've tried putting the calling of rfalNfcWorker on a timer, but that seem so block the timer at a certain point (I cannot find why the timer is blocked).

Is it possible to make a new thread to run this process, since I would rather not put it in my main loop because that would occasionally block my main running statemachine.

Kind regards,

Joey

Brian TIDAL
ST Employee

Hi,

"Is it possible to make a new thread to run this process," ==> do you run inside a RTOS (e.g. FreeRTOS)?

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.
JNieu.1
Associate II

Hi,

Not yet, I have been looking into FreeRTOS. I'm using a G070RB.

If the support for the STM32F0 Arm Cortex-M0 based microcontroller is the same as for the STM32G0 ARM Cortex-M0 based microcontroller (which the G070RB is) I can use it, otherwise the G070RB is not supported (yet?)

Kind regards,

Joey

Brian TIDAL
ST Employee

Hi,

the RFAL is portable among different MCU.  X-CUBE-NFC3 provides by default the support of NUCLEO-L476RG, NUCLEOF401RE and NUCLEO-F103RB but it can be easily ported on other STM32 boards including NUCLEO-G070RB. I've attached the STM32CubeMX project file used on NUCLEO-L476 so that you can easily replicate the setup on NUCLEO-G070RB.

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.