Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Hi, I just updated my version of STM32Cube IDE (1.17.0) on my PC, and I miss the "INITIALIZE ALL PERIPHERALS IN DEFAULT MODE" when I start a new project with my NUCLEO-H723ZG board. Instead of that, I have a new popup, "Board Project Options" with only HMI things, and it results in the ETH not being initialized for example. Maybe I have missed some settings? Is the "INITIALIZE ALL PERIPHERALS IN DEFAULT MODE" mode still available in this version?Thank you for your help
Folks,I’m grappling with what looks like a low level bug** , and the root cause could be running out of stack space. At the same time, I’ve got plenty of unused RAM, so I’d like to increase the stack size as a diagnostic measure, and see if the bug goes away*** . In the CubeIDE user guide (UM2906) there’s a mention that heap and stack size are set in the LinkerScript.ld (comments in the code on p. 69).If I want to change the _Min_Stack_Size , should I edit the LinkerScript.ld file directly?Or is the LinkerScript.ld file (re)generated by the IDE, and I should make the change through the IDE GUI?If so then where are these settings? I couldn't figure it out from the UM2906. I saw hints that CubeMX had GUI fields settings for stack and heap. ** Can post the details of the bug if anyone’s interested.*** Don’t know if that’s the right long-term solution. I could also try to declare fewer string buffers on the stack. Best regards,- Nick
Dear STMicroelectronics Team,First of all, I would like to thank you for providing such an excellent tool as STM32CubeMX, which has been incredibly helpful for embedded system developers like me.However, I have noticed that the STM32CubeMX icon, being a square shape, does not blend well with the macOS design language, where most app icons follow a rounded square or circular aesthetic. This makes the icon stand out in an inconsistent way when placed in the Dock or Launchpad.To improve the overall user experience for macOS users, I would like to suggest redesigning the STM32CubeMX icon to better align with macOS design conventions. For example, a rounded square icon with cohesive colors and branding would look much more visually appealing while maintaining the identity of the tool.Thank you for considering this suggestion. I hope it can lead to a small but impactful improvement for macOS users of STM32CubeMX.
Another question are no UVC can select in the CubeMX USB class.
I use CubeMX + VSCode + arm-gcc + makefile to compile embedded programs. CubeMX v6.12 create wrong stm32fxxx_flash.ld file. Some words like "RAM" is lacked. And CubeMX v6.11 and CubeMX v6.10 is right.
Hi all, my first post here, being new to STM32..I have an STM32F439ZI Nucleo for which I have ADC1 nicely capturing data with TIM2 defining the sample rate and circular DMA.This was working well until I regenerated the code using the option to initialize peripherals using separate file pairs for each peripheral. I realise that switching to that option doesn't handle migration of all User code as it should, that's OK, I could easily copy over the relevant code.However, the new version is still broken: the ADC conversion complete callback it firing at the expected rate, but all ADC data are zero. When I switch back to code generation not using separate initialization files, the everything starts working again.My application is also using DMA to drive an LCD, which is working OK, so DMA clearly isn't fundamentally broken.I've carefully checked each of the init functions that are moved into the newly created files (dma.c/h, adc.c/h, tim.c/h etc), and I can't see anything that's changed, no
Hello,what is the best way to run some of the demos provided by CubeMx on a custom HW?Probably like this: Generate demo code for an evaluation board. Then merge the generated initialization code for the custom board into the demo code folder?Or can CubeMx generate directly demo code for custom HW e.g. pick a demo for an evaluation board and import the custom board .ioc?I've read somewhere here that this would be possible in future?ThanksEDIT:After reading some related threads here, I think I have to provide some additional information.The custom design based on a STM32H753 / LQFP176. Most of the IOs (USB, SDRAM, FLASH, ETH etc.) is nearly the same on the HWSTM32H753_EVAL2. I guess most of the demos would work on the custom HW out of the box but the pinout of the BGA package is different.I guess the examples for this evaluation board are not "CubeMx compatible", what probably means that the code is not generated using CubeMx? Because of this, no IOC is available? If somebody has created
Hello everyone,I am now using a MacBook Pro with M4Pro chip, running STM32CubeMX 6.13.0 with MacOS Sequoia 15.2 (24C101) Darwin 24.2.0When SIP (System Integrity Protection) is on, an error of Eclipse occurred each time trying to generate code in STM32CubeMX (I am using STM32H723, if it matters). The message was "The Eclipse executable launcher was unable to locate its companion shared library." And the initial code didn't generated properly. I tried open CubeMX in terminal to see what happens (executing /Applications/STMicroelectronics/STM32CubeMX.app/Contents/MacOs/STM32CubeMX), the log was: dlopen(/Applications/STMicroelectronics/STM32CubeMX.app/Contents/Resources/third_parties_plugins/binaries/STM32CubeIDE-MX-services/revA/macosx/cocoa/x86_64/Eclipse.app/Contents/MacOS//../../../../../../pool/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.2.800.v20231003-1442/eclipse_11802.so, 0x0002): tried: '/Applications/STMicroelectronics/STM32CubeMX.app/Contents/Resou
I am using the pwm in stm32 to control the mass flow meter, then at first set up the pin interface inside the stm32cubemx, using the GPIO PA0 for the control of the valve on and off, and then PA1 to control the output of the PWM signal to the flow meter, and set up the clock frequency in the stm32cubemx, and then finally generate the preliminary code using MDK-ARM to generate the then modified some code in KEIL, but after jlin burned into the stm32, in the process of debug, a run up on the registers clear, showing that the CPU can not be stopped, do not know how to solve, I am a novice, I hope that there is a big brother to solve the problem!
The generated code for the CM7 core, file main.c includes "cmsis_os.h", this should include "cmsis_os2." instead because of the V2 interface. The correct file "cmsis_os2.h" is in the Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 directory, the project needs to have that directory added and the CMSIS_RTOS (without _V2) can be removed from the project search path. My compiler is IAR if that makes a difference, MCU and Firmware package is STM32Cube_FW_H7 V1.9.0
I'm trying to boot the M7 core on a STM32H747 with a 480MHz clock rate. I have the project and clock settings configured in STM32CubeMX. When ran, the program freezes while waiting for the VOSRDY flag to be set, which never happens.The code appears to be doing everything it should per the reference manual:The sequence to activate the VOS0 is the following:Ensure that the system voltage scaling is set to VOS1 by checking the VOS bits in PWR D3 domain control register (PWR D3 domain control register (PWR_D3CR))Enable the SYSCFG clock in the RCC by setting the SYSCFGEN bit in the RCC_APB4ENR register.Enable the ODEN bit in the SYSCFG_PWRCR register.Wait for VOSRDY to be set.Once the VCORE supply has reached the required level, the system frequency can be increased.The code is as follows: __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} // <--- FREEZES HERE which runs this: if((__REGULATOR__) == PWR_REGULATOR_
I'm using STM32CubeIDE to configure UCPD1 on STM32G0B1KET6N. My firmware package is FW_G0 V1.6.2I enable DMA: UCPD1_RX = DMA2 Channel 1, UCPD1_TX = DMA2 Channel 2The generated code in MX_UCPD1_Init can't compile because the DMA init code is bad. The section labelled /* UCPD1_RX Init */ should start with this:LL_DMA_SetPeriphRequest(DMA2, LL_DMA_CHANNEL_1, LL_DMAMUX_REQ_UCPD1_RX);... but it actually starts with this:LL_DMA_SetPeriphRequest(DMA2_Channel1, DMA2_Channel1, LL_DMAMUX_REQ_UCPD1_RX);Compare the first two parameters. Luckily, the compiler chokes on this and it's obvious how to fix it. There are 8 lines with this bug for the RX DMA, and 8 lines for the TX DMA.I don't know if my other UCPD settings influence the bug:UCPD mode = sinkDead battery enabledUSB/UCPD1 interrupt enabledDMA1 4-7 / DMA2 1-5 / DMAMUX1 interrupt enabledPins PB15, PA8, PA9, PA10 are all configured for their UCPD1 functions.
I *think* that the check on line 7 below is to make sure that wait doesn't overflow when adding uwTickFreq. This isn't guaranteed to work unless uwTickFreq is 1. __weak void HAL_Delay(uint32_t Delay) { uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay; /* Add a period to guaranty minimum wait */ if (wait < HAL_MAX_DELAY) { wait += (uint32_t)uwTickFreq; } while ((HAL_GetTick() - tickstart) < wait) { } } You can do the following instead to catch the potential overflow (forgot a cast of uwTickFreq and I don't see a way to edit the code). __weak void HAL_Delay(uint32_t Delay) { uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay; /* Add a period to guaranty minimum wait */ if (wait <= HAL_MAX_DELAY - uwTickFreq) { wait += (uint32_t)uwTickFreq; } while ((HAL_GetTick() - tickstart) < wait) { } }
HiI can not find out how to correctly use a Virtual Port Com over USB.I used STM32CubeMx to configure the USB_OTG_FS and USB_DEVICE middleware. I selected the Class "Communication Device Class (Virtual Port Com).I found the CDC_Transmit_FS() function to send data. It works, but I have a problem:When calling this function twice short after each other, not all data is send. Do I have to check if transmission has ended before calling again? If so, which function does that?I'm not sure that I use the correct function because when compiling I get the warning that this function is implicitely declared. So I mis the correct include file. I can get rid of the warning when including "usbd_cdc_if.h". But normally when using STM32CubeMx one does not have to include extra files to make things work. So I'm not sure I'm doing the right thing.I can not find a simple USB VPC example that just sends one or more strings over the USB. (I'm using STM32H743)
Hello,I am new to programming STM MCUs and currently working with an STM32H745I-DISCO board.I am trying to implement a simple blink project. In CubeMX, I created a new project and configured pin PJ2 as an output push-pull. Then, in the Project Manager tab, I selected the Toolchain/IDE: STM32CubeIDE.However, when I generate code and open the project, I can’t see any lines of code configuring the PJ2 pin.I’m not sure if I’m doing something wrong or if there’s a bug in the software. I’ve spent several days trying to figure out how to set up a simple blink project. Could someone please provide any clues or guidance?Thank you in advance.
I'm trying to do a Project with the MAX30102. I can read out the raw data of the sensor but I am unable to understand the algorithm to calculate the Heartrate and SPO2 out of the raw data. The only examples I can find are for Arduino Boards but that's not useful at all. I found this one Example for the STM32F103C8T6 and I was hoping I could just convert it for my board so at least I got something that works...Here is the link for the example:https://www.programmersought.com/article/90827305857/I have the code in the attachment.I hope somebody can help me.best regards,F.Enis
my english is not good,i use chatgpt to help me to generate this post.Hello,I am working on a project with the STM32H750 microcontroller using CubeMX-generated code and HAL library. My system clock configuration is as follows:HCLK: 240 MHzPCLK2: Configured via D2PPRE2I encountered an issue related to HAL_RCC_GetPCLK2Freq() and UART configuration. Here is the detailed description:Issue DescriptionWhen D2PPRE2 (APB2 prescaler) is set to no division (DIV1), HAL_RCC_GetPCLK2Freq() correctly returns 240 MHz, and the UART works as expected at the configured baud rate (e.g., 115200).However, when D2PPRE2 is configured to divide by 2 (DIV2):HAL_RCC_GetPCLK2Freq() still returns 240 MHz (unaffected by the prescaler).The UART actual baud rate becomes half of the configured value (e.g., if I configure 115200, the actual baud rate is 57600).This indicates that the prescaler is applied to PCLK2 in hardware, but the HAL function does not account for it correctly.Steps to ReproduceConfigure D2PPRE2 to
Dear, All.I am trying to use HSE, but I ask for your help by continuously returning HAL_TIMEOUT from the HAL_RCC_OscConfig() function.The test environment is as follows.BOARD: NUCLEO-F303K8T6IDE: STM32CubeIDE (latest version)FIRMWARE: STM32Cube FW_F3 V1.11.3The code generated by CubeIDE is as follows, and it is automatically generated, and the code has not been modified at all. RCC Mode is set to BYPASS Clock Source and Master Clock Output is disabled.RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;RCC_OscInitStruct.HSIState = RCC_HSI_ON;RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK){Error_Handler();}If HSI is used, it works fine even if it is set to 64 MHz.With HSE, several other NUCLEO-F303K8 HAL_TIMEOUT returned from the same location. And I don't remember exactly when I tested it, but when I tested it with CubeIDE a few years ago, everything worked fine.The code that c
I upgraded from v1.11.1 to v1.11.2. Now it won't even compile due to bugs in ST code: ../Core/Src/USB/stm32h7xx_hal_hcd.c:1070:18: error: conflicting types for 'HAL_HCD_GetState'; have 'HCD_StateTypeDef(HCD_HandleTypeDef *)' ../Core/Src/USB/stm32h7xx_hal_hcd.c:1089:21: error: conflicting types for 'HAL_HCD_HC_GetURBState'; have 'HCD_URBStateTypeDef(HCD_HandleTypeDef *, uint8_t)' {aka 'USB_URBStateTypeDef(HCD_HandleTypeDef *, unsigned char)'} ../Core/Src/USB/stm32h7xx_hal_hcd.c:1102:10: error: conflicting types for 'HAL_HCD_HC_GetXferCount'; have 'uint32_t(HCD_HandleTypeDef *, uint8_t)' {aka 'long unsigned int(HCD_HandleTypeDef *, unsigned char)'} ../Core/Src/USB/stm32h7xx_hal_hcd.c:1124:21: error: conflicting types for 'HAL_HCD_HC_GetState'; have 'HCD_HCStateTypeDef(HCD_HandleTypeDef *, uint8_t)' {aka 'USB_HCStateTypeDef(HCD_HandleTypeDef *, unsigned char)'} ../Core/Src/USB/stm32h7xx_ll_usb.c:551:19: error: conflicting types for 'USB_SetDevSpeed'; have 'HAL_StatusTypeDef(USB_OTG_G
Shouldn't CubeMX 6.01 create the #defines that coorespond to newly added User Labels in an existing project ? Of course it works if I add the User Labels as #defines manually. If this is the expected design behavior, please let me know...Thanks,Heather
Posted on April 15, 2015 at 13:12Hello all, I have an STM32CubeMX (v4.7.0) project for the STM32L1xxx. I recently updated the Firmware Package to V1.2.0 but I cannot make the project use this new version (I cannot change the value for Firmware Package Name and Version in Project tab of Project ---> Settings option). How can you do that? Best regards PS Cube shows both firmware packages v1.1.0 and v1.2.0 to be installed. Is this OK? Is there a way to uninstall an old version? #stm32cubemx-project-configuratio
Dear Sir, Hardware: STM32H7B3I-DKSoftware: STM32MX 6.12.1 / STM32CubeIDE 1.16.1 / TouchGFX 4.24.1/ STM32Cube_FW_H7_V1.11.0/2 Programming for using the STM32H7B3I-DK according to STM32 Graphics Workshop; started with STM32MX, did each step refer to the pdf file (EXTRA-Lab Startup Project Full CubeMX Setup.pdf from Slides.zip). After completion of the programming, fixed some errors found from build errors by myself; but this MX_I2C4_Init__have void (void) build error still remain. Below are the build errors message details:1.main.c:76:13: error: conflicting types for 'MX_I2C4_Init'; have 'void(void)' 2.BSP/STM32H7B3I-DK/stm32h7b3i_discovery_bus.c:266:26: note: previous definition of 'MX_I2C4_Init' with type 'HAL_StatusTypeDef(I2C_HandleTypeDef *, uint32_t)' {aka 'HAL_StatusTypeDef(struct __I2C_HandleTypeDef *, long unsigned int)'} 266 | __weak HAL_StatusTypeDef MX_I2C4_Init(I2C_HandleTypeDef *hI2c, uint32_t timing) Please refer to attached screenshots:
Is it possible to move and/or to copy/paste pin configurations from one pin to another?If yes, how?If not - feature suggestion!
Hello,New to this forum and quite new to STM32 platform, so hi to the community! I have trouble setting up comparator on board nucleo-stm32G0b1RE. I've been following some tutorials on how to setup through stm32CubeMx, I believe I have the settings right, but I can't make the comparator work, it doesn't trigger the interrupt when I switch the input. Here is what I have so far:in .ioc fileAfter code generation, I manually added the callback in main.c:void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp) { HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); }And I believe the interrupt handler was setup allright. The interrupt triggers normally for the ADC (but not for COMP):/** * @brief This function handles ADC1, COMP1,COMP2, COMP3 Interrupts (combined with EXTI 17 & 18). */ void ADC1_COMP_IRQHandler(void) { /* USER CODE BEGIN ADC1_COMP_IRQn 0 */ /* USER CODE END ADC1_COMP_IRQn 0 */ HAL_ADC_IRQHandler(&hadc1); HAL_COMP_IRQHandler(&hcomp2); /* USER CODE BEGIN ADC1_COMP_I
Hello, I see in code generated by all Linux versions of CubeIDE that USER CODE BEGIN and USER CODE END tags in infinite loop, are not in the better place.Code generated by Cude IDE: /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } The USER CODE BEGIN WHILE is outside the loop, and the USER CODE BEGIN 3 is into the loop.I think it would be better, especially for beginner programmers, something like this: /* Infinite loop */ while (1) { /* USER CODE BEGIN WHILE */ /* USER CODE END WHILE */ } /* USER CODE BEGIN 3 */ /* USER CODE END 3 */Or is there some reason to generate the code like the above? Greetings
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.