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 PA4 (SPI1_NSS) GPIO is not configured. It should be configured as Output Push-Pull, No pull up and no pull down, level Low, speed Low. I suggest also to check with your HW engineer that PA4 is properly connected to the /SS pin of the ST25R3911B.

Also, make sure to have the ST25R_SS_PIN  and ST25R_SS_PORT configured for PA4 in platform.h (refer to the demo project where this is configured for PB6, see main.h for defines generated by STM32CubeMX).

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 changed the SPI1_NSS to output psuh-pull, and also I have changed the correponding pin4 for PA4 and GPOIA.

I have attached the changes .

rgrds

Ravi

RShiv.1
Senior

Hi BT,

I am also attaching main.c where

st25r3911WriteRegister( buf2, ST25R3911_TEST_REG_PATTERN );

HAL_Delay(1000);

st25r3911ReadTestRegister(buf2,val);

is the syntax correct?...because we need to send a reg according to the function..just wanted to crosscheck on syntax.

first wanted to read write the register...

rgrds

Ravi

RShiv.1
Senior

Hi BT,

I had used st25r3911ReadTestRegister instead of st25r3911ReadRegister. also I have changed the mode

 st25r3911WriteRegister( ST25R3911_REG_MODE, ST25R3911_TEST_REG_PATTERN );

   HAL_Delay(1000);

  st25r3911ReadRegister(ST25R3911_REG_MODE,&val);

Let me know if this is correct.

rgrds

Ravi

RShiv.1
Senior

Hi BT,

Now I am getting output val in val reg as 0xFF

Hi,

this is not in accordance with the st25r3911WriteRegister and therefore this is incorrect. .

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.
Brian TIDAL
ST Employee

Hi Ravi,

any reason not to use what we have suggested in previous posts for testing register read/write i.e writing a test pattern in ST25R3911_REG_BIT_RATE and reading back the value?

Anyway, obviously the SPI seems to be non operational.

Can you check with your HW engineer the pin assignment between the MCU and the ST25R3911B? Can you describe in details your HW setup: is it a custom board with the MCU and the ST25R3911B or do you use a X-NUCLEO_NFC05A1 connected to the MCU through wire jumpers? Can you connect a logic analyzer on the SPI (SPI CLK, SPI MOSI, SPI MISO and SPI SS) and check the signals?

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,

Now I tested with ST25R3911_REG_BIT_RATE  and SPI read register...then also I got 0xFF.

yes this is a custom board with STM32L476VG(MCU) connected to ST25R3911B...The custom board is already there to use and all SPI connections are already done.

will test the signals and let you know.

regards

Ravi

Brian TIDAL
ST Employee

Hi Ravi,

Can you recheck the SPI configuration as it seems that CPHA=1Edge has been used instead of CPHA=2Edge. NSSP is also not having the proper value: it should be disabled. Also, as you system clock seems to be 4MHz (vs 48MHz in the demo), I believe the SPI prescaler can be set to 2 to reach 2Mbps.

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,

even I changed these values..still not seeing any values ..attaching main.c..let me know if there are any changes.

regards

Ravi