2022-09-12 12:08 AM
We are trying to interface ST25R3914/5 NFC reader IC with another microcontroller through SPI communication. But while the ST NFC reader IC is not able to detect the card.
Can you please tell what all steps are to be considered before interfacing NFC I
Solved! Go to Solution.
2022-09-19 12:11 AM
Hello,
After checking it was interrupt priority issue also the stack code was disabling interrupt so after enabling interrupt from st25r3911_com.c file it is working properly and I am able to detect data.
Thanks for your support!
2022-09-12 12:42 AM
Hi
if you are using the RFAL FW, you can enable ST25R_SELFTEST and ST25R_SELFTEST_TIMER switches to check that the porting to your MCU is properly functional. My guess is that the ST25R3914 IRQ is not properly handled by the MCU. Once the ST25R_SELFTEST and ST25R_SELFTEST_TIMER are enabled, I suggest to set a breakpoint in st25r3911Initialize and to step through the code around the ifdef ST25R_SELFTEST
Rgds
BT
2022-09-12 02:10 AM
We have used RFAL stack . the demoInit() function is getting called so the initialisation is happening but the democycle() function is not getting called as the interrupt pin is always in low state. from where these ST25R_SELFTEST and ST25R_SELFTEST_TIMER switches can be enabled.
2022-09-12 02:33 AM
Hi,
"We have used RFAL stack": Do you use X-CUBE-NFC5 package or ST25 embedded NFC library or RFAL for ST25R3911B package? What is your HW setup: custom board with MCU + ST25R3911B or MCU board connected to X-NUCLEO-NFC05A1? Which MCU is being used in your application?
"the democycle() function is not getting called" ==> this means demoInit() returns an error. Set a breakpoint in st25r3911Initialize and step in up to the error code.
"from where these ST25R_SELFTEST and ST25R_SELFTEST_TIMER switches can be enabled?" ==> just add ST25R_SELFTEST and ST25R_SELFTEST_TIMER as global defines at compiler level.
"the interrupt pin is always in low state" : make sure to configure the GPIO as no-pull-up/no-pull-down / External Interrupt with rising edge detection
Rgds
BT
2022-09-12 02:43 AM
We have used RFAL for ST25R3911B package.
HW Setup : Custom board(Renesas Rl78 microcontroller + ST 25R3914
DemoInit() function is getting called successfully. After that we are trying to call st25r3911Isr() through renesas interrupt handler but this function is not getting called as interrupt is not coming from NFC IC.
2022-09-12 03:03 AM
Hi,
I guess you have used demoIni and demoCycle from another package as this is not provided in RFAL for ST25R3911B package. I usually recommend to use ST25 embedded NFC library as this provides complete up to date demos (and includes the latest RFAL and provides a platform.h file). Make sure to use the demoIni and demoCycle from ST25 embedded NFC library as this checks the consistency between the discovery parameters and the platform.h configuration.
But first of all, let's make sure that SPI and IRQ is properly working. Once ST25R_SELFTEST and ST25R_SELFTEST_TIMER are enabled, check the return code of st25r3911Initialize
Rgds
BT
2022-09-12 04:11 AM
Yes we platform.h file is also there as per that we did configuration for spi and interrupt.
After enabling ST25R_SELFTEST and ST25R_SELFTEST_TIMER I have checked the st25r3911Initialize() is getting initialised also the demoinit function returns true.
Inside st25r3911Isr() function there is function for checking received interrupts st25r3911CheckForReceivedInterrupts() here only the breakpoint does not go to condition where level triggered int is received.
In case the IRQ is Edge (not Level) triggered read IRQs until done */
//while( platformGpioIsHigh( ST25R391X_INT_PORT, ST25R391X_INT_PIN ) )
2022-09-12 05:30 AM
Hi,
When an interrupt condition is met the source of interrupt bit is set in the Main interrupt register and the IRQ pin transitions to high. The microcontroller then reads the Main interrupt register to distinguish between different interrupt sources.. IRQ pin transitions to low after the interrupt bit(s) that caused its transition to high has (have) been read.
So, when the MCU calls the ISR, the interrupt pin is supposed to be high and it will be reset to low only once the interrupt registers have read. I would suggest to check the porting of platformGpioIsHigh and to check the GPIO configuration (no pull up/down in the configuration and no pull up/down resistor on the physical line)
The expected sequence is the following:
I also suggest to connect a logic analyzer on SPI (CLK/MOSI/MISO/CS) + IRQ so that I can investigate from your trace.
Rgds
BT
2022-09-12 11:55 PM
2022-09-13 01:01 AM
Hi,
looking at the trace the SPI in the logic analyzer is incorrectly configured. Below picture has it properly configured (signals and trailing edge).It also shows that the interrupt service routine is not being executed (INT line gets cleared by masking the interrupts(15-ff). The routine seems to try to enable the field repeatedly.
Better to concentrate only on the initialization routine in the beginning.
BR, Ulysses