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
  • 7741 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
June 30, 2020

I tried to do it like I understand you, but no luck.

I change (uncomment #define section ) the ASSERT in "stm32f0xx_hal_conf.h" files because I didn't have file "stm32f0xx_hal_conf_template.h" (Picture above)

0693W000001rokiQAA.png

After that I insert the code you said at the beginning of the function "HAL_SPI_TransmitReceive()" (Picture above)

0693W000001romAQAQ.png

The problem is still not solved. Do you know what I did wrong. Belove I attached both changed documents.

thank you for your patience,

Domen

Ulysses HERNIOSUS
ST Technical Moderator
July 1, 2020

Hi,

if you look at your screeshots (stacktrace) it tells you in which area of HAL_SPI_TransmitReceive() the hard fault gets triggered - one line before the mentioned line 1440. The code should replace that line.

This line which needs to be replaced was also mentioned in the post which I had referenced!

Problem is that even though the driver has uint8_t* on the interface, the driver actually needs it to always be uint16_t* aligned. Otherwise there will be a hard fault. With this workaround this issue (in this location) gets removed.

With USE_FULL_ASSERT actually in that function the assert_param(IS_SPI_16BIT_ALIGNED_ADDRESS(pRxData)); should have it. Of course after fixing the SPI driver code in this respect this line will not be needed anymore.

Regards, Ulysses

DIvan.1
DIvan.1Author
Associate III
July 1, 2020

Hello, thanks for the knowledge.

Yes I found the place where the code need to go and put it there (picture below).

0693W000001rxgVQAQ.png

Now when I bring the tag type A close to the field I didn't get  hard fault BUT instead of LED typeA, the LED_TX turn on. It's the same with any of Tag types. Also the UART communication stop working after the message "Initialization succeeded..."

Any idea, did I missed something to change in HAL library?

Best,

Domen

Ulysses HERNIOSUS
ST Technical Moderator
July 2, 2020

Hi Domen,

well I guess you need to debug: Does it want to print but it doesn't go through. Or is it now hanging somewhere else and not even trying to print something.

Ulysses

DIvan.1
DIvan.1Author
Associate III
July 21, 2020

Hi, I solved the problem with changing HAL library. Now I have fully working project with your example of detecting different types of tags.

Now, I want to run your second example program (PollingTagDetectNdef). I took the same project and change the next things:

  1. Add NDEF library to the project folder
  2. In an IDE, add a path to this library
  3. in a folder Inc and Src add "ndef_dump.c", "ndef_dump.h" and "ndef_demo.c"
  4. Delete "demo.c" files. I think this file was just for previous example (detect differenttypes of tags). At first debuuger send me an error (few functions are decleared more than onec) so I delete this file.
  5. In an IDE, Refresh and clear the project.

(All this you can see in a picture below-black arrow)

After that I Rebuild the project and everytime i get an error you can see in the picture below-red arrow.

0693W000001tFaNQAU.png

I try to change the name of the project, clear and rebuild the project, add the path again.... nothing solved the problem.

Do you have any idea what's wrong. I suspect that I forgot to add some path or include something.

I will be very happy any of your answers.

Best,

Domen

Ulysses HERNIOSUS
ST Technical Moderator
July 21, 2020

Hi,

"region 'RAM' overflowed by 872 bytes"... does tell what's happening.

These demos are typically built for controllers having a bit more of RAM. You need to find ways of reducing that size. For doing so I recommend to first artificially increase the RAM in the .ld file. This way it will link and then you can inspect the map file what was allocated to RAM. Of course you will then need to change back the RAM size to what your device really has - otherwise application will crash.

My guess would be that you could somewhat safely reduce heap to zero and in platform.h limit all buffer sizes to 256.

Regards, Ulysses

DIvan.1
DIvan.1Author
Associate III
July 22, 2020

Thank you for information. Can you tell me how to found out this issue just from my picture? :)

Best,

Domen

Ulysses HERNIOSUS
ST Technical Moderator
July 22, 2020

Hi Domen,

well, two lines above the red-marked line....

Ulysses

Brian TIDAL
ST Technical Moderator
July 22, 2020

Hi,

the NDEF demo has a quite big buffer for storing NDEF. This can be reduced. See DEMO_RAW_MESSAGE_BUF_LEN in ndef_demo.c. Feel free to reduce down to 1024 or 512.

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
July 22, 2020

Ulysses HERNIOSUS thanks for useful information

Brian TIDAL I change it and now It's working. Thank you very much! :D

Now I'm trying to upgrade first example (detect the tag). I want to write something into a tag type A. Now "I found myself in a dead end" :face_with_tears_of_joy:

I don't know which functions needs to be used. Can you tell me if there is any guide for this and if there is maybe any other documentations how to use library or It's just this in the picture below?

0693W000001tLHMQA2.png

Guys I so appreciate your help!

Thanks,

Domen