cancel
Showing results for 
Search instead for 
Did you mean: 

How to initialize ST25R3911B and problem with antenna tuning?

DIvan.1
Associate III

Hello,

I'm using Nucleo 32f070RB and X-Nucleo 05a1 (st25r3911b).

At first, I started to itialize chip. I'm doing this with following the steps of "Power-up sequence" section in datasheet of st25r3911b, page 36.

There is my code

  spiDirectComand(0xC1);        // set chip to default
  spiWrite(IO_CONFIGURATION_REG_1, 0x08);  // just in case set 0x00h register to default 0x08
  spiWrite(IO_CONFIGURATION_REG_2, 0x00);  // just in case set 0x01h register to default 0x00
  
  spiWrite(OPERATION_CONTROL_REG, 0x80);    // Enable odcilator and regulator
  HAL_Delay(100);
  spiDirectComand(0xD6);                                       // Direct command "Adjust Regulator"
  HAL_Delay(100);
  
  spiDirectComand(0xD8);                                      // Direct command "Calibrate Antenna"
  HAL_Delay(100);
test2 = spiRead(ANTENNA_CALIBRATION_TARGET_REG);  // Just to check the value in the reg. 
 
  spiDirectComand(0xD9);                                      // Direct command "Measure phase"
  HAL_Delay(100);

Now I have one proglem and one question:

  1. Befor AND after execution of Direct command "Calibrate Antenna", the Antenna Calibration Target Rregister is the same all the time. I think this is not right? (In data sheet is written that Antenna tuning Direct command insert the changes in the Antenna Calibration Target Rregister)?
  2. Is there some other steps I need to include into my "Chip Initialize" code?

I'm new user of STM MCU devBoard and NFC technology, so I hope this is not stupid questions :)

Thank you for all the time spend for me,

Domen

1 ACCEPTED SOLUTION

Accepted Solutions
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 which explain which files to use and how to setup the IRQ handler. In one of my latest responses, you will find a zip file (prilagoditevNFC) with a port on NUCLEO-F070RB. You can reuse this zip file as a basis. The STM32CubeMX ioc file is also included do that you can easily generate the code for your own IDE.

See then main.c and the demo.c for the proper usage of the RFAL api.

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

7 REPLIES 7
Brian TIDAL
ST Employee

Hi,

our X-CUBE-NFC5 package provides an NFC communication stack and a driver for ST25R3911B. This package supports NUCLEO-F401RE or NUCLEO-L476RG board but it can be easily ported on NUCLEO-F070RB. It includes chip initialization procedure and antenna calibration procedure.

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

Thank you for information.

Can you tell me how to check if direct command "Antenna tuning" was successfully executed?

I check Antenna calibration target register but nothing changed (before and after direct command executed).

All the best,

Domen

Brian TIDAL
ST Employee

Hi Domen,

Calibrate antenna (D8h) is not an immediate command i.e. it starts a process of a certain duration and I_dct interrupt is triggered once the command is completed. Not waiting for the direct command completion interrupt (I_dct) is not a good practice.

As explained by @Ulysses HERNIOSUS in 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, if you prefer to write your own driver, observing the sequences and registers settings can be a good starting point. In the case of Antenna Calibration, see rfalCalibrate API in rfal_rfst25r3911.c and see the comment "Always run the command Calibrate Antenna twice".

Just for my own curiosity, why do you prefer to have your own driver?

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 don't want to use the library because for my needs is too big and have too much of overhead.

Now I'm thinking to include library and then step-by-step start deleting unnecessary scripts and codes.

Rgds,

Domen

Brian TIDAL
ST Employee

Hi Domen,

for your information, our code is scalable. For example, if only type 5 is used, you can configure RFAL_FEATURE_NFCA , RFAL_FEATURE_NFCB, RFAL_FEATURE_NFCF to false and significantly reduce the footprint.

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.

Okay I will do this. I generate a new project with 32f070RB chip and set all the pins which needs to be set (comparing with your example). Now, I'm trying to import a library. Can you tell me which library is necessary to include for simple read/write project. Is It a "RFAL" or/and "ST25R3911" library?

One more question: After successfully included library I have a plan to start calling functions from library to initialize and all the other necessary function for correct working. Is this a correct procedure or you suggest different procedure?

Thanks a lot,

Domen

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 which explain which files to use and how to setup the IRQ handler. In one of my latest responses, you will find a zip file (prilagoditevNFC) with a port on NUCLEO-F070RB. You can reuse this zip file as a basis. The STM32CubeMX ioc file is also included do that you can easily generate the code for your own IDE.

See then main.c and the demo.c for the proper usage of the RFAL api.

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.