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
    April 21, 2021

    Hi BT,

    attached the main.c

    RShiv.1Author
    Visitor II
    April 21, 2021

    for my understanding I have put the platformLog("inside rfalNfcActivated\r\n"); print.

    My expected print is

    case RFAL_NFCA_***:

                    platformLog("ISO14443A/Topaz (NFC-A ***) TAG found. UID: %s\r\n", hex2Str( nfcDevice->nfcid, nfcDevice->nfcidLen ) );

                   

    Kindly let me know if I am in right path

    regards

    Ravi

    RShiv.1Author
    Visitor II
    April 21, 2021

    Hi BT,

    also now the oscillations are seen in the antenna side once when we connect to the scope...we are seeing this

    Ravi

    Technical Moderator
    April 21, 2021

    Hi Ravi,

    I had a look to your files.

    In main.c, as already recommended in previous posts, please remove the test code (st25r3911WriteRegister and st25r3911CheckReg on ST25R3911_REG_BIT_RATE, lines 190 to 195) otherwise the value of this register would be unexpectedly modified between 2 demoCycle loops.

    In demo.c, please uncomment lines 266 and 267. Your modification is preventing the polling loop to start. If you do not have leds, I would suggest to empty the definition of platformLedOff( port, pin )  and platformLedOn( port, pin ) inside plateform.h rather than commenting the code in demo.c

    You are closer and closer.

    Rgds

    BT

    RShiv.1Author
    Visitor II
    April 21, 2021

    Hi BT,

    I have made changes in main.c and also uncommented the lines 266 and 267...attached is demo.c

    also I have changes the #define such that it is dummy 0 for all ,platformLedOff( port, pin ) ..but still not seeing any value .kindly let me know

    RShiv.1Author
    Visitor II
    April 21, 2021

    Hi BT,

    attached is the main.h where the defines are pointed

    Technical Moderator
    April 22, 2021

    HI,

    can you attach a logic analyzer on SPI(CLK, SS, MISO, MOSI) and ST253911_IRQ and provide a trace to me?

    which tag do you use for your tests?

    Thanks

    Rgds

    BT

    RShiv.1Author
    Visitor II
    April 22, 2021

    Hi BT,

    Our tag is ISO14443A

    RFAL_NFCA_***:

                    platformLog("ISO14443A/Topaz (NFC-A ***) TAG found. UID: %s\r\n", hex2Str( nfcDevice->nfcid, nfcDevice->nfcidLen ) );

    This is the print val I am expecting...will send you the SPI and IRQ trace.

    regards

    Ravi

    RShiv.1Author
    Visitor II
    April 22, 2021

    Hi BT,

    Attached are the images of SPI_CLK,MISO,MOSI,CS and IRQ.Kindly let us know any other changes which needs to be done.

    thanks and regards

    Ravi

    Technical Moderator
    April 22, 2021

    Hi,

    images of SPI_CLK,MISO,MOSI,CS and IRQ do not help as this is not a logic analyzer trace. A logic analyzer records data and decodes protocols (such as SPI), so that I can analyze.

    If you do not have a logic analyzer, you will have to enter into the code and debug. In that case, print the return code of rfalNfcaPollerCheckPresence.

    Rgds

    BT