Skip to main content
Visitor II
March 2, 2021
Solved

SPI interface for STM32L476VG

  • March 2, 2021
  • 185 replies
  • 63548 views

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?

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    X-CUBE-NFC5 package provides an NFC polling demo using the RFAL and running on NUCLEO-L476RG (MCU board) + X-NUCLEO-NFC05A1 (ST25R3911B expansion board). It can be a good starting point for a project based on SYM32L476VG.

    Rgds

    BT

    185 replies

    Technical Moderator
    March 10, 2021

    Hi,

    this looks like an HW/board issue. Make sure to verify the HW pin assignment and check that the ST25R3911B is properly powered.

    Rgds

    BT

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    Appreciate your efforts in replying to my queries patiently ..thanks for your support.

    will let you know once I do my H/W testing...keep you posted.

    regards

    Ravi

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    Just let me know if there any other configuaration issue..so that I can do and let you know.

    regards

    Ravi

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    attaching the defines for SPI_CS_PIN and SPI1_CS_GPIO_Port 

    #define SPI1_CS_Pin GPIO_PIN_4

    #define SPI1_CS_GPIO_Port GPIOA

    #define IRQ_3911_Pin GPIO_PIN_3

    #define IRQ_3911_GPIO_Port GPIOA

    just let me know if this also fine.

    rgrds

    Ravi

    Technical Moderator
    March 10, 2021

    Hi,

    well, I do not see PA4  (SPI1_CS) GPIO being configured... if it is not configured, then platformSpiSelect will have no effect, the SS will stay flat and the ST25R3911B will never reply... It should be configured in STM32CubeMX as Output Push-Pull, No pull up and no pull down, level Low, speed Low.

    Also PA3 (IRQ_3911) should be configured in interrupt rising mode. I've attached a reference IOC so that you can check you configuration.

    Rgds

    BT

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    attached is the main.c after changing to SPI_NSS_HARD_OUTPUT..still no values seen..currently I am not using PA3 to test basic SPI test.

    is that necessary now..i thought once basics are fine then enable INT and check..let me know.

    regards

    Ravi

    Technical Moderator
    March 10, 2021

    Hi,

    as explained in previous posts  hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT; is ***incorrect***... it should be  SPI_NSS_SOFT

    I still haven't seen any initialisation of PA4.

    Have you re generated from STM32CubeMX?

    Rgds

    BT

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    if this is configured as hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT; ***then PA4 is seen ***in STMcubeMx under GPIO settings and in main.c it reflects as

     hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT;

    if this is configured as hspi1.Init.NSS = SPI_NSS_SOFT then ;****PA4 is not seen ***in STMcubeMx under GPIO settings .

    I think this has to be hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT as this is chip select for SPI1...correct me if I am wrong.

    regards

    Ravi

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    let me know where PA4 initialization is to be seen...for me it is in cubeMx ..LET me know

    Technical Moderator
    March 10, 2021

    Hi Ravi,

    in RFAL, the SPI SS is managed by software. Therefore, the configuration has to be  hspi1.Init.NSS = SPI_NSS_SOFT and PA4 has to be configured in STM32CubeMX as GPIO_Output in the Pinout view and Output Push-Pull, No pull up and no pull down, level Low, speed Low in SystemCore->GPIO.

    Basically, you just need to replicate the configuration that I've sent to you in X-NUCLEO-NFC05A1.ioc.

    Rgds

    BT