cancel
Showing results for 
Search instead for 
Did you mean: 

NFC ST25R3916 Wake Up mode and MCU external interrupt handling

OSala.1
Associate II

I have some problems in understanding the appropriate way to setup the ST25R3916 chip to being in sleep mode, wake up the Microcontroller from an interrupt and then read an NTAG type A message and finally putting the NFC Chip back to wakeup mode.

I am working with the NFC06A1 Example code, using a STM32-L476RG.

I would like some ideas of the functions that need to be called in order to properly work with the RFAL State machines.

1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi,

there are a few aspects to what you want to do:

  • Please review AN5320, the last chapter talks about considerations when inductive wakeup is used together with AAT.
  • The NFC06A1 does have varicaps. With this board you need to either use swTagDetect=true or increase the delta / use autoAvg to avoid false wake-ups due to varicap settling. Of course this will also decrease detection range. You can do so by changing discParam.wakeupConfig[Default].
  • The software at hand defaults to swTagDetect=true with period 500ms. In this mode the ST25R3916 creates an interrupt every 500ms. MCU needs to execute rfalWorker() which triggers inductive measurements and evaluates the results.

For putting the MCU to some sleep/wait-for-interrupt mode you can place before the rfalWorker() the following pseudo-code:

if (RFAL_NFC_STATE_WAKEUP_MODE == rfalNfcGetState())
{
    // Theoretically a race condition could occur but practially the time between starting and first interrupt is >10ms, default 500ms.
    // ...... put MCU into some sleep mode
   wfi();
   // ...... put MCU back into normal mode
}
rfalWorker();

Such code would need to be added in both cases of swTagDetect =1 and =0 case. But the difference will be the expected time until wake-up event on the MCU and periodicity.

Regards, Ulysses

View solution in original post

1 REPLY 1
Ulysses HERNIOSUS
ST Employee

Hi,

there are a few aspects to what you want to do:

  • Please review AN5320, the last chapter talks about considerations when inductive wakeup is used together with AAT.
  • The NFC06A1 does have varicaps. With this board you need to either use swTagDetect=true or increase the delta / use autoAvg to avoid false wake-ups due to varicap settling. Of course this will also decrease detection range. You can do so by changing discParam.wakeupConfig[Default].
  • The software at hand defaults to swTagDetect=true with period 500ms. In this mode the ST25R3916 creates an interrupt every 500ms. MCU needs to execute rfalWorker() which triggers inductive measurements and evaluates the results.

For putting the MCU to some sleep/wait-for-interrupt mode you can place before the rfalWorker() the following pseudo-code:

if (RFAL_NFC_STATE_WAKEUP_MODE == rfalNfcGetState())
{
    // Theoretically a race condition could occur but practially the time between starting and first interrupt is >10ms, default 500ms.
    // ...... put MCU into some sleep mode
   wfi();
   // ...... put MCU back into normal mode
}
rfalWorker();

Such code would need to be added in both cases of swTagDetect =1 and =0 case. But the difference will be the expected time until wake-up event on the MCU and periodicity.

Regards, Ulysses