Skip to main content
Graduate
April 1, 2024
Solved

Porting ST25R3916B software to nRF5340

  • April 1, 2024
  • 2 replies
  • 1922 views

Hi,

I want to use ST25R3916B with nRF5340 from nordic semiconductor. The software for ST25R3916B is written mainly for STM32 MCUs. How can I port the software to nRF5340? How can I start at all?

 

Thanks.

https://www.st.com/en/embedded-software/x-cube-nfc6.html

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

    Hi,

    the RFAL uses 3 function-like macros for the SPI defined in rfal_platform.h:

    • platformSpiSelect()
    • platformSpiDeselect()
    • platformSpiTxRx( txBuf, rxBuf, len )

    and one macro:

    • ST25R_COM_SINGLETXRX

    The RFAL does not care about the SPI pins and only uses those 3 function-like macros for the SPI communication. The SPI has to be configured inside the porting glue.

    If the Select pin is managed in frame mode by your SPI hardware, define ST25R_COM_SINGLETXRX and define platformSpiSelect/platformSpiDeselect as empty.

    If theSelect pin is managed by software, redirect platformSpiSelect/platformSpiDeselect to the GPIO management function to set the Select pin low or high.

    The platformSpiTxRx has to be redirected to the nRF SPI transceive function.

    Rgds

    BT

     

    2 replies

    Technical Moderator
    April 2, 2024

    Hi,

    The ST25R3916 RF Abstraction Layer (RFAL) is a scalable and portable C language source code library. It can be ported on many ST or non-ST MCU.

    A rfal_platform.h file is used to configure the various protocols for a given application and is used to define the interface to the external services (timer, SPI communication, log, etc.). See UM2890 RF/NFC abstraction layer (RFAL).

    Rgds

    BT

    Graduate
    April 4, 2024

    Thank you, I read the UM and have some questions:
    In RFAL, SPI pins and SS pin are configured, but nRF SDK uses device-tree for device configurations, and SPI device is added as device-tree overlay.
    For example:
    https://github.com/nrfconnect/sdk-nrf/tree/main/samples/nfc/tag_reader
    The line in https://github.com/nrfconnect/sdk-nrf/blob/main/lib/st25r3911b/st25r3911b_spi.c#L21  gets SPI device from device-tree overlay.

    How can I configure SPI devices in RFAL as device-tree overlays in nRF SDK?

    Super User
    April 4, 2024

    Implement platformSpiTxRx() using the device-tree approach?

    Technical Moderator
    April 4, 2024

    Hi,

    the RFAL uses 3 function-like macros for the SPI defined in rfal_platform.h:

    • platformSpiSelect()
    • platformSpiDeselect()
    • platformSpiTxRx( txBuf, rxBuf, len )

    and one macro:

    • ST25R_COM_SINGLETXRX

    The RFAL does not care about the SPI pins and only uses those 3 function-like macros for the SPI communication. The SPI has to be configured inside the porting glue.

    If the Select pin is managed in frame mode by your SPI hardware, define ST25R_COM_SINGLETXRX and define platformSpiSelect/platformSpiDeselect as empty.

    If theSelect pin is managed by software, redirect platformSpiSelect/platformSpiDeselect to the GPIO management function to set the Select pin low or high.

    The platformSpiTxRx has to be redirected to the nRF SPI transceive function.

    Rgds

    BT