2025-05-14 7:54 AM
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
Solved! Go to Solution.
2025-05-14 8:59 AM
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
2025-05-14 8:59 AM
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
2025-05-15 1:50 AM
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
2025-05-15 4:23 AM
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
2025-05-15 5:27 AM
Hello BT,
I want to use st25r3918 in reader mode, tags are ISO15693 so NFC-V.
I am not using directly neither the RFAL lib or the st25r3916 arduino lib (which seems the same as the stm32cubeIDE one) because I had some issues with basic I2c communication using the RFAL lib/rfid driver that I have mentioned in another post and I am currently using Wire lib for all i2c transactions on Arduino.
Cannot read chip ID for ST25R3918 - STMicroelectronics Community
I am more confident using Wire lib until I validate nfc reader operation that I can try to integrate the rfal libs alltogether
So I am checking both the st25r3916 lib(for initialization, i2c communication) and the rfal lib(for all config/modes/interrupt related configuration) and translate them in Wire lib commands(for direct commands. and read/write registers on i2c)
Thanks,
Mihai
2025-05-16 1:56 AM
Hello BT,
I have found this thread with your replies:
Solved: st25r3911b - simple code - STMicroelectronics Community
so I assume that case applies to me too? I need to use the RFAL lib in arduino, cannot expect just using Wire lib i2c commands that will be able to get a nfc irq and read the tag, right?
Thanks,
Mihai
2025-05-16 2:01 AM
Hi Mihai,
if you want to use the st25r3918 in reader mode in front of ISO15693 tags, why do you expect to have an I_eon interrupt and why configuring the reader in passive target mode? When communicating with a tag, only the NFC reader generates the RF field, and the tag uses this field to power itself and communicate.
The RFAL provides support for NFC communication and demo applications provide ready to use applications that can be customized. Using the RFAL is highly recommended.
Rgds
BT
2025-05-16 3:22 AM
Hello BT,
Thanks for your reply.
Yes I figured out since yesterday then no need to configure passive target mode, that is for emulation card.
However even in reader mode there should be no interrupt expected? I thought I saw in rfal examples how rfalIsExtFieldOn() was checking for the i_eon irq. My understanding is that I have to check for external detector. Or it's not correct?
I did not use RFAL because of repeated start issues I had with i2c that I have mentioned in a separate post.
But will try to use RFAL lib in ARduino.
Thanks,
Mihai
2025-05-16 4:52 AM
Hi,
before generating an RF field, an NFC Forum device such as a Reader has to perform an RF collision avoidance to prevent interference between multiple NFC readers operating in close proximity. This is achieved by sensing the field before turning the field on.
"However even in reader mode there should be no interrupt expected?" There is some misunderstanding here. The ST25R3918 is an NFC Analog Front End. The MCU configures the ST25R3918 by writing into registers and triggers actions through direct commands. For instance, the MCU sets the 'Operation Control Register' en bit to 1 to activate the oscillator and regulator. When the oscillator stabilizes, the device issues an I_osc interrupt to notify the MCU. Subsequently, the MCU's state machine can proceed to the next step.
"I did not use RFAL because of repeated start issues I had with i2c": the default value of endTransmission() is true which causes the sending of a Stop and the release of the I2C bus. If false, endTransmission(false) sends a restart message after transmission and the bus will not be released. Do not hesitate to ask support on https://forum.arduino.cc/c/projects/libraries/. Also connect a logic analyzer and send us the trace.
Rgds
BT