cancel
Showing results for 
Search instead for 
Did you mean: 

Porting ST25R3916B software to nRF5340

kahlenberg
Associate II

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 discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

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

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Brian TIDAL
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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?

Implement platformSpiTxRx() using the device-tree approach?

Brian TIDAL
ST Employee

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

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.