cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate NFC Reader ST25R3911B into my own program.

JNieu.1
Associate II

Hello!

I have been working with the NFC05A1 NFC Reader in combination with a G070RB, but am momentarily stuck on how to use it in my own program.

I have followed all the steps given in an other post with a person having close to the same issue: https://community.st.com/s/global-search/25R3911B?t=1595829552630

But I keep getting errors left and right on includes and functions, which makes me come to a question whether all of this is needed for just a 'simple' program.

My main question here is whether there is an easy way to implement a program to read the UID from an NFC Tag. It's all my program has to do, the example given in the X-CUBE-NFC5 seems a little too much for what I want it to do.

Kind regards,

Joey

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

The CS signal is not properly driven: it should be low during a whole frame (e.g. low when sending the 03 03 polling command, in your trace the CS goes high in between). Make sure to have

  • Hardware NSS Signal: Disable
  • NSS Signa Type : Software
  • PB0 being defined as GPIO Mode: output push-pull , GPIO output: high and properly mapped to ST25R95_N_SS_PIN/PORT in platform.h

SPI interface is not properly selected: in your IOC project, the SSI_0/Interface pin is not set. It should be 1 (see table 4 in the ST25R95 DataSheet). Make sure to have PC7 being defined as SSI_0 and being high.

The SPI baud rate is exceeding the max ST25R95 SPI clock frequency. It should not exceed 2Mbits/s (current value is 8...). Make sure to update the presscaler to 8 (==> Mbits/s) or 16 (==> 1 Mbits/s).

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

21 REPLIES 21
Brian TIDAL
ST Employee

Hi

The examples provided in X-CUBE-NFC5 demonstrate the various features of the ST25R3911B. The polling demo provides a simple way to read the UID of a tags from various technologies and can be reused/modified for customer projects.

Do you use the NUCLEO-G070RB?

Can you elaborate on " keep getting errors left and right on includes and functions," and send your project file so that I check on my side?

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.
JNieu.1
Associate II

Hello Brian,

Yes I do use the NUCLEO-G070RB.

For getting the errors, there are no specifics. But I can explain them a little bit, I was working with integrating the demo into my own project as told in the other post I linked. But with including and adjusting the files errors kept popping up as either inclusion errors or errors because I changed the pins on certain aspects like the LEDS.

Because I don't have spare pins on the project I am working on, I won't be able to change some pins to mocks or ones that I don't use, simply because I don't have them. Hence the reason I was looking for a simple example with the bare minimum requirements to include, and what functions to use just for reading the UID.

Brian TIDAL
ST Employee

Hi

then, you can logically map all the LED on the same GPIO.

If some GPIOs are reused for other purpose, make sure to bend the pin on the CNx connectors to prevent the LEDs from being connected to those GPIOs.

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.
JNieu.1
Associate II

Ok let me start this over sorry. The main issue isn't the usage of GPIO pins, those were the errors I was getting but when not trying to integrate the entire program it does not really matter.

The main issue is integrating it into my own project with the bare minimums to get the UID. Do you have a list of steps to take, what files to include, changes to make and functions to call to retreive the UID?

Kind regards,

Joey

Brian TIDAL
ST Employee

Hi,

See https://community.st.com/s/question/0D53W000006G1H9SAK/how-to-start-with-st25r3911b-and-is-it-really-necessary-to-use-rfal-and-st25r3911-libraries-for-simpel-project where I give the various steps.

You can #define platformLedOff/On/Toggle to empty to get rid of the LED pin redefinition/conflict and be able to properly import the 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.
JNieu.1
Associate II

I will try it again, and I'll let you know if any problems occur!

JNieu.1
Associate II

Hello again,

I am now working on porting the NFC03A1 to the G070B Nucleo board, and am running into my first problem, I've tried following the same steps as said in the other post.

Added files from:

  • Drives/BSP/Components
  • Middlewares/RFAL
  • Middelwares/NDEF (But I probably don't need this for just readind the UID?)
  • Added demo.c, logger.c, spi.c and usart.c. Not sure if I set up the right pins for it, just added SPI and USART in the .ioc

I'm trying to just include all the files and resolve any errors I have, but it seems that the "stream_driver.h" file is missing in the entire NFC03A1. I'm using the F1XX example to port to the G070B.

I get the error noted above, but am also curious on how I should configure the SPI, USART and IRQ pins in the .IOC file. I have added my project so someone could possibly check it out.

Kind regards,

Joey

(Edited, wasn't missing the timer.h file, I just had to include the path)

Ulysses HERNIOSUS
ST Employee

Hi Joey,

moving from NFC5->NFC3??

stream_driver.h is not included as not needed. stream_dispatcher.c (used for GUI control by ST25R391x-DISCO) did make it by mistake into the packet. If you exclude it from your project everything should be fine again.

After short review of your ioc: You will also need to foresee connections to IRQ_IN, IRQ_OUT and SPI_SS.

Regards, Ulysses

JNieu.1
Associate II

Hi Ulysses,

I was assuming the NFC5 operates in a similar way as the NFC3. On our final product we will most likely use NFC3, but only up until last week had an NFC5 to test on. The only thing I really need to do is read the UID from a card and use that to send it to a server which does all the authentication.

I have added the IRQ_IN, IRQ_OUT and SPI_SS to their respective connections on the NFC03A1. Should I configure IRQ_OUT as a GPIO Output?

I will add my project every time so it's easier to see what's going on when I'm talking about an error. I get undefined references to all the rfalNfc functions from demo.c, what's causing these errors as I have included the rfal folder in the include paths.

Kind regards,

Joey