cancel
Showing results for 
Search instead for 
Did you mean: 

st25r200Initialize() hangs while Initializing RFAL using STEVAL 25R200

Atomic1
Associate II

I am using the STEVAL 25R200 evaluation board for reading/ writing to/from NFC tag and using STM32CubeIDE for implementing the ndef example read and write (provided in the firmware folder of STEVAL 25R200). I have separately made NFC_read.c and NFC_write.c where I am using the example codes and calling them in the main.c code.  The RFAL initializing is called once and then the actual polling/reading process is in the while(1) loop of main function. 

 

However, the program execution hangs indefinitely inside the rfalNfcInitialize() function which I later on traced it to the st25r200Initialize() function. I have also successfully checked the correct execution of SPI communication by reading IC ID at 0x3F (= 0x54) without any problem. The program hangs before st25r200InitInterupts() routine is called according to me, since I am not getting the debug output in that I inserted in that function.

 

Also because of that, certain debug outputs present in the  EXTI0_1_IRQHandler() and the HAL_GPIO_EXTI_IRQHandler functions (in the stm32g0xx_it.c) which are called inside the . I have configured the IRQ according to the documentation to PA0 pin of STM32G MCU in platform.c

I have attached my codes in a single text file and attached here for reference. I'd be grateful for your assistance.

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

Hi,

0x54 is not the correct value of the IC identity register:

BrianTIDAL_0-1757007911727.png

Thus st25r200CheckChipID() returns false and causes the entry to the Error_handler function:

BrianTIDAL_1-1757008011444.png

The incorrect IC identity register value is likely caused by an incorrect SPI configuration. Make sure CLKPolarity = SPI_POLARITY_LOW and CLKPhase = SPI_PHASE_2EDGE in your SPI configuration. See section 5.8.2 in the ST25R200 datasheet: "The ST25R200 has a standard serial peripheral interface with clock polarity of 0, a clock phase of 1, and an active low slave select signal. "

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

2 REPLIES 2
Brian TIDAL
ST Employee

Hi,

0x54 is not the correct value of the IC identity register:

BrianTIDAL_0-1757007911727.png

Thus st25r200CheckChipID() returns false and causes the entry to the Error_handler function:

BrianTIDAL_1-1757008011444.png

The incorrect IC identity register value is likely caused by an incorrect SPI configuration. Make sure CLKPolarity = SPI_POLARITY_LOW and CLKPhase = SPI_PHASE_2EDGE in your SPI configuration. See section 5.8.2 in the ST25R200 datasheet: "The ST25R200 has a standard serial peripheral interface with clock polarity of 0, a clock phase of 1, and an active low slave select signal. "

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.
Atomic1
Associate II

The SPI Configuration is to blame. I had set it to CLK_PHASE+ SPI_PHASE_1EDGE. Thanks for bringing that error to my attention.

Another slipup was that I had redefined the SPI CS/SS pin to another pin manually in gpio.c and defined the Port and Pin for the same in gpio.h. However, the function platformSpiSelect() (called inside st25r200comStart() to initiate SPI read) to drive the CS pin low, takes its parameters from nfc_conf.h where I hadn't redefined the CS pin.