2025-08-01 7:06 AM
Hello,
I had configured in older post
Solved: Re: is there any sample for X-NUCLEO-NFC08A1 to be... - STMicroelectronics Community
an stm32 example for tag polling for stm32u083RCxx family and using a NFC08A1 extension interface like here:
but now after some hw redesign I will not have nfc08A1 board anymore.
Is it enough for me to go back to cubemx example and regenerate it without Board Extension NFC option?
Thanks,
Mihai
Solved! Go to Solution.
2025-08-04 2:24 AM
Hi @Mihaita Ivascu,
I apologize for completely misunderstanding your initial question.
Since you have your own hardware and NFC application, the X-CUBE-NFC6 configuration should be as follows:
nfc08a1.c/h
.In this case, your application must explicitly call the initialization functions. For the SPI, the functions are available in custom_bus.c
or stm32u0xx_nucleo_bus.c
if your IOC is based on a NUCLEO-U083RC. Simply call SPI1_MspInit()
followed by MX_SPI1_Init()
.
I recommend using ST firmware rather than third-party solutions.
Hi @vlpl
I do not encounter STM32CubeMX generation issues when using:
Ensure that none of the files are locked for editing.
Try saving your IOC file into a new folder using the "Save As" option and generate the files from this new folder.
Rgds
BT
2025-08-01 7:21 AM
Hi,
that should work: just unselect the various X-CUBE-NFC6 components in in Software Pack > Select components. . Then you may have to manually clean up the project file to remove references to the RFAL source files.
Rgds
BT
2025-08-01 9:11 AM
Hello BT,
Thanks for your answer.
I thought rfal lib is needed anyway to use st25r3916b driver, not only when using nfc081 ?
My expectation is that I only need to remove that code encircled in the snapshot(meaning to uncheck only the nfc extension board support). Will look at it
2025-08-01 10:00 AM - edited 2025-08-03 11:49 PM
Piggybacking off this topic, since the thread mentioned in the OP is locked now (and this is related to the same project as @Mihai's).
Using the same NFC08A1, I'm trying to generate code without the LED and UART COM dependencies, but it seems code generation fails on nfc_conf.h.
To be clear, I previously started from this config:
I cannot use this config, since other than the pins set under "Found Solutions", I have no free pins to assign to the LEDs. Moreover, I've defined my own logger, and I am using the Virtual COM from the BSP -> Human Machine Interface, which occupies USART2. Due to other config options, only USART1 is available, which is used for a different component.
Leaving the pins as "undefined" causes CubeMX to generate code that does not compile, because the #define's for the various LEDs are left incomplete:
These are the pins used here:
Moreover, you can see the generated code uses BSP_COM_INIT(COM1), which is undefined, since no UART option is given to the X-CUBE-NFC6 config.
I've tried moving to a config that only uses SPI and RFAL (which I assume is enabled by the "Wireless MID LIB" option?):
But this causes the generation to fail for nfc_conf.h (fails silently, CubeMX itself reports no error):
/**
******************************************************************************
* @file : nfc_conf.h
* @brief : This file contains definitions for the NFC6/8 components bus interfaces
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __NFC0XA1_CONF_H__
#define __NFC0XA1_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif
FreeMarker template error (DEBUG mode; use RETHROW in production!):
The following has evaluated to null or missing:
==> SWIPdatas [in template "nfc_conf_h.ftl" at line 279, column 8]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either
specify a default value like myOptionalVar!myDefault, or use [#if
myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover
the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #list SWIPdatas as SWIP [in template "nfc_conf_h.ftl" at line 279, column 1]
----
Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
at freemarker.core.Expression.assertNonNull(Expression.java:249)
at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:104)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
at freemarker.core.Environment.visit(Environment.java:370)
at freemarker.core.Environment.visitAndTransform(Environment.java:501)
at freemarker.core.CompressedBlock.accept(CompressedBlock.java:42)
at freemarker.core.Environment.visit(Environment.java:334)
at freemarker.core.Environment.visit(Environment.java:340)
at freemarker.core.Environment.process(Environment.java:313)
at freemarker.template.Template.process(Template.java:383)
at com.st.microxplorer.codegenerator.CodeEngine.freemarkerDo(CodeEngine.java:420)
at com.st.microxplorer.codegenerator.CodeEngine.genCode(CodeEngine.java:273)
at com.st.microxplorer.codegenerator.CodeGenerator.generateOutputCode(CodeGenerator.java:6459)
at com.st.microxplorer.codegenerator.CodeGenerator.generateSpecificCode(CodeGenerator.java:5281)
at com.st.microxplorer.codegenerator.CodeGenerator.generateSpecificCodeFile(CodeGenerator.java:1862)
at com.st.microxplorer.codegenerator.CodeGenerator.generateCodeFiles(CodeGenerator.java:2188)
at com.st.microxplorer.codegenerator.CodeGenerator.generateDefaultConfig(CodeGenerator.java:10991)
at com.st.microxplorer.codegenerator.CodeGenerator.generateCode(CodeGenerator.java:1593)
at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.generateCode(ProjectBuilder.java:3343)
at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createCode(ProjectBuilder.java:2235)
at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createProject(ProjectBuilder.java:819)
at com.st.microxplorer.plugins.projectmanager.engine.GenerateProjectThread.run(GenerateProjectThread.java:61)
I've tested with only the 1st option removed (as in the OP), but that results in the same code generation error).
Any guidance on how to proceed w/o defining all the options for the 1st config, or on how to fix the code generation for the 2nd config would be much appreciated.
EDIT:
I would assume changes need to be made to the software package, but i.e. disabling board extension gives warnings:
Generating with only these software packages results in the same nfc_conf.h generation error.
After further testing, it seems the nfc_conf.h generation error happens every time all 4 options are NOT selected, either from software packages or in the configuration itself.
The same error as in the nfc_conf.h file is reported in the terminal when running the generation:
2025-08-01 21:07:22,124 [INFO] IP:3329 - RTE Config file name : RTE_Component
2025-08-01 21:07:22,124 [INFO] IP:3347 - RTE template : RTE_Components.ftl
2025-08-01 21:07:22,125 [INFO] CodeEngine:265 - oldGeneratedFile, /home/<user>/work/Inc/common.h_save
2025-08-01 21:07:22,150 [INFO] CodeEngine:289 - Generated code: /home/<user>/work/Inc/common.h
2025-08-01 21:07:22,151 [INFO] CodeEngine:265 - oldGeneratedFile, /home/<user>/work/Inc/nfc_conf.h_save
2025-08-01 21:07:22,189 [ERROR] CodeEngine:430 - The following has evaluated to null or missing:
==> SWIPdatas [in template "nfc_conf_h.ftl" at line 279, column 8]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #list SWIPdatas as SWIP [in template "nfc_conf_h.ftl" at line 279, column 1]
----
2025-08-01 21:07:22,189 [INFO] CodeEngine:289 - Generated code: /home/<user>/work/Inc/nfc_conf.h
This is with CubeMx v6.15.0.
2025-08-01 12:45 PM
Hello BT,
I have read that I can use x-cube-nfc6 even though I don't have the nfc08a1 interface, just to disable only the first option above(Board extension interface)?
Because if I disable x-cube-nfc6 altogether, then how I generate the nfc application again?
Thanks,
Mihai
2025-08-04 12:55 AM
Or I need to use something like this : GitHub - Mani201/ST25R3916_Lib: ST25R3916/3916B library code using the ST RFAL NFC library ? If I don't have nfc08A1 board and use custom hw.
Thanks,
Mihai
2025-08-04 2:24 AM
Hi @Mihaita Ivascu,
I apologize for completely misunderstanding your initial question.
Since you have your own hardware and NFC application, the X-CUBE-NFC6 configuration should be as follows:
nfc08a1.c/h
.In this case, your application must explicitly call the initialization functions. For the SPI, the functions are available in custom_bus.c
or stm32u0xx_nucleo_bus.c
if your IOC is based on a NUCLEO-U083RC. Simply call SPI1_MspInit()
followed by MX_SPI1_Init()
.
I recommend using ST firmware rather than third-party solutions.
Hi @vlpl
I do not encounter STM32CubeMX generation issues when using:
Ensure that none of the files are locked for editing.
Try saving your IOC file into a new folder using the "Save As" option and generate the files from this new folder.
Rgds
BT
2025-08-04 3:34 AM - edited 2025-08-04 4:19 AM
Unfortunately, the same error happens even when the .ioc is saved to a different folder and the code is generated from scratch. We've tested on both Linux and Windows, the same behaviour is present on both. This is also regardless of if we set Toolchain/IDE (under Project Manager tab) to CMake or STM32CubeIDE.
Same issue happens when generating from a fresh project, where only SPI1 is defined and used.
Have you manually checked if your nfc_conf.h has the correct contents? CubeMX will not report any errors, and will act as if the code generation has completed successfully (popup saying code was generated successfully and giving the option of opening the project folder). Or alternatively, what version of the X-CUBE-NFC6 sw package are you using? On my end, it's CubeMX v6.15.0 and X-CUBE-NFC6 v3.1.0:
However, both v3.0.0 and v3.1.0 exhibit the same behaviour.
I've pasted the contents of the malformed nfc_conf.h in my previous comment. It seems the issue is from the code generator itself, and an error in one of the template files.
2025-08-04 4:20 AM
Hi,
Could you please send me your IOC file?
Rgds
BT
2025-08-04 4:29 AM - edited 2025-08-04 5:38 AM
I've attached a minimal ioc which outputs the malformed nfc_conf.h on my end.
Let me know if you need a more comprehensive ioc. But on my end, the issue is present even with this example.
EDIT:
Could this be a JRE issue? Since the error is Java-related. On my end, CubeMX reports:
2025-08-04 15:35:05,352 [INFO] MicroXplorer:653 - Detected Java Version = 24.0.1
Though, since CubeMX comes bundled with the appropriate JRE, I don't really expect a mismatch like this.