cancel
Showing results for 
Search instead for 
Did you mean: 

ST25R3914/5 porting issue

cGosa.1
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
cGosa.1
Senior

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!

View solution in original post

20 REPLIES 20
Brian TIDAL
ST Employee

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

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.
cGosa.1
Senior

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.

Brian TIDAL
ST Employee

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

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.
cGosa.1
Senior

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.

Brian TIDAL
ST Employee

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

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.
cGosa.1
Senior

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 ) )

Brian TIDAL
ST Employee

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:

  • the ST253911B signal an interrupt by setting the IRQ pin to high
  • the MCU detects the rising edge on IRQ pin and calls its ISR. This ISR calls st25r3911Isr
  • st25r3911Isr calls st25r3911CheckForReceivedInterrupts and loops on st25r3911ReadMultipleRegisters until the IRQ pin returns low.
  • The IRQ pin returns low once the source of the interrupt has been read.

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

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.
cGosa.1
Senior

In platform.h I have set the platformGpioIsHigh () as (u1_Get_MCAL_Port_PinSts(port, pin) == GPIO_PIN_SET) for renesas .In porting of platformGpioIsHigh what else we have to take care?

I have attached the logic analyzer file of spi and interrupt.

Hi,

looking at the trace the SPI in the logic analyzer is incorrectly configured. Below picture has it properly configured (signals and trailing edge).0693W00000SvEpJQAV.pngIt 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