cancel
Showing results for 
Search instead for 
Did you mean: 

SPI interface for STM32L476VG

RShiv.1
Senior

STM32L476VG is the MCU we are interfacing with ST25R3911B using SPI.

what we have understood from some search is that we need RFAL (abstraction layer) to interface with RF HAL.

Then once we integrate RFAL and RF HAL in our system workbench(ac6) project we need to build the integration then use SPI calls to read the register from RFID reader ST25R3911B

we wanted to use ISO-14443A standard to be configured and read the values.

where do we get the basic RFAL work space or code flow so that we shall use in our current project?

Kindly guide us and let us know are we in right path?

190 REPLIES 190
Brian TIDAL
ST Employee

Hi Ravi,

the interrupt callbacks are located in stm32l4xx_it.c (file generated by STM32CubeMX). This is were you have to add the st25r3911Isr() in EXTI3_IRQHandler callback. See the stm32l4xx_it.c reference from X-CUBE-NFC5 and EXTI0_IRQHandle in this file (as EXTI line 0 is used in our reference code vs. EXTI line 3 in your case).

If you want to make sure the interrupt is properly configured, you can set a breakpoint in the st25r3911Isr.

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

Hi BT,

I have added the st25r3911Isr() in stm32l4xx_it.c file and flashed but still I am not seeing any interrupt print .

I have to get "platformLog("ISO14443A/Topaz (NFC-A ***) TAG found. UID: %s\r\n", hex2Str( nfcDevice->nfcid, nfcDevice->nfcidLen ) );" print for this RFID.I have also changed state to DEMO_ST_DISCOVERY but still not seeing any print.how can we check this in hardware or any change in S/W is required??

regards

Ravi

Brian TIDAL
ST Employee

Hi Ravi,

you should check with your hardware engineer with a scope connected to ST25R3911 IRQ pin.

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

Hi BT,

Thanks for the reply.Now once we check in the scope you need to get HIGH signal in the ST25R3911 pin,after this all the S/W configuarations are done..so I need to get the following print "platformLog("ISO14443A/Topaz (NFC-A ***) TAG found. UID: %s\r\n", hex2Str( nfcDevice->nfcid, nfcDevice->nfcidLen ) );..is this correct.

can I read the RFID value from this structure nfcDevice->nfcid???

regards

Ravi

Brian TIDAL
ST Employee

Hi,

as explained in the ST25R3911B datasheet, "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", therefore make sure to have the following configuration for the GPIO connected to the ST25R3911B IRQ:

0693W000008z715QAA.jpgThen, make sure to have the demoIni() being called only once in /* USER CODE BEGIN 2 */--/* USER CODE END 2 */ section (i.e. it shall ***not*** be in the while (1) loop). and then run the demoCycle() in the  /* USER CODE BEGIN WHILE */ --  /* USER CODE END WHILE */ section. See the reference main.c file.

Once a tag is discovered, its UID is stored in nfcDevice->nfcid and the UID Length is stored in nfcDevice->nfcidLen.

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

Hi BT,

1.Yes our configurations matches with what you have told..demoini is called only once outside while and inside while we are using democycle.

2.But we are seeing interrupt being generated once even without presenting our RFID ,after that when we present RFID we are seeing the INT

.Is there any changes that need to made to these confiurations

#define ST25R3911_REG_IO_CONF1_lf_clk_off           (1U<<0)

#define ST25R3911_REG_IO_CONF1_out_cl0            (1U<<1)

#define ST25R3911_REG_IO_CONF1_out_cl1            (1U<<2)

#define ST25R3911_REG_IO_CONF1_mask_out_cl          (3U<<1)

#define ST25R3911_REG_IO_CONF1_osc              (1U<<3)

#define ST25R3911_REG_IO_CONF1_fifo_lt            (1U<<4)

#define ST25R3911_REG_IO_CONF1_fifo_lt_32bytes        (0U<<4)

#define ST25R3911_REG_IO_CONF1_fifo_lt_16bytes        (1U<<4)

#define ST25R3911_REG_IO_CONF1_fifo_lr            (1U<<5)

#define ST25R3911_REG_IO_CONF1_fifo_lr_64bytes        (0U<<5)

#define ST25R3911_REG_IO_CONF1_fifo_lr_80bytes        (1U<<5)

#define ST25R3911_REG_IO_CONF1_rfo2              (1U<<6)

#define ST25R3911_REG_IO_CONF1_single             (1U<<7)

Let me know what changes need to be made on these which are there in st25r3911_com.h ...

Any other registers which we need to crosscheck kindly let us know.

Thanks and regards

Ravi

RShiv.1
Senior

Hi BT,

changes made

But we are seeing interrupt being generated once even without presenting our RFID ,after that when we present RFID we are not seeing the INT

Brian TIDAL
ST Employee

Hi Ravi,

There is no need to change anything in st25r3911_com.h. Please do not modify it.

There are a lot of interrupt conditions in the ST25R3911B so this is normal to have interrupts even without a tag being present in the field. As explained, the ST25R3911B is an RFID frontend so it signals to the MCU some conditions (such as  oscillator frequency is stable) through interrupt.

Basically, the SPI and the interrupt are functional. You should be able to read a tag. If you do no succeed to read a tag, this means you probably have an antenna issue. This should be checked by your HW engineer.

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

Hi BT,

After connecting to antenna we are seeing following observations

  1. we are not seeing any waveform when we put demoini() function outside the while loop, basically antenna is not getting trigerred.
  2. when we put demoini() function inside the while loop then we are seeing antenna oscialltions regularly in every 2 sec once

But we are not seeing any RFID value being read from the driver

RShiv.1
Senior

Hi BT,

messages to UART