Skip to main content
DIvan.1
Associate III
May 6, 2020
Solved

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

  • May 6, 2020
  • 39 replies
  • 7740 views

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

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

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

39 replies

DIvan.1
DIvan.1Author
Associate III
May 11, 2020

I'm using IAR-arm 8.50.1

Now I got one more error:

Error[Pe020]: identifier "EXTI0_IRQn" is undefined C:\Users\Domen\Desktop\prilagoditevNFC\Drivers\BSP\Components\ST25R3911\st25r3911_interrupt.c 155 

I attached my project if you need

Brian TIDAL
ST Technical Moderator
May 11, 2020

Hi,

I've fixed the various issues

  • demoCycle missing in main.c
  • EXTI0_IRQn to be replaced by EXTI0_1_IRQn for STM32F0 series
  • missing demo.c, etc. in Src

I've created 2 configurations:

  • prilagoditevNFC for simple NFC tag detection
  • prilagoditevNFCNDEF for NDEF demo

You can select the configuration in the Workspace window or Project/Edit configuration...

Both configuration are compiling.

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
DIvan.1Author
Associate III
May 18, 2020

Thank you with all the help. The program was successfully installed and It's working.

I'm justd not sure about UART communication. Is there need to be done something extra? Because when I ran a program I also turn On the "putty" application, set the port and bound ratio, didn't get anything to a terminal.

All the best,

Domen

Brian TIDAL
ST Technical Moderator
May 18, 2020

Hi

in your ioc project, the baud rate is 38400. I would suggest to move to 115200.

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
DIvan.1Author
Associate III
June 29, 2020

Hello guys!

Can you help me again :)

I port your example to my nucleo 32f070RB with cubeIDE successfully. The program is working and detect something but the problem is UART communication.

I'm using CoolTerm where set port to COM3 (I check, this is correct) and set bound rate 38400. I also check the code But have no idea what could go wrong.

In attachement I'm sending you my project.

Thank you for your time.

Brian TIDAL
ST Technical Moderator
June 29, 2020

Hi,

make sure to define USE_LOGGER in the Define symbols (-D) of the preprocessor. See project Properties then C/C++ build then Settings. Select the Tools Settings tab and add the define in the MCU GCC Compiler/Preprocessor define Symbols.

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
DIvan.1Author
Associate III
June 30, 2020

Thank you very much! Now the serial communication is working perfect!

Do you have any idea why program stop working when I bring this tag or this close to NFC area. The program stop and show me this:0693W000001rmBbQAI.png

When I bring this yoursST25 stick tag close to NFC It's vorking good and the NFC-V led start blinking.

Have any idea?

Best,

Domen

Ulysses HERNIOSUS
ST Technical Moderator
June 30, 2020

Hi Domen,

most likely you are running into a limitation of STM32F0 HAL drivers not being able to handle un-aligned data. Please see:

https://community.st.com/s/question/0D50X00009q3eMwSAI/how-to-migrate-project-nfc5-v13-polling-from-stm43f401-to-stm32f072

A fix of the STM32F0 HAL drivers is being worked on but as I understand it will only appear in V1.11.1

Regards, Ulysses

DIvan.1
DIvan.1Author
Associate III
June 30, 2020

Thanks for sending me a link but sorry I don't know what did you mean with the post in the link.

1) Where to change "USE_FULL_ASSERT to 1"

2) and what do you mean with this code:

>> uint16_t temp;

 >> temp = hspi->Instance->DR;

 >> *((uint8_t *)pRxData) = temp & 0xff;

 >> *(((uint8_t *)pRxData)+1) = temp >> 8;

do I need to change it or what, because in my code I can't find this or at least similar code.

Sorry for not understanding you but I can't figure out.

Best,

Domen

Ulysses HERNIOSUS
ST Technical Moderator
June 30, 2020

Hi,

please search your code including HAL drivers! Your screenshot shows a function HAL_SPI_TransmitReceive(). The code needs to go into this function. I expect this function to be implemented in stm32f0xx_hal_spi.c.

For the assert, you typically find that in stm32f0xx_hal_conf_template.h

Regards, Ulysses