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
    May 26, 2021

    Hi BT,

    had a query in continuation with our zest to get RFID working using ST25R3911..In our custom board we are using 13.56 Mhz crystal..Now do you suggest us to add

     st25r3911WriteRegister(ST25R3911_REG_IO_CONF1, 0x00); this code to check whether crystal is working or not??...This code shoudl be added after

    st25r3911WriteRegister(ST25R3911_REG_OP_CONTROL, 0x00); this code right??..Kindly let us know.

    In custom board we are getting return 4 error means no INTERRUPT right??

    thanks and regards

    ravi

    RShiv.1Author
    Visitor II
    May 26, 2021

    Hi BT,

    any update on my previous query I had ..kindly let us know.

    regards

    Ravi

    Technical Moderator
    May 26, 2021

    Hi,

    as explained previously,  IO configuration register 1 (ST25R3911_REG_IO_CONF1) bit 3 has be configured in accordance with 13.56 or 27.12 MHz crystal. See ST25R3911B datasheet § 1.3.1 IO configuration register 1.

    So,

    • for a 27.12 MHz crystal, ST25R3911_REG_IO_CONF1 bit 3 has to be 1 which is the default reset value
    • for a 13.56 MHz crystal, ST25R3911_REG_IO_CONF1 bit 3 has to be 0. In that case, an explicit st25r3911WriteRegister(ST25R3911_REG_IO_CONF1, 0x00); is needed before st25r3911OscOn() in st25r3911Initialize().

    Then, Auxiliary display register (ST25R3911_REG_AUX_DISPLAY) bit 4 (osc_ok) indicates that Xtal oscillator is active and its output is stable. This is why I've suggested to add the following code at then end of st25r3911OscOn():

    /* Double check that OSC_OK signal is set */
     if( !st25r3911CheckReg( ST25R3911_REG_AUX_DISPLAY, ST25R3911_REG_AUX_DISPLAY_osc_ok, ST25R3911_REG_AUX_DISPLAY_osc_ok ) )
     {
     plateformLog("Osc not running\r\n");
     }

    The rational is to avoid to have to probe the crystal as the probe may affect the crystal behavior. If value of bit4 of Auxiliary display register is 0, then the crystal is not oscillating.

    Also, make sure your crystal respects the recommandation from the datasheet, in particular the ESRMax (equivalent series resistance max value) is 150 Ohm.

    You can as well check that the crystal has not been 90° rotated before being soldered on the PCB.

    Rgds

    BT

    RShiv.1Author
    Visitor II
    August 8, 2021

    Hi bidal,

    As we were trying to get the SPI working in case of STM32476VG and 407VE we successfully were able to get RFID working individually in separate chip.

    we were trying to integarte for one of our fingerprint sensor application along with RFID and when we integrate SPI init fails.attached is the document which explains the issue.Kindly throw some light on this.

    Thanks and regards

    Ravi

    Technical Moderator
    August 9, 2021

    Hi Ravi,

    yes, looks like an issue on your SPI2. Look into the registers of the corresponding GPIO block, look into SPI block, look into schematics of your boards, ...

    Better than on ST25 Forum you may get help on STM32 since it is clearly about the MCU and not the RF chip.

    Regards, Ulysses

    RShiv.1Author
    Visitor II
    August 9, 2021

    Hi ulysses,

    Thanks for the reply..we will look into this and get back to you if needed.

    regards

    Ravi