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

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    Now configured as GPIO_output and I am seeing PA4 initialization but still not seeing any values.

    My spireadregister syntax looks fine right ..kindly let me know

    regards

    Ravi

    Technical Moderator
    March 10, 2021

    Hi,

    the SW configuration seems ok. By the way, I believe platformLog should also work.

    It's time now to check the HW.

    Rgds

    BT

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    attaching my IOC file ..let me know

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    for platform log

    #define platformLog(...)               logUsart(__VA_ARGS__)    

    I need to use USE_LOGGER ..I have added the define ...I need to use LOGGER_ON I guess.

    --Ravi

    Technical Moderator
    March 10, 2021

    Hi,

    yes, as explained in one of the first answers:

    • add the proper defines (USE_HAL_DRIVER,STM32L476xx,USE_LOGGER,ST25R3911) in your configuration.

    Rgds

    BT

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    we are checking from H/W side..as we have done evrything from S/W I guess

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    once I initialized LOGGER_ON..I am seeing platformLog("Initialization failed..\r\n"); message in UART..that means RFAL initlaize has not happened I guess.

    let me know if I need to do anything more

    regards

    Ravi

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    I think the I found the issue let me know where to change the configuarations

    1. when demoINI is called rfalNfcInitialize () is called but in ac6 when ctrl _click is done to navigate the code this is not going to rfal_nfc.c file instead going to rfal_nfc.h
    2. In rfalNfcInitialize , rfalAnalogConfigInitialize() func is called and I could not navigate to rfalAnalogConfigInitialize using ac6
    3. here I am seeing unreolved symbols rfalAnalogConfigDefaultSettings,rfalAnalogConfigDefaultSettings

    seems like the .C and linking issue in ac6..I have added the folder from pathand symbols as done yesterday...

    where do we now need to change to that RFAL is initialized and get the message

    I think we need to resolve this before going to democycle or even SPIWRite ,SPIread I guess

    Kindly let me know

    regards

    Ravi

    Technical Moderator
    March 10, 2021

    Hi,

    I don't think this is the issue.

    I guess this shows the declaration of the function and therefore open the .h file.

    Rgds

    BT

    RShiv.1Author
    Visitor II
    March 10, 2021

    Hi BT,

    Then why we are seeing platformLog("Initialization failed..\r\n"); message in UART ....demoINI should have passed ...we are seeing this.

    regards

    Ravi

    Technical Moderator
    March 10, 2021

    Hi Ravi,

    demoIni() runs the rfalInitialize() that runs the st25r3911CheckChipID() that needs a functional SPI to communicate with the ST25R3911B and retrieve the chipID. As the SPI is not functional, the chipID register is not properly returned and st25r3911CheckChipID() returns false and thus rfalInitiliaze() returns ERR_HW_MISMATCH. You just need to put a breakpoint in rfalInitiliaze and see that it will return an error.

    Therefore demoIni is likely to fail as long as the SPI is not functional. By the way, this is why I have suggested in one of the previous posts to have the SPI read write test before the demoIni() rather than inside the while (1) loop.

    I suggest you connect a logic analyzer on the SPI (MISO, MOSI, SS and CLK) and debug this issue with your HW engineer.

    Rgds

    BT