Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
I'm using the STM32F405RGT6 board in a controller project. I wanted to use PA0 as PWM and PA1 as RX. For some reason, when configuring the .ioc, even though I configure UART4 as receiver only, it doesn't allow me to use PA0 as PWM. Is there any other way to configure this in the code?
I don't see the wrapper listed in the package for H5 although its listed in this documenten.stm32h5-cube-firmware.pdfwhere can I get it? Is it possible to download and add the package to STM32CubeMX?
We are having a similar issue as this person here:https://community.st.com/t5/stm32cubemx-mcus/why-does-the-ioc-file-show-warnings-on-disabled-peripherals/m-p/144500/highlight/true#M5600One of the responses was that this is just a warning message and is okay. But I think this is causing us to have an issue with using a CICD pipeline to handle project generation. When I use a build script with project generate I would expect the whole process to be done without interacting with the GUI but an empty warning message actually comes up for me to click 'yes' to before it will go any further. I tried an .ioc file that I found online to test to see if it would also generate this error and it does not. I am hoping there is a way to bypass any warnings generated when doing the build using a script. Any help is very appreciated.
When I generate a new project in CubeMx 5.3.0 for the STM32H745I-DISCO board for IAR toolchain, I get the following code:HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);The example projects in CubeH7 package use this code instead:HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY);With the code generated by CubeMx, when I unplug the USB cable (which supplies power to the board) from the STLK port, plugging it back in causes the code not to run.With the code from the examples, the code runs ok.I believe the code generated by CubeMx misconfigures the FW for the STM32H745I-DISCO board.Anyone else have this issue?
Hello,I am experiencing the following issue and would appreciate your help in resolving it:When I create a new STM32 project for STM32G474CEU6 in STM32CubeIDE, main.c and other source files are not generated.The .ioc file loads correctly and the GUI opens as expected, but a message saying “Code generation could not be done..” appears, and only the BSD_License.ftl file is generated.When I press Alt+K to regenerate the code, only two files — common.ftl and mw_common.ftl — are added, and no error messages are shown.In the Problems tab of the IDE, a warning appears: “Project '*' has no explicit encoding set**”, but this can be resolved by pressing Ctrl+1. However, even after fixing this and regenerating the code, nothing changes.Under STWindow > Preferences > STM32Cube > Firmware Updater > Check Connection, a green check mark is displayed.This issue occurs only on an old Windows 11 laptop. On a newer Windows 11 machine and on Ubuntu, code generation works perfectly.I have tried
I have set HAL_IncTick timer (tim6) to not interfere with systick when using thread and RTOS, the new callback was created by cubeMX and I got error about second declaration, I moved my timers settings to newly created callback, later I decided to change to tim18, after code upload I found what some functions do not work like expected, by debugging I found what everything what was in this callback is gone and there is newly created fresh callback just with newly created tim18 settings, everything else is gone ! CubeMX do not checks previously created callback by cubeMX and just deletes it !
When trying to install STM32CubeMX 6.14.1 on Debian Linux, I get an error after the information about the collection of usage information:[...] You can stop the collection of your features usage statistics when you use the application at any time with effect for the future or update your preferences via the menu Help > User Preferences > General Settings Press anything to continue z Analytics service enabled SEVERE: Cannot invoke "java.lang.CharSequence.toString()" because "s" is null [ Console installation FAILED! ] WARNING: Cannot invoke "java.util.List.iterator()" because "this.files" is nullI start the installation script as./SetupSTM32CubeMX-6.14.1in the unzipped folder of the CubeMX installer. Is this a known issue?
Hello,I'm trying to run a ML model (miniresnet from modelzoo) to a NUCLEO-N627X0-Q starting from STM32CubeMX (initialization of device, model & code generation). Everything is OK when i select STM32Cube.AI MCU runtime, the model is created and runs smoothly, however, when i select STM32Cube.AI Neural-ART runtime (with n6-noextmem profile since i have various problems with external flash and the model is small enough to fit in SRAM) the code is generated fine, but an extra .raw file ([modelname]_atonbuf.AXISRAM5.raw) is created.I noticed the the compiled .bin file (In STM32CubeIDE) is rather small (~62Kb) so i am pretty confident that it does not contain the full model (~122kb). I suspect that somehow i have to load this raw file to memory for the NPU to read.When i run the model through NPU the output is constantly zero (uninitialized or zeroed weights maybe?).I am using the nucleo in n DEV_BOOT Mode, do i need to load the raw file to memory manually? is there any guides
I would like to filter available products by the following specific peripherals, but those types of filters do not seem to be available.PSSIDMAMUXMDMALPDMAGPDMAHPDMASDRAM support andMinimum #of pins sized package to actually support 1 or 2+ SDRAM chips at 16, 24, or 32 bit Did I miss something or are there maybe future plans to support that kind of filtering ?Are there alternative papers/docs listing the products (and which are kept up to date) ?
Sometimes CubeMX do not generate code correctly, not always, but sometimes in initialization codes generated by CubeMX is missing declarations in peripheral settings for DMA with error "undeclared", currently I got this problem after clocks configurations and code regeneration, there is missing TRANSFERALLOCATEDPORTSRC_GPDMACH1, TRANSFERALLOCATEDPORTSRC_GPDMACH2, TRANSFERALLOCATEDPORTSRC_GPDMACH3.... declarations:I have to set new unused channel in DMA config again, disable old and regenerate code to solve this problem !
I am using STM32F030C6T6 mcu and i am trying to put its 3 ADC channels on DMA circular mode, but ADC is not initializing in circular mode, pls check below code:uint16_t adc_buff[3] = {0}; HAL_ADCEx_Calibration_Start(&hadc); HAL_ADC_Start_DMA(&hadc, (uint32_t *)adc_buff, 3); static void MX_ADC_Init(void) { /* USER CODE BEGIN ADC_Init 0 */ /* USER CODE END ADC_Init 0 */ ADC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN ADC_Init 1 */ /* USER CODE END ADC_Init 1 */ /** Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion) */ hadc.Instance = ADC1; hadc.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; hadc.Init.Resolution = ADC_RESOLUTION_12B; hadc.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc.Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD; hadc.Init.EOCSelection = ADC_EOC_SEQ_CONV; hadc.Init.LowPowerAutoWait = DISABLE; hadc.Init.LowPowerAutoPowerOff = DISABLE; hadc.Init.ContinuousConvMode = ENABLE; hadc.Init.DiscontinuousConvMode =
Hi , allI am currently working on a project using the STSPIN32G4 together with the STM32 Motor Control SDK (MCSDK). I would like to add the internal Temperature Sensor to monitor the MCU temperature.In STM32CubeMX, I have already enabled both the Temperature Sensor and VREFINT channels on ADC1, and generated the initialization code. Then, I configured the Temperature Sensor and VREFINT using the RDivider_Handle_t structure, and used the related APIs to read the ADC values.However, no matter whether I read the Temperature Sensor or VREFINT, the ADC values are always very close to zero, as if the sampling is not working correctly or is misconfigured.My questions are:Within the MCSDK framework, is it possible to directly use RDivider_Handle_t to read the Temperature Sensor and VREFINT channels?If not, what is the correct way to configure and acquire the ADC raw values for these internal channels?Are there any additional calibrations or specific initialization procedures required? Thank yo
I cant get faster SPI performance, in every SPI DMA request mcu receiving 164 bytes of data, the maximum request rate what I got is about 1KHz, total number of bytes is only ~ 164 * 1000 = 164KB, I need to reach 8KHz rate, MCU and other clocks is set to almost maximum values, on STM32H7 MCU with many other tasks I reached without any problems 12KHz rate, with N6 I cant get event near of required transfer speed in any configurations, If I rising request rate I getting SPI busy error, where can be the problem ? What peripherals or other settings is responsible for SPI transfer and interfere there ? I can attach .IOC file or more info.In my setup SPI requests is controlled by HAL_TIM_PeriodElapsedCallback(), sometimes I need to stop requests in case when synchronization is lost, timer fires function for next SPI DMA transfer and in case of error (in my case I getting SPI busy error) the timer for request is stopped, timer fires simple function:void nextPacket(){ if (HAL_
/** * @brief IWDG Initialization Function * @PAram None * @retval None */ static void MX_IWDG_Init(void) { /* USER CODE BEGIN IWDG_Init 0 */ /* USER CODE END IWDG_Init 0 */ /* USER CODE BEGIN IWDG_Init 1 */ /* USER CODE END IWDG_Init 1 */ hiwdg.Instance = IWDG; hiwdg.Init.Prescaler = IWDG_PRESCALER_4; hiwdg.Init.Window = 4095; hiwdg.Init.Reload = 4095; if (HAL_IWDG_Init(&hiwdg) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN IWDG_Init 2 */ /* USER CODE END IWDG_Init 2 */ }Hello, apologies if the title sounds confusing, but I wasn't sure how to accurately describe my question.So, I have the following auto-generated code for a watchdog:/** * @brief IWDG Initialization Function * @PAram None * @retval None */ static void MX_IWDG_Init(void) { /* USER CODE BEGIN IWDG_Init 0 */ /* USER CODE END IWDG_Init 0 */ /* USER CODE BEGIN IWDG_Init 1 */ /* USER CODE END IWDG_Init 1 */ hiwdg.Instance = IWDG; hiwdg.Init.Prescaler = IWDG_PRESCALER_4; hiwdg.Ini
I have a request.The complexity of the peripheral features and the peripheral registers with the inter dependent settings makes it difficult to get everything right the first time or even after multiple tries. This involves a code generation, code compile and download just to try one different setting. This is not very efficient nor is it a good use of available resources. Would it be possible to use the STM32MX GUI as a direct controller to modify peripheral settings in real time as the micro is running? I'm working with a comparator, a timer, DMA, and DFSDM. When I try to interconnect them so the run without code, I have very little visibility to what is going on and trying out many configurations and combinations can be very time consuming.There is a lot of power in the peripherals but it is not easy to tinker and try things out. I have used the debug IDE to modify peripheral registers in real time, but that has its hazards.Firstly, there is no feature driv
With new and fast N6 MCU comes new CubeMX package which is full of bugs and errors, I spending hours to find and solve such problems, now I cant trust cubeMX at all, every function must be checked after code generation !ADC rank must be 7, but cubeIDE generate 1: I spent a lot of time trying to enable SPI DMA, when I tried to choose DMA handle I got unknown errors in almost all enabled interfaces (I2C, SPI, UART... ), and in some way after some changes elsewhere, closing, opening .ioc file form cubeIDE, and after next try the error is gone and I finally enabled !I trying to enable LSE, but because of some error with frequency settings which I cant set, I cant enable ! There I cant find the way to enable DCMI DMA transfer, DMA handle for DCMI is not active, maybe I dont know some things there !?To get VDDCORE voltage and avoid errors every time after cubeMX generate code I added additional variable ADC_CHANNEL_VCORE, because cube generate ADC_CHANNEL_VCORE, but the correct v
I am using STM32H755 microcontroller and STM32CubeMX V6.14.0 for my development.I am not able to set the clock frequency to 480MHz. Whenever I do so, I receive power regulator voltage scaling error.The product revision used by me is rev.V. The RCC parameter works only when the D1CPRE is set to 240MHz. And my requirement is 480MHz.Is there any solution to run the microcontroller at 480MHz.
Hi,when looking into the schematics of the STM32H735G-DK board (MB1520B), the Ethernet-PHY is connected via RMII.Now when I configure RMII for an STM32H7 in CubeMX, the interface pins do fit properly to what is used in the MB1520B schematics - except the RX_ERR-line. According to the schematics it is connected to PB10, but when I enable PB10 in CubeMX for use as RX_ERR, it is marked in yellow with the remark "no mode".So...how do fit both things together? How can I enable RX_ERR being used in Cube MX for RMII-mode?Thanks!
Hello. I am trying to create a project that uses both the Nucleo GFX01M2 and SNK1M1 with the G071RB dev board. I want to configure my setup as a USB sink device. However, in STM32CubeMX I can select either the sink USBPD application, or the Touchgfx graphics application, but not both. What would be the best way to develop an application that utilizes both USBPD and TouchGFX? Thank you.
Hi everyone ! first time poster, hope I'm doing it right.I'm working with an STM32F107VCT and using CubeMX to generate code.I have an issue with the RTC calendar, it goes back to 0 every reset which, if I'm not mistaken, it should not on a soft reset.I've found that in the MX_RTC_Init function, the date and time are set to the default values (see the CubeMX generated code below)./** Initialize RTC and set the Time and Date */ sTime.Hours = 0x0; sTime.Minutes = 0x0; sTime.Seconds = 0x0; if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK) { Error_Handler(); } DateToUpdate.WeekDay = RTC_WEEKDAY_MONDAY; DateToUpdate.Month = RTC_MONTH_JANUARY; DateToUpdate.Date = 0x1; DateToUpdate.Year = 0x0; if (HAL_RTC_SetDate(&hrtc, &DateToUpdate, RTC_FORMAT_BCD) != HAL_OK) { Error_Handler(); }Removing this piece of code solves the issue but since it is not user code, it is back every time I need to re-generated code.Am I missing something or is this
I fully appreciate that CubeMX is geared towards hobbyists and demo projects.But let's imagine for a second that someone is trying to use this software professionally.I have created a template to generate some custom code with CubeMX and it works as expected. However, in the IOC file my settings are stored as shown below:ProjectManager.TemplateDestinationPath=C\:\\path\\to\\my\\project\\cubemx\\my_project_name ProjectManager.TemplateSourcePath=C\:\\path\\to\\my\\project\\tools\\cubemx-templatesNow imagine someone else is working on this project. Maybe they have checked out the code to a different directory, or maybe they are using Linux. The IOC file is broken for them. If they fix it on their side and commit it, it will be broken for me.Please add support for setting these paths relative to the IOC file itself, so that multiple people can work on the project.By the way, I tried editing the file manually and setting a relative path, but then the file is no longer generated.I am using C
Thus overwriting it every time.When generating this function:/** * @brief USBD_Get_Configuration_Number * Return configuration number * class_type : Device class type * interface_type : Device interface type * @retval configuration number */ uint16_t USBD_Get_Configuration_Number(uint8_t class_type, uint8_t interface_type) { uint8_t cfg_num = 1U; /* USER CODE BEGIN USBD_Get_CONFIGURATION_Number0 */ /* USER CODE BEGIN USBD_Get_CONFIGURATION_Number0 */ /* USER CODE BEGIN USBD_Get_CONFIGURATION_Number1 */ /* USER CODE BEGIN USBD_Get_CONFIGURATION_Number1 */ return cfg_num; }CubeMX version: 6.14.0
When starting a new project in the STM32cubeIDE and selecting the STM32U073C8T6 as the microcontroller, which has 64k flash and 40k RAM, the generated linker script uses 256k flash and 32k RAM. Also the description says that this device has 256k flash.Is this a bug and if so how can this be fixed?How can the linker script be updated to use the correct flash and RAM size?
CubeMX always generates binary semaphores with an initial count of 1 (full) in CMSIS-RTOS2, even if the user wants the semaphore to start depleted (count = 0). There is no option to set the initial count to depleted during configuration, but when generating the code, it will be with initial count of 1./* creation of myBinarySem01 */ myBinarySem01Handle = osSemaphoreNew(1, 1, &myBinarySem01_attributes); /* creation of myBinarySem02 */ myBinarySem02Handle = osSemaphoreNew(1, 1, &myBinarySem02_attributes);only way I solve it is acquiring the semaphore after creating it* USER CODE BEGIN RTOS_SEMAPHORES */ /* add semaphores, ... */ osSemaphoreAcquire(myBinarySem02Handle, 10); /* USER CODE END RTOS_SEMAPHORES */
In my project, I use the RTC with LSI and calibrate it by adjusting the prescaler at regular intervals (e.g., once per day). This method works well on STM32H7, but it doesn't work on STM32H5.On STM32H5, after changing the prescaler, the RTC either stops or doesn't keep correct time.Why is this not possible on STM32H5
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.