cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble with X-Nucleo-NFC03A1 and Nucleo-F413ZH

Abhishek Deouskar
Associate III

Hello,

I am working with X-Cube-NFC3 (V2.0.0) for source code. Using one of the projects built for F401RE, I setup a project wherein:

  • I mapped each pin according to various User manuals
    • To test the pinout mapping, I wrote a simple code to check if User LEDs were mapped correctly. They are.
  • I added the middlewares into the project from the folder inside X-Cube-NFC3 (V2.0.0)
  • I added the BSP drivers for the F401RE into my project.

I now used the Ready projects to create some dummy code. I got the code built but all I get is that my board is not initialized. Check out my source code and my output:

  /* USER CODE BEGIN 2 */
  /* Initialize log module */
//  __HAL_SPI_CLEAR_OVRFLAG(&hspi1);
  logUsartInit(&huart2);
 
  platformLog("\r\nWelcome to X-NUCLEO-NFC03A1 (SPI Interface)\r\n");
 
   /* Initalize RFAL */
  rfalAnalogConfigInitialize();
  if(rfalAnalogConfigIsReady() == 1)
  {
	  platformLog("rfalAnalogConfigIsReady\r\n");
  }
  else if(rfalAnalogConfigIsReady() == 0)
  {
	  platformLog("Not rfalAnalogConfigIsReady\r\n");
  }
  ErrorVariable = rfalInitialize();
  platformLog("Error Code: %u\r\n", ErrorVariable);
  if( ErrorVariable != ERR_NONE )
   {
     /*
     * in case the rfal initalization failed signal it by flashing all LED
     * and stoping all operations
     */
     platformLog("RFAL initialization failed..\r\n");
     while(1)
     {
       platformLedToogle(PLATFORM_LED_A_PORT, PLATFORM_LED_A_PIN);
       platformLedToogle(PLATFORM_LED_B_PORT, PLATFORM_LED_B_PIN);
       platformLedToogle(PLATFORM_LED_F_PORT, PLATFORM_LED_F_PIN);
       platformLedToogle(PLATFORM_LED_V_PORT, PLATFORM_LED_V_PIN);
       platformDelay(100);
     }
   }
   else
   {
     platformLog("RFAL initialization succeeded..\r\n");
     for (int i = 0; i < 6; i++)
     {
       platformLedToogle(PLATFORM_LED_A_PORT, PLATFORM_LED_A_PIN);
       platformLedToogle(PLATFORM_LED_B_PORT, PLATFORM_LED_B_PIN);
       platformLedToogle(PLATFORM_LED_F_PORT, PLATFORM_LED_F_PIN);
       platformLedToogle(PLATFORM_LED_V_PORT, PLATFORM_LED_V_PIN);
       platformDelay(200);
     }
 
     platformLedOff(PLATFORM_LED_A_PORT, PLATFORM_LED_A_PIN);
     platformLedOff(PLATFORM_LED_B_PORT, PLATFORM_LED_B_PIN);
     platformLedOff(PLATFORM_LED_F_PORT, PLATFORM_LED_F_PIN);
     platformLedOff(PLATFORM_LED_V_PORT, PLATFORM_LED_V_PIN);
   }

The output I got was:

Welcome to X-NUCLEO-NFC03A1 (SPI Interface)<CR><LF>

rfalAnalogConfigIsReady<CR><LF>

Init failed<CR><LF>

Error Code: 8<CR><LF>

RFAL initialization failed..<CR><LF>

The error code 8 corresponds to SystemError. Could someone help me out with how to proceed. I did make the following changes to the Middlewares:

  • I removed the call to the #include "rfal_dpoTbl.h" as this file did not exist in the Middlewares folder.
  • I also commented the following in rfal_dpo.c

//#ifndef RFAL_FEATURE_DPO

//  #error " RFAL: Module configuration missing. Please enable/disable Dynamic Power module by setting: RFAL_FEATURE_DPO "

//#endif

Any and all help is useful.

1 ACCEPTED SOLUTION

Accepted Solutions
Brian TIDAL
ST Employee

With updated IOC file (B1 button label renamed)

Let me know if the proper pin assignment solves your initialization issue

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

6 REPLIES 6
Brian TIDAL
ST Employee

Hi,

1/ DPO

rfal_dpo.c is not needed for ST25R95. It is delivered as part of the common RFAL but is not part of the list of files being compiled in ST25R95 projects. You can removed it from your project.

2/ NUCLEO-F413ZH vs. NUCLEO-F401RE

NUCLEO-F413ZH is refered in the title of the post whereas NUCLEO-F401RE is refered in the description of the issue

  • if you are using a NUCLEO-F401RE, ST provides a ready to use demo project and bin file in X-CUBE-NFC3 V2.0.0
  • if you are using a NUCLEO-F413ZH, the pin assignment is not the same as the one in NUCLEO-F401RE. The following defines in main.h need to be changed
    • SPI_CS_NFC changed from PB6 to PD14
      • #define nSPI_SS_Pin GPIO_PIN_14
      • #define nSPI_SS_GPIO_Port GPIOD
    • Interface pin (SSI_0) changed from PC7 to PD15
      • #define SSI_0_Pin GPIO_PIN_15
      • #define SSI_0_GPIO_Port GPIOD
    • UART_TX/IRQ_IN changed from PA9 to PF12
      • #define nIRQ_IN_Pin GPIO_PIN_12
      • #define nIRQ_IN_GPIO_Port GPIOF
    • UART_RX/IRQ_OUT change from PA10 to PF15
      • #define nIRQ_OUT_Pin GPIO_PIN_15
      • #define nIRQ_OUT_GPIO_Port GPIOF
    • LED1/2/3/4 to be changed from PA8/PB10/PB4/PB5 to PF13/PE9/PE11/PF14
    • USART2 to be moved to USART3
  • Make sure to properly initialize those GPIO in MX_GPIO_Init() (I would suggest to use STM32CubeMX to generate the proper main.c/main.h/stm32f4xx_hal_msp.c for your setup, see attached IOC file)
  • make sure to have SPI clock < 2 MBit/s (currently 1.5MBits/s in IOC file with 48 MHz system clock)
  • make sure to have STM32F413xx being defined instead of STM32F401xx while compiling

3. If the initialization still fails, you can add more trace (set ST25R95_DEBUG to true in st25r95_com.c and st25r95_com_spi.c)

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.
Brian TIDAL
ST Employee

With updated IOC file (B1 button label renamed)

Let me know if the proper pin assignment solves your initialization issue

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.
Abhishek Deouskar
Associate III

Hello @Brian TIDAL_O​ , the above link was helpful. My initial implementation had SPI running at much higher speeds. At present, the initialization works. However, I am still facing some issues with the main implementation. I am trying to read data from a classic MiFare 1kb card (ISO14443, NFCA) and send it over the usart. Any help would be awesome. I need a starting point. I am kinda stuck.

Thanking You.

Brian TIDAL
ST Employee

​Hi,

such tags require proprietary authentication before any memory operation (see datasheet from the manufacturer of these tags). If you want to use such tags with the CR95HF reader, you will have to implement this proprietary authentication and the ciphering. See other posts on this topic in this forum (e.g. CR95HF reader Mifare Desfire secure mode)

I would rather recommend to use fully compliant tags from the ST25 family such as ST25TA (Type 4A Tags) or fully compliant Type 2 Tags (i.e. tags not requiring proprietary stuff).

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.

Hello @Abhishek Deouskar​, I am experiencing the similar problem, when it comes to initialization of NFC03a1 board with Nucleo-L152RE. What do you mean by "My initial implementation had SPI running at much higher speeds."? You have adjusted the APB1 clock (or any other...) or eg. SPI1 Maximum Output Speed?

While debugging during rfalInitialize() I end up with the following result in rfal_rfst25r95 ->>>

 /* Initialize chip */

  if (st25r95Initialize() != ERR_NONE)

  {

    return (ERR_SYSTEM);

  }

Thanks in advance for any help;) 

Hi,

rfalInitialize performs the startup sequence (as per ST25R95 Datasheet §3.2) and then sends echo command until a valid reply is received or the max retries is reached.

Can you connect a logic analyzer on the SPI pin on the X-NUCLEO-NFC03A1 to check the SPI communication? Can you check the PIN assignment between the NUCLEO-L152RE and the X-NUCELO-NFC03A?

Make sure to have:

PA5 -- SPI1_SCLK

PA6 -- SPI1_MISO

PA7 -- SPI1_MOSI

PB8 -- nSPI_SS Output Push_Pull Output level high

PC7 -- SSI_0 Output Push_Pull Output level high

PA9 -- nIRQ_IN Output Push_Pull Output level low

PA8 -- LED1

PB10 -- LED2

PB4 -- LED3

PB5 -- LED4

PA10 -- nIRQ_OUT Input mode

The SPI clock max frequency is 2.0 MHz (see table 49 in ST25R95 datasheet). For HCLK=32MHz, you can set for example the prescaler to 32 (SPI clock =1MHz)., CPOL=Low, CPHA=1 edge.

Feel free to send me your STM32CubeMX ioc file.

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.