Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Hi,I am using Stm32f207 Nucleo board and generated the initialization codes with cubemx.When I run the code with MX_LWIP_Init(); it's not getting executed.Commenting it works fine.Can anyone help me out to solve this issue...
The HAL Timebase Generation using another Timer as SYSTICK is buggy when clocks APBxCLKDivider is switched in runtime. The Timebase is then re-initialized without respect to an (re-) configured APBxClockDivider. The condition if a APBxCLKDivier is set is only evaluated at CubeMx-Code-Generation-Time. Instead of fixing this issue during code generation time (which then does not allow switching APBxClockDivider in runtime) this should be done by those Code-Lines during runtime as the clkconfig struct is already available in the code.: /* Compute TIMx clock */ if(clkconfig.APBxCLKDivider) { uwTimclock = 2*HAL_RCC_GetPCLKxFreq(); } else { uwTimclock = HAL_RCC_GetPCLKxFreq(); }This would work in any case without having a conditional code-generation dependent on the APBxCLKDivider.Regards Pascal
I have an old project on IAR and I have to update it using STM32CubeMx and STM32CubeIDE. Any way to get this done or any advice on this subject is welcome. I am not very experienced with STM32cube.
Hi!I am working on an STM32H7-based project which I am trying to migrate from the DISCOVERY evaluation hardware to custom board. A colleague of mine has created a new `.ioc` file with a newer version of CubeMX than the standalone vesion I have currently installed. Due to lack of admin rights I have to use the CubeMX plugin inside of the STM32CubeIDE until my IT department installs a new standalone version - as the `.ioc` file cannot be loaded with an older version.I can manually create a new STM32 project from that `.ioc` file and generate an STM32CubeIDE project. Then navigating to the "Project Manager" tab only shows "STM32CubeIDE" in the "Toolchain / IDE" dropdown menu which is even grayed out.However, I'd like to automate stuff. I've written a Windows batch script which executes a CubeMX script that can basically be narrowed down to the following lines:SET JAVA_EXE=C:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.jre.win64_2.0.100.202110150814\jre\bin\java.exe SET
I was given a code to add USB support to the firmware. I am using Stm32CubeMX to generated the boiler plate for the USB. I enabled the USB peripheral and reconfigure the clock setting and regenerate the code. When I try building the fresh project after code generation, it is throwing multiple definition error. I need help how to set the option to regenerate the code without the multiple definition. I thought of adding the USB peripheral manually but I believe the clock configuration will prove challenging for me now. Also the project was done with an older version of CubeMX and I used the migration option offered by CubeMX to migrate the project to the current version of CubeMX Thanks
Absolute Newbie here trying to do my first project. I haven't figured out how one gets to write their code and where. I take it we are to use Keil for that part and I do have it installed from other uC work a couple of years ago. Was this supposed to be added to some sort of toolchain during software installation so that it pops up automatically after Code Generation is executed ? If so, can I add it now ? Thanks.
I have used MX up to this point to configure my peripherals. Even though I've manually configured these for most of my career, I'd prefer to keep using MX for this project since it's been successful up to this point. For some reason it doesn't show me the baud rate for SPI2 like it does for SPI3, however (even though it's greyed out due to being constrained). Is this just a bug, or would I discover something specific to SPI2 that's a problem if I try to configure it manually?
When creating project using Board Selector, Nucleo-C031C6, the incorrect MCU pinout definition is created with two errors: I2C1 is activated and pins are assigned for it and USART1 is initialized using PB6&PB7 instead of USART2 with pins PA2&PA3,which is the default hardware config.The generated code for USART2 with DMA has incorrect initialization order (USART2 is initialized before DMA, so DMA doesn't work). It's NOT possible to change the init order using Project Manager - Advanced Settings tab. The only way to get it in order is by editing the main.c but of course re-generating the code restores the original incorrect order.
I'm working with the "NUCLEO-U575ZI-Q" development board and I compile using STM32CubeIDE 1.6.1. I want to use pin PC10 as a 1-wire (half duplex) UART pin and I use CubeMX to generate code with the following settings:Mode: Singe Wire (Half-Duplex)Hardware Flow Control: DisableBaud Rate: 57600 Bits/sWord Length: 8 Bits (including Parity)Parity: NoneStop Bits: 2Data Direction: Receive and TransmitOver Sampling: 16 SamplesSingle Sample: DisableClockPrescalar: 1Fifo Mode: FIFO mode disableTxfifo Threshold: 1 eight full configurationRxfifo Threshold: 1 eight full configurationAuto Baudrate: DisableTx Pin Active Level Inversion: DisableRx Pin Active Level Inversion: DisableData Inversion: DisableTX and Rx Pins Swapping: DisableOverrun: EnableDMA on RX Error: EnableMSB First: DisableWhen I try the following code, it seems the ORE-bit (Overrun error) in UART4-> ISR register is set afterwards (b.t.w, the statement works, i.e. it says Hello in Teraterm):HAL_UART_Transmit(&huart4, (const u
Around 40 tutorial videos are accessible from STM32CubeMX in Help menu/Tutorial videos since STM32CubeMX 6.0.0 release.All those videos intend to answer frequent STM32CubeMX users questions.It deals with various subjects such as FreeRTOS, DMA, GPIO, Software packs, System view tips, Getting started with X-Cube BLE, pinout view tips…Those videos will be available to China users in the next STM32CubeMX release (6.1.0). If you think that some specific tips, features or complex subjects are not yet addressed with these tutorial videos, we will be glad to hear your valuable proposals. Thanks to share your ideas with maximum of details.
Using the STM32 USB stack in a project for the STM32 CubeMX IDE on a STM32L062 processor, there are issues with trying to get the CDC device to send data back up to the host at maximum throughput. If CDC_Transmit_FS() is called twice in a row, then the first packet goes through but the second does not. If you look into the implementation of this function you come across the lineif (hcdc->TxState != 0) return USBD_BUSY;However, if you dowhile(CDC_Transmit_FS()==USBD_BUSY);then the code never breaks out of this loop and no data ever gets to the host. What is the proper way to detect that the USB pipe is available for the device to transmit with ST's USB stack? So far the only way I can get multiple packets to arrive at the host is to doCDC_Transmit_FS(); HAL_Delay(); CDC_Transmit_FS();which is not the way this kind of code should be written and still doesn't guarantee me that all packets should be expected to arrive at the host.
Hello-When using Cube and doing Help->Manage Embedded Software->ST Microelectronics, the X-CUBE-SMBUS package does not appear in the list, even when doing a refresh of available packages. I downloaded the archive from https://www.st.com/en/embedded-software/x-cube-smbus.html but when attempting "From Local" the tool says it doesn't recognize the contents of the file. How can this package get installed then?An alternative is getting a clear example of how to use the files when I just include them by hand. There is an example for the STM32L0538-Discovery but it's an "everything all at once" design and has so much conditional compilation going on it's hard to tell what is supposed to be happening if you just want a host to do simple read/write operations.
Hi everyone,Using the STM32 -F767 board with freertos, and the CubeMX we are trying to change the clock speed via the clock configuration tab in order to lower the power consumption.After changing the HCLK to the desired speed (32MHz) or any other speed, generating the code, and running the application, I can see that the variable SystemCoreClock is indeed changing from the default value of 16000000 to the desired clock speed after calling SystemClock_Config function.But still, the power consumption is staying very high and is not suitable for the consumption we should get with a clock speed of 32MHz.Any ideas on how to approach this issue?Thanks!
Hi all,I'm working on Ethernet interface with STM32F417, I Generate the code by cubeMx for Ethernet stack (lwip).I want to know whats the use of PPS (ETH_pps_out - PB5) in ethernet because neither this pin is connected with phy nor ethernet port rf45.
I think I spotted a bug in CubeMX.Target processor STM32F767ZIT6. Firmware for F7 package 1.16.2.I don't tend to use I2C (it's a terrible hack), so I was surprised when I saw that I had stm32f7xx_hal_i2c.c and stm32f7xx_hal_i2c_ex.c showing in my map file. I checked my Cube model and all I2C devices were disabled, and yet Cube was throwing the I2C support code into my Drivers/STM32F7xx_HAL_Driver/Src and Inc folders. Everything else is accounted for, but I2C??? no thanks.In stm32f7xx_hal_conf.h, I2C is enabled too. If I comment that out and delete the i2c.c files, my project still compiles.A flag from a previous time that didn't get cleared? Not likely, I stay away from I2C for my mental health. Extra cruft.Thanks,Andrei (from The Great White (as in snow) North)
Hi community. I am planning to use memory protection unit (MPU) in my project. My MCU is STM32G031K8 but I cannot find how to activate this function with CubeMX. I would want to do the same as this example;https://community.st.com/s/article/how-to-configure-the-mpu-of-an-stm32-using-stm32cubemxIn addition in the reference manual there is no much information about this function or the registers involved:https://www.st.com/resource/en/reference_manual/rm0444-stm32g0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdfor in the datasheethttps://www.st.com/resource/en/datasheet/stm32g031k8.pdfAn I wrong? or maybe this function is not available for this MCU. According to this is link I can use this function but I am not sure.https://www.st.com/content/ccc/resource/technical/document/application_note/group0/bc/2d/f7/bd/fb/3f/48/47/DM00272912/files/DM00272912.pdf/jcr:content/translations/en.DM00272912.pdfThanks for your help!
I am working with a STM32F429ZIT MCU based board with the LAN8742 interface and some LEDs. I am sure that the Hardware part works correctly because I use this card with a program made with STM32duinoI created a new project by changing only the following things:- Added 3 output GPIOs- Enabled Low Speed Clock (LSE)- Enabled Trace Asynchronous Sw debugging with time SysTick- Enabled ETH and changed the Pin "ETH_TXD0" from PB12 to PG13- FreeRtos enabled with CMSIS_V2 (V10.3.1 and CMISIS-RTOS 2.0)- Enabled LWIP by selecting Driver_PHY in LAN8742- CubeMX version 6.6.1- Added the blink of a led in the primary task cycle using as dalay osDelay ()When I compile the solution the led is always on, if I try to debug it always stops in osKernelStart (); (I don't know how to go ahead with the debugger once I get to this point)Commenting out the line "MX_LWIP_Init ();" automatically generated by STMCubeMX, the LED flashes correctly againReading on a forum I had found an article where they said that
I am trying to write an STM32 as an I2C slave:I wrote a code for it but when I run it, however, I get some weird stuffHere is the response when the master requests a buffer: You can see the NACK at the end right after the slave finishes sending the last bytefor a master Write/Slave RCV operation: it goes wrong after writing the 2nd byte of the buffer. Why Am I having this? I'd scratched my head for months on this at this point Here is the I2C code section of the STM32 slave:/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file i2c.c * @brief This file provides code for the configuration * of the I2C instances. ****************************************************************************** * @attention * * Copyright (c) 2022 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
Can you recommend me any link showing how to configure it in CubeMX and what I have to do to write and read the SD card. I have checked this https://controllerstech.com/interface-sd-card-with-sdio-in-stm32/ and it's working but no with freeRTOS. Not only when I move the code to taksa, but also if I leave it before starting tasks. It is enough to generate a code for freertos. I have also tried this https://www.programmersought.com/article/85814787223/ and this time it's mounting outside the task, but inside it's hanging out. And akso a lot of others site.
I want to get it right this time, once for all.My target would be future people (or me but balder) taking over my legacy code, so only technical medium exdperienced embedded programmers.Does anyone has experience doxygeing cubeMX generated code?i am getting too much unnecesary stuff dragged in the doxy layouts. Ive had it this ways so far:"my code speaks for itself, no need for comments"Just a pdf explaning some of the abstractions (written by hand, ppt feeling to it)Doxygen generated http (like this)Doxygen+Sphyinx, this does make a very appealing format, i wonder if it works for embedded also (like this)
Hello,I'm evaluating different solutions for USB Power Delivery and I wanted to try out STUSB010 software library. I downloaded the library from the official ST website (STSW-STUSB010 v1.3.0) and I opened a project on STM32CubeIDE 1.9.0 on a Linux machine.The project does not build by default (as is, directly from the zip without any modifications), it seems like it is not trying to link the USB PD library. I'm not very familiar with the IDE and for the life of me I can't figure out how to fix the generated compiler command. I can't post the compiler output here, the form complains about the post being too long. I get a bunch of errors like this one:arm-none-eabi-gcc -o "STM32F072_MB1303_DRP_SRCING_DEVICE.elf" @"objects.list" -mcpu=cortex-m0 -T"/home/andres.oliva/Downloads/en.STSW-STUSB010/STSW_STUSB010_v1.3/Projects/STM32F072RB-Nucleo/Appli/usbpd/STM32F072_MB1303_DRP_SRCING_DEVICE/STM32CubeIDE/STM32F072RBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="STM32F072_MB1303_DRP_SRCING_DEVICE.map
MCU getting into PrvTaskExitError while trying to acquire the semaphore using vTask Producer(after MCU run for Several Hours). Please find the screen shorts of the Fault Exception viewer and Callstack after the MCU crash. MCU: stm32f407VGT6Hardware Type: Proprietary HardwareIDE: IAR Embedded Workbench IDE 9.20.1RTOS: CMSIS V2(Code generated from Stm32CubeMX) Thank youPS: any help on this is greatly appreciated.
I have update STM32CubeMX to newest 6.6.1.when I use STM32F412RE with PDM mics, enable the DFSDM module.STM32CubeMX generated dfsdm.c, raise compile error, duplicated variables.And I have find this same code duplicated two times. The older STM32CubeMX did not have this issue, but I forgot the actual version...code:```static uint32_t DFSDM1_Init = 0;```
When I attempt to build the project on CubeMX V6.6.1 / V1.10.0 I get the following error:[ 1%] Building C object cubemx/CMakeFiles/cubemx.dir/Drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c.objarm-none-eabi-gcc: error: /home/dan/Projects/davenport-ecu/cubemx/Drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c: No such file or directory arm-none-eabi-gcc: fatal error: no input filescompilation terminated.make[2]: *** [cubemx/CMakeFiles/cubemx.dir/build.make:76: cubemx/CMakeFiles/cubemx.dir/Drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c.obj] Error 1make[1]: *** [CMakeFiles/Makefile2:322: cubemx/CMakeFiles/cubemx.dir/all] Error 2make: *** [Makefile:136: all] Error 2I get the same error if I try to stay with STM32CubeMX FW_H7 V1.8.0 and build with STM32CubeMX V6.6.1If I revert back to a library built with STM32CubeMX V6.1.1 with STM32CubeMX FW_H7 V1.8.0 it builds without errors.I have tried deleting the generated folders and the .mxproject f
Hi all,I use STM32CubeIDE Version: 1.10.1 and Cube MX Version 6.6.1. On an STM32H745 Evalboard. The grafical interface was created under TouchGFX. In my project, I added a ADC module on port PC0 (ADC123_IN10). The selected PIN is not used by the LCD. But I have a warning apart from the ADC1 (and also, if I would use other ADC2 or 3). With this selection, I am able to generate the code. My problem is, when I select the Channel 10 and choose IN10-Single ended, I cannot build my project anymore. If I have the selection in Cube MX, create a pair .c/.h, I get even more linker errors. Does sombody knows, what happen? How can I solve this? Is it a problem of the usage or from the tool? Thanks,Jan
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.