cancel
Showing results for 
Search instead for 
Did you mean: 

How can I connect STM32G071 board with ST25R3911B chip (X-NUCLEO-NFC05A1)?

EElec.2
Associate II

Hello there, STM32 community!

I am new to the STM32 family and I am currently working on a project to read and write Mifare Classic and Desfire tags. For this, I am using an STM32G071-NUCLEO64 microcontroller and a X-NUCLEO-NFC05A1 (ST25R3911B) board connected via SPI. I have been trying to establish the SPI connection between the two devices and send/receive data, but so far, I have not been successful.

Initially, I tried to use the SPI example provided in STM32CubeIDE, but I was not able to receive data correctly.

Then, I followed a post on the ST community website to use the RFAL/NDEF libraries for my project. However, the post was for the 32f070RB board, and I had to make some modifications to make it work with my hardware.

Unfortunately, after copying the RFAL and NDEF libraries into my project, modifying the platform.h file, and adding the necessary modules, I am still unable to get it working.

The error I am receiving is:

#define ERR_HW_MISMATCH ((ReturnCode)36U) /*!< expected hw do not match */

after executing rfalNfcInitialize().

I am feeling lost and unable to find a suitable example for my specific case.

Can someone please guide me on how to initialize the connection between the STM32G071 and the ST25R3911B chip?

What is the best way to receive data and work with it?

Thank you very much for your time and help!

45 REPLIES 45

Look at your nfc board on folowing jumpers:


_legacyfs_online_stmicro_images_0693W00000biwcOQAQ.pngPErhaps you have other close/open SS line (J101 or J102 or J103)

Dudo

Show me your main.c again

Dudo
  1. #define SPI1_CS_Pin GPIO_PIN_6
  2. #define SPI1_CS_GPIO_Port GPIOB

SPI1_CS_Pin It must be B0 !!!! Look, on G0 instead B6 you have B0


_legacyfs_online_stmicro_images_0693W00000biweKQAQ.png

Dudo
EElec.2
Associate II

IT WORKS!!!!!! THANK YOU VERY MUCH :loudly_crying_face:

Why did I have to use the port-pins from the NFC05A1 and now I had to use the port-pins for the STM32G071 board?????

Kamil Duljas
Senior III

Hahah, It was good journey :D I think that manual of NFC board is customized for few boards with the same pins .e.q F401, L476 etc. .... and You on other board must check and correct eventually differences. For example:


_legacyfs_online_stmicro_images_0693W00000biwh9QAA.pngMCU_LED3 on dedicated boards is PB0, look on F401:


_legacyfs_online_stmicro_images_0693W00000biwhEQAQ.pngbut on G0xx you have PB1:


_legacyfs_online_stmicro_images_0693W00000biwhTQAQ.png 

I'm happy that works. Mark some answer as best please 🙂

Dudo
EElec.2
Associate II

Thank you for everything,

I hope I can keep up now with the project.

Have a nice day 🙂