Skip to main content
Visitor II
May 14, 2025
Solved

ST25R3918 rfid irq handling

  • May 14, 2025
  • 1 reply
  • 727 views

Hello,

 

    I am trying to work with a st25r3918 rfid(should be very similar to st25r3916 and the st25r3916 driver should cover its functionality as I have understood).

    I am trying to validate the interrupts(mainly the nfc for tag reading but for the moment a wake-up timer would be enough)

    I have set GPIO2 on arduino uno board as INT pin as I have read that only GPIOs 2 and 3 can be set for hardware irqs 

 

   And I've found this code snippet in arduino st25r3916 lib to validate irq handling:

 

/*
* Check IRQ Handling:
* - use the Wake-up timer to trigger an IRQ
* - wait the Wake-up timer interrupt
* - return ERR_TIMEOUT when the Wake-up timer interrupt is not received
*/
st25r3916WriteRegister(ST25R3916_REG_WUP_TIMER_CONTROL, ST25R3916_REG_WUP_TIMER_CONTROL_wur | ST25R3916_REG_WUP_TIMER_CONTROL_wto);
st25r3916EnableInterrupts(ST25R3916_IRQ_MASK_WT);
st25r3916ExecuteCommand(ST25R3916_CMD_START_WUP_TIMER);
if (st25r3916WaitForInterruptsTimed(ST25R3916_IRQ_MASK_WT, ST25R3916_TEST_WU_TOUT) == 0U) {
return ERR_TIMEOUT;
}
st25r3916DisableInterrupts(ST25R3916_IRQ_MASK_WT);
st25r3916WriteRegister(ST25R3916_REG_WUP_TIMER_CONTROL, 0U);

 

but is not working for me, meaning interrupt is not triggered.

I have seen in the datasheet that there are different operational and target modes that can be set.

Any additional register configuration is necessary or immediately after power up, the code snippet above should be enough to test the irq?

I would assume no other configuration is needed when checking the wake-up timer.

 

Thanks,

      Mihai

 

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    I would suggest to use the FW provided in https://github.com/stm32duino/ST25R3916 (this supports ST25R3916 series including ST25R3918).

    The code snippet is part of the ST25R_SELFTEST. I would suggest to run as well the first part (" Check communication interface") of the ST25R_SELFTEST. The selftest code should be able to run after the power up but usually some additional commands are performed before the selftest. See RfalRfST25R3916Class::st25r3916Initialize(void) in https://github.com/stm32duino/ST25R3916/blob/main/src/st25r3916.cpp

    Rgds

    BT

     

     

    1 reply

    Technical Moderator
    May 14, 2025

    Hi,

    I would suggest to use the FW provided in https://github.com/stm32duino/ST25R3916 (this supports ST25R3916 series including ST25R3918).

    The code snippet is part of the ST25R_SELFTEST. I would suggest to run as well the first part (" Check communication interface") of the ST25R_SELFTEST. The selftest code should be able to run after the power up but usually some additional commands are performed before the selftest. See RfalRfST25R3916Class::st25r3916Initialize(void) in https://github.com/stm32duino/ST25R3916/blob/main/src/st25r3916.cpp

    Rgds

    BT

     

     

    Visitor II
    May 15, 2025

    Hello,

     

        Thanks for your suggestion, indeed I was missing:

     

    /* Set default state on the ST25R3916 */
    st25r3916ExecuteCommand(ST25R3916_CMD_SET_DEFAULT);

     

    now IRQ handling is ok, I can check irqs are triggered(for wake up timer for example).

    I would like  next to be able to read a tag and therefore get a EON interrupt.

    I have masked all other interrupts and left enabled only EON an EOF and enabled the prior configuration for passive target mode and ext field detector as stated in the rfalListenSetState() in rfal_rfst25r3916.cpp but there is no EON or EOF irq triggered and rfalIsExtFieldOn() never returns what is expected and when I dump registers:

    RSSI display reg(0x2D) is 0x00

    AUX display reg(0x31) is 0x12 so ext field is not on detected

     

    Do you think there is additional configuration might be missing?

     

    Thanks,

         Mihai

    Technical Moderator
    May 15, 2025

    Hi Mihai,

    can you describe in more details your use case? Is the ST25R3918 being used in Reader mode or in Card emulation mode? Which technology are being used: NFC-A? B? F? V? P2P? Do you use the stm32duino RFAL or only the ST25R3916 Hardware Abstraction Layer part of the RFAL?

    Rgds

    BT