Skip to main content
Visitor II
August 1, 2025
Question

rfid tag reader on STM32U083xx without NFC08A1 board

  • August 1, 2025
  • 3 replies
  • 896 views

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:

MihaitaIvascu_0-1754057019686.png

 

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

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    August 1, 2025

    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

    Visitor II
    August 1, 2025

    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

     

    MihaitaIvascu_0-1754064645623.png

     

    Explorer
    August 1, 2025

    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:

    vlpl_0-1754067006787.png

    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:

    vlpl_1-1754067272594.png

    These are the pins used here:

    vlpl_2-1754067326217.png

    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?):

    vlpl_3-1754067424408.png

    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:

    vlpl_4-1754068576000.png

    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.

    Technical Moderator
    August 4, 2025

    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:

     

    BrianTIDAL_1-1754298008661.png

    • Uncheck Board Extension NFC to remove nfc08a1.c/h.
    • Uncheck Device NFC Application to remove the default polling application.

    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:

    BrianTIDAL_1-1754298008661.png

    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

    Explorer
    August 4, 2025

    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:

    vlpl_0-1754304404119.png

    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.

    Technical Moderator
    August 4, 2025

    Hi,

    Could you please send me your IOC file?

    Rgds

    BT