Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Hi,I have a project working on a STM32U5 and I was curious to port it to STM32U3 to see the differences in power consumption.I have built the project for the STM32U3 with CubeMX with the firmware packet "FW_U3 V1.1.0" , which is currently the latest available.My project uses ADF1 to acquire the signal from a digital microphone among other things.I configured all the pheripherals and added my code without any problem but when I built the project the mdf.c source file in function "void HAL_MDF_MspInit(MDF_HandleTypeDef* mdfHandle)" (which is automatically generated by CubeMX) gave me an undefined reference error for this definition "IS_ADF_INSTANCE(mdfHandle->Instance)".IS_ADF_INSTANCE() is missing.I look into my STM32U5 project and this Macro is defined in file "stm32u5xx_hal_mdf.h" .I added it manually into the USER CODE of my STM32U3 mdf.c file and the project builds perfectly. Please check the next release MDF/ADF drivers that are released for CubeMX, since this automatically
Is there a way to edit the auto-generated code in CubeMX, such as in the function below?please see the code below:void MX_USART2_UART_Init(void) { /* USER CODE BEGIN USART2_Init 0 */ /* USER CODE END USART2_Init 0 */ /* USER CODE BEGIN USART2_Init 1 */ /* USER CODE END USART2_Init 1 */ huart2.Instance = USART2; #ifdef SLOW_CLOCK huart2.Init.BaudRate = 9600; #else huart2.Init.BaudRate = 152285; #endif huart2.Init.WordLength = UART_WORDLENGTH_8B; ... }Edited to apply source code formatting - please see How to insert source code for future reference.
1.这一套硬件第三方开发已实现porting RN8302B,现在自己开发发现无法工作,线路图如下:2.在MX里配置没有像F103那样的项目,如下为H563的SPI配置3.导入RN8302B 驱动编译通过后, 发现无法读取到RN8302B deviceID,串口打印信息为0XFFFFFFFF:
Hello,A set of new constants have been added to stm32g070xx.h by CubeMX v6.15.0, and one of them has the wrong value (at line 4200):#define RCC_CFGR_SWS_LSE (0x00000100UL) /*!< LSE used as system clock */According to the datasheet, the right value for LSE is 0x00000020UL. Thanks.
The following line of code is generated by CubeMX v6.14.0.202502271554 for a STM32G070RBTx using FW Package v1.6.2:LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_AWD_CH_VREFINT_REG|LL_ADC_AWD_CH_TEMPSENSOR_REG);The constants used are for the Analog Watchdog in ADC_CFGR1 and have no relation to the internal path configuration in ADC_CCR. This can configure the wrong internal paths and change the ADC clock prescaler.As stated in the function description, the constants should be one of the following: * @PAram PathInternal This parameter can be a combination of the following values: * @arg @ref LL_ADC_PATH_INTERNAL_NONE * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR * @arg @ref LL_ADC_PATH_INTERNAL_VBAT Regards,
I encountered a bug in the initialization code for HRTIM generated by CubeMX in STM32CubeIDE.Delayed Protection is enabled for HRTIM Timer F despite the "Delayed Protection Mode"="No Action" in the timer configuration. This does not happen for other HRTIM timers.This error occurred in my project with STM32G474RBT6 in STM32CubeIDE 1.17 (CubeMX 6.13) but I reproduced this bug on a clean installation of STM32CubeIDE 1.19.0 (CubeMX 6.15.0).All you need to do is set the LL driver for HRTIM and enable Timer F.In the MX_HRTIM1_Init function in main.c, there is a function call:LL_HRTIM_TIM_EnableDLYPRT(HRTIM1, LL_HRTIM_TIMER_F)I solved it by calling the function LL_HRTIM_TIM_DisableDLYPRT(HRTIM1, LL_HRTIM_TIMER_F) in the following USER CODE block...
Platform: linuxSteps to reproduce:+ Create a new STM32 Project- Select Board->H753ZI - STM32Cube FW_H7: V1.12.1- copy only the necessary library files and finish+ Select board options all+ Software Packs | Select Components | X-CUBE-AZRTOS-H7 3.4.0 | RTOS | ThreadX | Core (6.4.0): Enable+System core | SYS | Timebaser soruce: TIM6- Middleware and Software Packs | X-CUBE-AZRTOS-H7 | RTOS ThreadX: Enable- Middleware and Software Packs | X-CUBE-AZRTOS-H7 | RTOS ThreadX: Enable | Core Init: check| Application Thread:TrueSave ioc, generate code and build22:36:05 **** Build of configuration Debug for project h7_tx_3.4.0_iter02 **** make -j4 all arm-none-eabi-gcc -mcpu=cortex-m7 -g3 -DDEBUG -DTX_INCLUDE_USER_DEFINE_FILE -c -x assembler-with-cpp -MMD -MP -MF"Middlewares/ST/threadx/ports/cortex_m7/gnu/src/tx_thread_context_restore.d" -MT"Middlewares/ST/threadx/ports/cortex_m7/gnu/src/tx_thread_context_restore.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "Middle
For COMP1 on STM32G0 here are the pin assignments from the reference manualI want PA1 and so I've chosen that in the STM32CubeMXHowever, the generated code sets and the value of InputPlus is /** @defgroup COMP_InputPlus COMP input plus (non-inverting input) * @{ */ #define COMP_INPUT_PLUS_IO1 (0x00000000UL) /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2, pin PB0 for COMP3 (for devices featuring COMP3 instance)) */ #define COMP_INPUT_PLUS_IO2 (COMP_CSR_INPSEL_0) /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2, pin PC1 for COMP3 (for devices featuring COMP3 instance)) */ #define COMP_INPUT_PLUS_IO3 (COMP_CSR_INPSEL_1) /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2, pin PE7 for COMP3 (for devices featuring COMP3 instance)) */ Which apparently maps to PB2 which is wrong! On the other hand, COMP2 I have chosen PB6 and its getting COMP2 seems to be
I created a project in CubeMX for STM32G0B1. I added ThreadX middleware. I chose "Add necessary library files as reference..." I generated a CMake project. It was good, it worked fine. After a few weeks of work and dozens of regenerations CubeMX leaves out ThreadX C sources from the generated CMakeLists.txt.
HiWe work on a project with a STM32H562. We use STM32CubeMX Version 6.14 with the Firmware Package V1.5.0 to generate a STM32CubeIDE project on Windows 11. I just found a wrong description in CubeMX.The description for SRAM2_ECC, SRAM3_ECC and BKPRAM_ECC, says the parameter in CubeMX needs to be set to “Disabled” to enable ECC check.Assuming I want to disable ECC, I would set the option to “enable” in CubeMX. CubeMX then adds OB_SRAM2_ECC_ENABLE, OB_SRAM3_ECC_ENABLE and OB_BKPRAM_ECC_ENABLE in MX_FLASH_Init(). All three options are defined in stm32h5xx_hal_falsh_ex.h as 0. According to chapter 7.11.24 of the reference manual, setting the bit to 0 in the register, enables ECC (exactly the opposite of what I wanted). Therefore, the description in CubeMX is wrong. To Disable ECC, configure Disable in CubeMX and to enable ECC, configure enable.
HiWe work on a project with a STM32H562. We use STM32CubeMX Version 6.14 with the Firmware Package V1.5.0 to generate a STM32CubeIDE project on Windows 11. I think I just found bug in the code generation of CubeMX.I could reproduce the bug below in a new empty CubeMX Project.In Flash setting its possible to change the Flash Option Bytes Settings for the SRAM erase upon system reset. For SRAM2_RST this works as expected, and the code is generated in MX_FLASH_Init().But the option for SRAM13_RST does not work.If enabled or disabled the following code with a comment about a missing parameter is generated.
Hello,create a project with the above settings and it will result in a build error (missing header file).Thank you.Best regards potter
I am working on a project using the STM32C092CBT6 microcontroller, which is specified to have 48 pins in a LQFP 48 (7x7x1.4mm) package. However, in the STM32CubeMX software, the package is displayed as having 63 pins.Could you please clarify if this is an issue with the STM32CubeMX software configuration for the STM32C092CBT6
I’m trying to understand the peripheral current consumption figures generated by the PCC tool in CubeMX for my STM32U031 based project but can’t correlate the generated numbers with the values given in Table 43 of the datasheet, so I’m wondering which is likely to be correct, the PCC values or datasheet values?I’m also struggling to understand what the names used in the PCC ‘Peripheral Selection’ tab tick-boxes refer to; e.g. TIM1 vs TIM1/SYS, PWR/TIM2, ADC1/SYS vs ADC1 CLK_KER_SYS etc etc, as there’s no help in the tool, or guidance in the UM1718, so any help here would be much appreciated!
Hi @STTwo-32 & Community, This issue was reported a long time ago but I'm seeing something similar again now. In my case it's the definition HAL_UART_MODE_ENABLED for my STM32H755 project, this define being put into stm32h7xx_conf.h after each code re-generation. My project began as one targeting the H755 Nucleo and at that point there was not problem. The problem arose after migrating to my custom H755 PCB, at which point I removed the Nucleo BSP stuff in MX (CubeIDE MX perspective); I also removed some other unwanted things such as Ethernet support (& LWIP) I have no UART/USART in my project and can't think of any reason why the UART definition should be getting into my HAL config. Viewing HAL modules in the MX Project settings does not show any peripherals other than those I'm expecting. My .ioc is attached in case it's helpful. Thanks Edit: moved from stm32h5xx_hal_usart.h is missing
Hello, I'm learning about the STM32N6 LR and XIP examples and want to get hands-on with them. I've already set OTP124 to 0x8000. If SYSB is configured to 400MHz, the number of memory data lines must be set to 1 line and disable "X_ICACHE_Init()" for the app to function. However, if SYSB is set to 80MHz, the number of memory data lines can be configured to 8 lines and disable "X_ICACHE_Init()", and the app still works. I'm very confused by this result and wonder if anyone has encountered the same problem or knows what I should modify? Thank you.
This situation arose when working with the Nucleo-G0B1RE board and Cube Version: 1.18.1.It was desired to do per-byte reception over UART channel 5 on PD2/3 with interrupts. The VAST majority of articles discussing this process state to use the HAL_UART_RxCpltCallback() function to read the byte from the UART buffer, since this function gets called by the ISR chain on UART interrupt. However, these same articles also frequently fail to mention the following:1) The HAL_UART_RxCpltCallback won't get called unless it gets registered first. This can be done with the HAL_UART_RegisterCallback() function...2) ...BUT, even if you register functions in this manner, they won't be used unless enabled by internal configuration files. To do that, you have to pull up the IOC file and go to the Project Manager section. Go to the "Advanced Settings" and you will see that you have to explicitly enable callbacks for each peripheral (Not known if enabling USAR
Bug Description:When regenerating a CubeMX Project with the STM32CubeIDE Toolchain selected, CubeMX will change the ".cproject" file and add a "./Startup/" directory to the source locations of the project if the following conditions are present:1. In the root directory of the project (where the .ioc file is located) you need to have a directory with a name that is alphabetically closer to 'A' than the "./Core/" Directory. For example "./Application/"2. In this directory there needs to be a "main.c" file, which would be created by the user. This will cause CubeIDE to output a warning message on each build, stating that "./Startup/" could not be found. If the directory name comes after "Core" alphabetically everything is working like expected and no "Startup" directory is added as a source location to the project configuration. Version:This behaviour is reproducible with CubeMX version 6.14.0. I currently have no easy way to test if this problem is also present on the most
Hello everyone,I'm new to STM32 and currently working on a USB CDC (Virtual COM Port) project using STM32CubeMX with the following setup:MCUs/Boards: STM32F103C8T6 and Nucleo-F334R8Toolchain / IDE: MDK-ARM (Keil µVision)STM32CubeMX versions tested: 6.14.1 and 6.12.1I configured the USB peripheral in Device Only mode and enabled the Communication Device Class (CDC) in the USB Device middleware settings. I also configured the required USB pins (PA11 as USB_DM and PA12 as USB_DP) and set the USB clock source properly to ensure 48 MHz operation.However, after generating the project, several key USB middleware source files are missing, such as:usbd_core.cusbd_ctlreq.cusbd_ioreq.cusbd_cdc.c(and sometimes also usbd_cdc_if.c)Because of this, the code fails to compile due to missing function references.What I’ve Tried:Verified USB pins (PA11, PA12) are configuredMode is set to Device_OnlyCDC class is selected in middlewareUSB clock is 48 MHz via PLLEnabled code generation options like "Delete p
In HAL_DCMI_Init() of stm32f4xx_hal_dcmi.c, HAL_DCMI_MspInit() gets called twice. The 2nd call should be deleted from the source. See lines 216 and 218.
Hi,I use STM32CubeMX v6.13.0 to generate a CMake project for STM32U5 devices. While code generation the process aborts with following error message:"The Code is successfully generated under: /home/user/projects/stm32u5_firmware Project language : C but CMakeproject generation have a problem." After looking in the generated CMake files, I spot various template artifacts: cmake_minimum_required(VERSION 3.22) project(stm32cubemx) add_library(stm32cubemx INTERFACE) {{sr:Enable_CMake_lanuages}} target_compile_definitions(stm32cubemx INTERFACE{{sr:symbols_c_SYMB}} $<$<CONFIG:Debug>:DEBUG> ) target_include_directories(stm32cubemx INTERFACE{{sr:include_c_DIRS}} ) target_sources(stm32cubemx INTERFACE{{sr:sources_SRCS}} ) target_link_directories(stm32cubemx INTERFACE{{sr:link_DIRS}} ) target_link_libraries(stm32cubemx INTERFACE{{sr:link_LIBS}} ) # Validate that STM32CubeMX code is compatible with C standard if(CMAKE_C_STANDARD LESS 11) message(ERROR "Generat
Title edited for length - please keep titles short, but descriptive.Original title: "SPI callback interrupt does not work for SPI, but works if I switch to other SPI with identical settings, same for timers and other peripherals"Hello,There I have problem with callbacks, not only with SPI, but at this moment trying to solve there, I use SPI5 for communicate with sensor, worked well until I changed some completely unrelated settings elsewhere in cubeMX, after code generation I found what I do not getting data from sensor, in my code SPI DMA transfer was initiated by timer callback, timer simply calls HAL_SPI_Receive_DMA function at specified intervals, I noticed what timer stopped to work, I tryed change, disable, remove, clean, delete debug folder, add timer to config again - without success, then I switched to another timer and with this timer interrupts started to work again ! Next - SPI5, there is the same - clean, remove, delete... without any success, then I switched to anoth
Translated content. 我在cubemx中同时使能usart1和usb发现有个警告 I enabled usart1 and usb in cubemx and found a warning usart1的流控被usb的dp和dm复用,但是实际上我是没有开流控的 The flow control of usart1 is multiplexed by dp and dm of usb, but I actually didn't turn on the flow control 为什么同时使用usb虚拟串口和usart1收发数据的时候,发现只要usart1一发送数据,两个串口都没有输出了?? 这是为什么呢 Why when using the USB virtual serial port and usart1 to send and receive data at the same time, I find that as soon as usart1 sends data, both serial ports have no output? ? Why is this?
Can I use Nexus as proxy server for STM32CubeIDE & STM32CubeMX?What is URL of ST repository?Any experience of proxy server is welcome, thanks
When you change for example the clock in .ioc (like from 48 MHz to 20 MHz) and even change it back to 48 MHz, your display stops working properly (colors not showing). TFT st7789v display and stm32h753vit6 microcontroller please solve my issue.
ST Community highlights – April to June 2026
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.