2025-04-15 12:37 AM
I am currently working on a project that involves reading NFC tags using the NFC X-NUCLEO-NFC08A1 extension, which utilizes the ST25R3916 NFC reader connected to an STM32 Nucleo-G0B1RE platform.
Having completed the hardware interfacing for SPI communication between the two, I have now integrated the RFAL files into the project via the X-CUBE-NFC6 package to enable communication between the STM32Cube software and the NFC reader.
Are there any modifications required in these files to adapt them to the project? Additionally, what is the difference between X-CUBE-NFC6 and STSW-ST25RFAL002?
2025-04-15 2:19 AM
Hi,
STSW-ST25RFAL002 contains the standalone RFAL only whereas X-CUBE-NFC6 contains full demos (polling demo and NDEF demo) in addition to the RFAL.
When using the X-CUBE-NFC6 with STM32CubeMX, a running project is generated (either based on the polling demo or based on the NDEF demo). It should run out of the box on your board without any modification (make sure to follow the getting started guide inside the documentation folder). Then you can modify the demo_polling.c file to adapt the application to your own needs.
Rgds
BT
2025-04-16 9:22 AM
Thank you so much for your response, it was very helpful. Now, I am encountering an issue with the hardware configuration before generating the code in STM32CubeMX.
I have configured SPI1 under the <connectivity> section, selecting all the appropriate pins for the corresponding signals according to the datasheet and schematic. However, when configuring X-CUBE-NFC6 in the <platform Settings> section, I cannot find the pins I configured for the NFC CS PIN and NFC INT PIN, even though the pins are correctly highlighted in green in the graphical interface.
2025-04-16 10:43 AM - edited 2025-04-17 5:14 AM
Hi,
as shown in figure 20 of the STMicroelectronics.X-CUBE-NFC6_GettingStarted.pdf, the hardware NSS signal should be disabled. The SPI1_NSS should be enabled as a GPIO_Output pin (Figure 21).
The NFC INT PIN should be enabled as an EXTI with External Interrupt Mode with Rising edge trigger detection (should not be not a GPIO_input). The related EXTI interrupt should enabled and the interrupt priority must lower than the systick interrupt (lower priority means higher numerical value). Figure 23 shows an incorrect priority for the EXTI Line 0 (should be > 0).
Rgds
BT
2025-04-24 7:20 AM
While debugging step-by-step, I noticed that the execution stops at the following point:
In the file `ST25R3916.c`:
if( !st25r3916CheckChipID( NULL ) )
{
platformErrorHandle();
return RFAL_ERR_HW_MISMATCH;
The `platformErrorHandle()` function is defined in `rfal_platform.h` as:
#define platformErrorHandle() _Error_Handler(__FILE__,__LINE__)
And the `_Error_Handler` function is defined as:
void _Error_Handler(char * file, int line)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
while (1)
{
}
/* USER CODE END Error_Handler_Debug */
}
What could be the issue causing the chip not to be detected? I believe I configured the SPI correctly.
2025-04-24 8:01 AM
Hi,
believing is one thing. Verifying the other. Or to say it with my favorite book: "Quit thinking and look!":
Connect a scope/logic analyzer and see the real sequence. Then you can decide which line is potentially not correctly toggling. Or see an incorrect frequency, ......
Ulysses
2025-04-25 6:31 AM
When I Ctrl+click on ST25R3916B, I get the message "Could not find symbol 'ST25R3916B' in index." However, the macro ST25R3916B is correctly defined when I check under MCU GCC Compiler > Preprocessor.
2025-04-25 6:42 AM - edited 2025-04-25 6:44 AM
Hi,
I guess the eclipse editor is not able to find symbols that are defined outside .c or .h files.
Regarding your initial issue with st25r3916CheckChipID, if the ID value returned in st25r3916ReadRegister( ST25R3916_REG_IC_IDENTITY, &ID ); is incorrect (not the one for ST25R3916 nor the one for ST25R3916B), this means the SPI configuration is incorrect or the expansion board is incorrectly plugged-in. See figure 22 in the STMicroelectronics.X-CUBE-NFC6_GettingStarted.pdf for a proper setting of the SPI. Connect a logic analyzer on the SPI pins to check the communication.
Rgds
BT