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

for testing the SPI, just add the following code in main.c line 127 before the call to demoIni()

 st25r3911WriteRegister( ST25R3911_REG_BIT_RATE, ST25R3911_TEST_REG_PATTERN );
 if( !st25r3911CheckReg( ST25R3911_REG_BIT_RATE, (ST25R3911_REG_BIT_RATE_mask_rxrate | ST25R3911_REG_BIT_RATE_mask_txrate), ST25R3911_TEST_REG_PATTERN ) )
{
  platformLog("SPI test failed...\r\n");
  while (1);
}
platformLog("SPI communication OK...\r\n");

make sure to remove st25r3911WriteRegister( ST25R3911_REG_BIT_RATE, ST25R3911_TEST_REG_PATTERN ); in line 196 (after demoCycle)

Connect a serial terminal on virtual com port and check the output log.

Once the SPI communication is OK, make sure to st25r3911Isr(); being called in the EXTIxxxxx_IRQHandler interrupt call back as explained in one of the previous posts.

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 tried with adding the code ..also attached is the main.c I could not use platformlog...I have used UARTMSG4 ...kindly have a look...It is saying SPI failed.

I flashed into the hardware and I got this msg.kindly let me know.

regards

Ravi

RShiv.1
Senior

Hi BT,

I tried doing

st25r3911WriteRegister( ST25R3911_REG_BIT_RATE, ST25R3911_TEST_REG_PATTERN );

and then st25r3911ReadTestRegister(buf2,val); I have attached the code ..kindly let me know where the problem is ..I am not getting value 0xx33 when I read...

also SPI is failing...kindly guide me

regards

Ravi

Brian TIDAL
ST Employee

Hi Ravi,

the SPI configuration is not correct. In STM32CubeMX, the SPI configuration should be:

0693W000008wNT0QAM.png(make sure to adjust the prescaler value according to your clock frequency to keep the SPI speed under or equal to 6 Mbps)

See also MX_SPI1_Init in the reference project for proper value if you want then to check the generated code.

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 tried changing the parameters..but I am getting following warning

    These IPs still have some not configured or wrong parameter values:

[STMicroelectronics.X-CUBE-NFC4.2.0.2, Verify the Platform Settings Tab ]   

where will I get platform setting tab for this??

regards

Ravi

RShiv.1
Senior

Hi BT,

I tried going forward with warning but STMcubeMx generated folder called as NFC which has custom_nfc04a1.c ,should we need this

In file included from ../NFC/custom_nfc04a1.c:57:0:

../NFC/custom_nfc04a1.h:49:10: fatal error: st25dv_conf.h: No such file or directory

and I am seeing following error message.Kindly let me know.

regards

Ravi

RShiv.1
Senior

Hi BT,

Under software pack -> manage software packages ->x-cube-NFC4 2.02 and 2.0.1 is showing as green ..whereas in select componens ..it says unreolvable dependencies.is there any issue which is causing this problem??..Thanks for all your support..we just want SPI functionality to be up..kindly guide us.

regards

Ravi

RShiv.1
Senior

Hi BT,

I need to undo NFC packages in cubeMx which is for dynamic tags ...how shall I undo this so that I shall move on??

regards

Ravi

RShiv.1
Senior

Hi BT,

attached is the ioc I am using..if you can revert the changes and let me know how I can port this will be useful.

regards

Ravi

Brian TIDAL
ST Employee

Hi Ravi,

I would personally restart from scratch.

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.