cancel
Showing results for 
Search instead for 
Did you mean: 

How to start with ST25R3911B and is It really necessary to use rfal and st25r3911 libraries for simpel project?

DIvan.1
Associate III

Hello everybody!

In my company We decided to use ST brand for our "NFC projects". Anyway, now I have Nucleo board 32f070RB and x-nucleo-NFC05a1 with ST25R3911B chip.

For now We have a simple project, just to read and write to/from the Tag (some of the classical tags, probably ISO14443A).

Unfortunately, there is no official Excample for x-nucleo-05a1 and 32F070RB. For now I just established SPI communication with microcontroller and 25R3911B chip(basic read/ write into a register).

Now I need a help because I confused about 2 things and If It's possible to answer me:

+ What is the steps to Initialize ST25R3911B and start communicate with Tag (I read a datasheet but it's a bit confusing for me)?

+ Is it necessary to use rfal and/or st25r3911 libraries or at list which is really necessary?

All the best,

Domen

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

UM2253 (Getting started with the X-CUBE-NFC5 high performance HF reader / NFC initiator IC software expansion for STM32Cube) gives some informations about the RFAL architecture and about how to use the various sample applications.

Also, the  X-CUBE-NFC5 comes with Documentation folder that contains the API documentation and examples

Regarding the porting to NUCLEO-F401RE, I would suggest you port the poller application. As explained earlier, I would suggest you use STM32CubeMX to configure the SPI and the various GPIOs:

  • SPI (Full duplex master, Motorola format, 8 bits, MSB first, HW NSS disable - Software NSS, CPOL Low, CPHA 2 edges baud rate up to 5MBits/s
  • GPIO
    • IRQ_3911 external Interrupt mode with rising edge trigger detection
    • SPI_CS: output push pull
    • LEDs: output push pull

Then you just need to copy the /* USER */ parts of the main.c (and add st25r3911Isr() in EXTI0_IRQHandler) and update the platform.h with the pin mapping

I've attached the the NUCLEO-L476RG ioc for reference.

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

39 REPLIES 39
Brian TIDAL
ST Employee

Hi,

the RFAL provides all the necessary steps to initialize the ST25R3911B reader. It provides as well the NFC communication stack. A RFAL port to  NUCLEO-F401RE, NUCLEO-L053R8 or NUCLEO-L476RG board in available as part of X-CUBE-NFC5. This includes sample applications (poller and ndef read/write). This can bee reuse for a port to NUCLEO-F070RB.

To port to NUCLEO-F070RB, you just need:

  • to properly initialise: SPI, IRQ_3911 pin, LEDs pins (I would suggest to use STM32CubeMX)
  • to update the platform.h with the pin mapping (LEDs and IRQ)
  • to update the EXTI0_IRQHandler to call  st25r3911Isr() between /* USER CODE BEGIN EXTI0_IRQn 1 */ and /* USER CODE END EXTI0_IRQn 1 */
  • to add the various RFAL files in your project
  • to update the main.c to add the calls to demoIni and demoCycle

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.
Ulysses HERNIOSUS
ST Employee

Hi Domen,

theoretically it would be possible to also omit the RFAL but depending on what you are pursuing it may cause you rewriting parts of RFAL. Reasons:

  • there are many different communication modes and speeds which require very specific settings which are not always explicitly mentioned in the data sheet.
  • depending on the moment of communication (Tech detection, collision resolution and data transmission) different settings may be needed. Furthermore these register settings depend also on the communication parameters sent by the detected device (typically a card).
  • many parts of the RFAL are implementing the various standards: ISO14443A/B, ISO15693, etc. Those you would also need to rewrite - at least the parts which you need.
  • RFAL has quite some compile time switches for tailoring it to user needs which should also bring down its size.

If you still want to pursue your own drivers then I would start by observing the sequences and registers settings using Logic Analyzer and Register map using ST25R3916-DISCO and try to cherry-pick the parts and settings you actually need. But the more flexible solution is for sure using RFAL as it supports all the modes and technologies which you may need also in future. Also we are frequently updating the RFAL and using it you can rely on using an implementation which is known to pass relevant NFC Standards in our labs. We even went the effort for applying official NFC Forum certification:

https://www.facebook.com/STMicroelectronics.NV/posts/we-are-pleased-to-announce-that-our-st25r3916-and-st25r3911b-nfc-reader-devices-/3247102198650921/

Best Regards, Ulysses

DIvan.1
Associate III

Thank you for all the time you guys spent to answer me.

You convinced me to use RFAL library :)

Now I have a question, if there is any Documents with how to start using RFAL library in your own project or I need to watch the example and following the written command and use it in my project?

All the best,

Domen

Brian TIDAL
ST Employee

Hi,

UM2253 (Getting started with the X-CUBE-NFC5 high performance HF reader / NFC initiator IC software expansion for STM32Cube) gives some informations about the RFAL architecture and about how to use the various sample applications.

Also, the  X-CUBE-NFC5 comes with Documentation folder that contains the API documentation and examples

Regarding the porting to NUCLEO-F401RE, I would suggest you port the poller application. As explained earlier, I would suggest you use STM32CubeMX to configure the SPI and the various GPIOs:

  • SPI (Full duplex master, Motorola format, 8 bits, MSB first, HW NSS disable - Software NSS, CPOL Low, CPHA 2 edges baud rate up to 5MBits/s
  • GPIO
    • IRQ_3911 external Interrupt mode with rising edge trigger detection
    • SPI_CS: output push pull
    • LEDs: output push pull

Then you just need to copy the /* USER */ parts of the main.c (and add st25r3911Isr() in EXTI0_IRQHandler) and update the platform.h with the pin mapping

I've attached the the NUCLEO-L476RG ioc for reference.

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

I'm trying to adjust this official example to be able run in my nucleo 32F070RB like you said above. I generated project in STM32CubeM and set all the pins. But now I have a problem, how and which files to import for "rfal" library and which other files need to be imported.

Could you try to answer me.

All the best,

Domen

Brian TIDAL
ST Employee

Hi,

you just need to add the files from the following groups (see the various project files provided in the  X-CUBE-NFC5:(

  • Drivers/BSP/Components
  • Middlewares/RFAL
  • Middlewares/NDEF (if you need NDEF)

In your application/User group, add

  • demo.c or ndef_demo.c/ndef_dump.c
  • logger.c
  • spi.c
  • usart.c

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

Hi, thank you for list of files that need tobe included.

I generated project in STM32CubeMX, copy and include all the files in your list and add "Additional include directories"and "Defined symbols" like it is in STM32L476RG-Nucleo project.

Now I have two problems:

  1. When I want to compile, I get error Fatal Error[Pe1696]: cannot open source file "platform.h". So, where can I find this file because I also need to change pin mapping in this file (as you said in first reply of this topic)?
  2. In first answer of this topic you also said I need update the EXTI0_IRQHandler. Where can I find this file with "/* USER CODE BEGIN EXTI0_IRQn 1 */ and /* USER CODE END EXTI0_IRQn 1 */" section?

I would be very happy with any answer.

All the best,

Domen

Brian TIDAL
ST Employee

Hi,

  1. you can copy and modify the platform.h from STM32CubeExpansion_NFC5_V2.0.0\Projects\STM32F401RE-Nucleo\Applications\PollingTagDetect\Inc
  2. this is a a generated file called stm32f0xx_it.c. It should located in the same Src as main.c

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

Hello,

I did it like you said, bu now I have some errors:

Fatal Error[Pe003]: #include file "C:\Users\Domen\Desktop\prilagoditevNFC\Inc\platform.h" includes itself C:\Users\Domen\Desktop\prilagoditevNFC\Drivers\BSP\Components\ST25R3911\timer.h 42 

Fatal Error[Pe1696]: cannot open source file "ndef_poller.h" C:\Users\Domen\Desktop\prilagoditevNFC\Middlewares\ST\ndef\Src\poller\ndef_t3t.c 44 

Any ideas how to solved, especialy first one ?

All the best,

Domen