cancel
Showing results for 
Search instead for 
Did you mean: 

about MCU drivers firmware for ST25R3916

DSai.1
Associate III

Dear Sir,

We are going to write a ST25R3916 driver (only support SO15693) for our platform which use ThreadX RTOS. As a porting reference, could you tell me where I can get the source code of ST25R3916 driver?

best regards

Dai Sai

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Dear Dai,

I would suggest to use the ST25NFC_Embedded_Lib_ST25R3916_1.4.0\Projects\STM32L476RG-Nucleo\Applications\X-NUCLEO-NFC06A1\FreeRTOS_polling demo from STSW-ST25R016 (ST25 embedded NFC library for ST25R3916 reader and tag products 1.4.0). It is based on the same RFAL version than STSW-ST25RFAL002 (RFAL for ST25R3916ST 2.6.0) but includes an NFC polling demo showing how to use the RFAL API.

Basically, you'll have to include in your project the files from ST25NFC_Embedded_Lib_ST25R3916_1.4.0\Middlewares\ST\RFAL and ST25NFC_Embedded_Lib_ST25R3916_1.4.0\Middlewares\ST\RFAL\source\st25r3916.

In order to use only ISO 15693, you just need to customise the platform.h as follow:

#define RFAL_FEATURE_LISTEN_MODE               false      /*!< Enable/Disable RFAL support for Listen Mode                               */
#define RFAL_FEATURE_WAKEUP_MODE               false      /*!< Enable/Disable RFAL support for the Wake-Up mode                          */
#define RFAL_FEATURE_LOWPOWER_MODE             false      /*!< Enable/Disable RFAL support for the Low Power mode                        */
#define RFAL_FEATURE_NFCA                      false      /*!< Enable/Disable RFAL support for NFC-A (ISO14443A)                         */
#define RFAL_FEATURE_NFCB                      false      /*!< Enable/Disable RFAL support for NFC-B (ISO14443B)                         */
#define RFAL_FEATURE_NFCF                      false      /*!< Enable/Disable RFAL support for NFC-F (FeliCa)                            */
#define RFAL_FEATURE_NFCV                      true       /*!< Enable/Disable RFAL support for NFC-V (ISO15693)                          */
#define RFAL_FEATURE_T1T                       false      /*!< Enable/Disable RFAL support for T1T (Topaz)                               */
#define RFAL_FEATURE_T2T                       false      /*!< Enable/Disable RFAL support for T2T                                       */
#define RFAL_FEATURE_T4T                       false      /*!< Enable/Disable RFAL support for T4T                                       */
#define RFAL_FEATURE_ST25TB                    false      /*!< Enable/Disable RFAL support for ST25TB                                    */
#define RFAL_FEATURE_ST25xV                    true       /*!< Enable/Disable RFAL support for  ST25TV/ST25DV                            */
#define RFAL_FEATURE_DYNAMIC_ANALOG_CONFIG     false      /*!< Enable/Disable Analog Configs to be dynamically updated (RAM)             */
#define RFAL_FEATURE_DPO                       false      /*!< Enable/Disable RFAL Dynamic Power Output support                          */
#define RFAL_FEATURE_ISO_DEP                   false      /*!< Enable/Disable RFAL support for ISO-DEP (ISO14443-4)                      */
#define RFAL_FEATURE_ISO_DEP_POLL              false      /*!< Enable/Disable RFAL support for Poller mode (PCD) ISO-DEP (ISO14443-4)    */
#define RFAL_FEATURE_ISO_DEP_LISTEN            false      /*!< Enable/Disable RFAL support for Listen mode (PICC) ISO-DEP (ISO14443-4)   */
#define RFAL_FEATURE_NFC_DEP                   false      /*!< Enable/Disable RFAL support for NFC-DEP (NFCIP1/P2P)                      */

In the FreeRTOS port, we have a dedicated ISR task to manage the ST25R3916 interrupt (see nfcIsrTaskRunner). This task waits for a notification of the ST25R3916 interrupt and calls st25r3916Isr() I believe, a dedicated thread can be used in ThreadX RTOS port for managing the ST25R3916 interrupt. Make sure to implement platformProtectST25RComm and platformUnprotectST25RComm macros (in FreeRTOS, this is a simple enter/exit critical section).

For the timer management, I would suggest to have a look on plfTimerXXX fonction in plf_adaptation.c and try to port in a similar way to ThreadX RTOS.

The main task runs the polling demo initialization and then loops forever on the NFC polling. I believe, it can be ported in a similar way to ThreadX RTOS

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

8 REPLIES 8
Brian TIDAL
ST Employee

Hi,

the ST25 embedded NFC library provides an example of ST25R3916 RF Abstraction Layer (RFAL) porting on FreeRTOS. It should be a good starting point for porting to ThreadX RTOS.

The ST25R3916 RF Abstraction Layer (RFAL) is a scalable and portable C language source code library. A 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.).

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.
DSai.1
Associate III

Dear Brian TIDAL,

Thank you very much for your quick reply.

Based on your advise, I found two RFAL source in St.com.

One is

STSW-ST25R016ST25 embedded NFC library for ST25R3916 reader and tag products1.4.0,

another one is

STSW-ST25RFAL002RFAL for ST25R3916ST2.6.0

Is the second one :STSW-ST25RFAL002RFAL the newest version and fit for my purpose?

In the library package, I found only four source files that contain keyword of 15693.

Should I start to port from them?

best regards

Dai

DSai.1
Associate III

supplement for the above message.

I forgot to write the four files name.

The four files are

rfal_nfcv.h, rfal_nfcv.c, rfal_iso15693_2.h, rfal_iso15693_2.c

Brian TIDAL
ST Employee

Dear Dai,

I would suggest to use the ST25NFC_Embedded_Lib_ST25R3916_1.4.0\Projects\STM32L476RG-Nucleo\Applications\X-NUCLEO-NFC06A1\FreeRTOS_polling demo from STSW-ST25R016 (ST25 embedded NFC library for ST25R3916 reader and tag products 1.4.0). It is based on the same RFAL version than STSW-ST25RFAL002 (RFAL for ST25R3916ST 2.6.0) but includes an NFC polling demo showing how to use the RFAL API.

Basically, you'll have to include in your project the files from ST25NFC_Embedded_Lib_ST25R3916_1.4.0\Middlewares\ST\RFAL and ST25NFC_Embedded_Lib_ST25R3916_1.4.0\Middlewares\ST\RFAL\source\st25r3916.

In order to use only ISO 15693, you just need to customise the platform.h as follow:

#define RFAL_FEATURE_LISTEN_MODE               false      /*!< Enable/Disable RFAL support for Listen Mode                               */
#define RFAL_FEATURE_WAKEUP_MODE               false      /*!< Enable/Disable RFAL support for the Wake-Up mode                          */
#define RFAL_FEATURE_LOWPOWER_MODE             false      /*!< Enable/Disable RFAL support for the Low Power mode                        */
#define RFAL_FEATURE_NFCA                      false      /*!< Enable/Disable RFAL support for NFC-A (ISO14443A)                         */
#define RFAL_FEATURE_NFCB                      false      /*!< Enable/Disable RFAL support for NFC-B (ISO14443B)                         */
#define RFAL_FEATURE_NFCF                      false      /*!< Enable/Disable RFAL support for NFC-F (FeliCa)                            */
#define RFAL_FEATURE_NFCV                      true       /*!< Enable/Disable RFAL support for NFC-V (ISO15693)                          */
#define RFAL_FEATURE_T1T                       false      /*!< Enable/Disable RFAL support for T1T (Topaz)                               */
#define RFAL_FEATURE_T2T                       false      /*!< Enable/Disable RFAL support for T2T                                       */
#define RFAL_FEATURE_T4T                       false      /*!< Enable/Disable RFAL support for T4T                                       */
#define RFAL_FEATURE_ST25TB                    false      /*!< Enable/Disable RFAL support for ST25TB                                    */
#define RFAL_FEATURE_ST25xV                    true       /*!< Enable/Disable RFAL support for  ST25TV/ST25DV                            */
#define RFAL_FEATURE_DYNAMIC_ANALOG_CONFIG     false      /*!< Enable/Disable Analog Configs to be dynamically updated (RAM)             */
#define RFAL_FEATURE_DPO                       false      /*!< Enable/Disable RFAL Dynamic Power Output support                          */
#define RFAL_FEATURE_ISO_DEP                   false      /*!< Enable/Disable RFAL support for ISO-DEP (ISO14443-4)                      */
#define RFAL_FEATURE_ISO_DEP_POLL              false      /*!< Enable/Disable RFAL support for Poller mode (PCD) ISO-DEP (ISO14443-4)    */
#define RFAL_FEATURE_ISO_DEP_LISTEN            false      /*!< Enable/Disable RFAL support for Listen mode (PICC) ISO-DEP (ISO14443-4)   */
#define RFAL_FEATURE_NFC_DEP                   false      /*!< Enable/Disable RFAL support for NFC-DEP (NFCIP1/P2P)                      */

In the FreeRTOS port, we have a dedicated ISR task to manage the ST25R3916 interrupt (see nfcIsrTaskRunner). This task waits for a notification of the ST25R3916 interrupt and calls st25r3916Isr() I believe, a dedicated thread can be used in ThreadX RTOS port for managing the ST25R3916 interrupt. Make sure to implement platformProtectST25RComm and platformUnprotectST25RComm macros (in FreeRTOS, this is a simple enter/exit critical section).

For the timer management, I would suggest to have a look on plfTimerXXX fonction in plf_adaptation.c and try to port in a similar way to ThreadX RTOS.

The main task runs the polling demo initialization and then loops forever on the NFC polling. I believe, it can be ported in a similar way to ThreadX RTOS

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.
DSai.1
Associate III

Dear Brian TIDAL,

Thank you very much for your valuable information and useful suggestion about the library and

porting approach.

Based on your suggestion, We will try to develop and realize the function of ISO15693 reader and writer

on our ThreadX platform.

. best reagards

Dai Sai

DSai.1
Associate III

Dear Brian TIDAL,

As we are reading the source code of the FreeRTOS example you suggested, we can not find ndefExampleRead() and ndefExampleWrite() that are used in void demoCycle( void ).

Could you like to give me some information about them?

best regards

Dai Sai

Brian TIDAL
ST Employee

Dear Dai,

the ST25NFC_Embedded_Lib_ST25R3916 library comes with several different demos:

  • The FreeRTOS demo that showcases how to integrate the RFAL into an RTOS. It runs a pure NFC polling loop from demo_polling.c
  • the ndef_rw demo that showcases NDEF read and write. It is a bare metal demo running the demo code from ndef_demo.c
  • and other demos

If you need to run NDEF read/write in your application, you can easily modify the FreeRTOS demo to run the ndef_demo.c as both use the main loop entry point (demo_cycle) and the same init entry point (demo_ini). In the FreeRTOS project,

  • replace demo_polling.c by ndef_demo.c
  • add ndef_dump.c
  • add the various NDEF files from the NDEF middleware (ndef_*.c, see the ndef_rw demo for the list of files and their location)

In the ndef_demo.c, as soon as a tag is found, the demo_cycle performs the NDEF detect and then an NDEF read and dump the NDEF content on the trace serial port. When used on STM32 nucleo board, the user can also trigger an NDEF Write thanks to the user button on the board (this is just a simple read GPIO). See AN5616 for more details.

Regarding ndefExampleRead() and ndefExampleWrite(), those examples are located in Middlewares\ST\NDEF\doc\examples. This is simple examples showing how to use the NDEF library. I would recommend to rather use ndef_demo.c as this provides an integrated demo.

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.
DSai.1
Associate III

Dear Brian TIDAL,

Thank you very much for your reply.

Based on your explanation, we got demoCycle() in demo_polling.c. We went to

ndef_example_wrapper.c before. I will continue the porting by referring demo_polling.c.

thank you again for your great help.

best regards

Dai Sai