Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
LL Code generated by the CubeMX:ADC_InitStruct.Resolution = LL_ADC_RESOLUTION_12B; ADC_InitStruct.LowPowerMode = LL_ADC_LP_MODE_NONE; LL_ADC_Init(ADC3, &ADC_InitStruct);The define "LL_ADC_RESOLUTION_12B" should be value "0" (as per ADC3 datasheet).However it seems to use the ADC12 define which results in value "2":/** @defgroup ADC_LL_EC_RESOLUTION ADC instance - Resolution * @{ */ #define LL_ADC_RESOLUTION_16B (0x00000000UL) /*!< ADC resolution 16 bits */ #define LL_ADC_RESOLUTION_14B ( ADC_CFGR_RES_0) /*!< ADC resolution 12 bits */ #define LL_ADC_RESOLUTION_12B ( ADC_CFGR_RES_1 ) /*!< ADC resolution 12 bits */ #define LL_ADC_RESOLUTION_10B ( ADC_CFGR_RES_1 | ADC_CFGR_RES_0) /*!< ADC resolution 10 bits */
I actually have a Nucleo and a custom board. They are running same software and are very identical in terms of hardware but not identical: but there is at 2 pins that need to be changed and UART added: set baud rate, set NVIC IT. I also have to insert my IT handler once CUbeMX updated files (in stm32xxx_it.c)I wonder if i could handle 2 differents layout (via ie a new target or a new board, as mentionned in CubeIDE), but i have no idea how to support this.I guess i should have 2x .ioc files, and eventually a couple of scripts to start CubeMX generation and copy/paste the IT callback (although it coudl overwrite CubeMX generated file).Any idea on how to do this ? Thank you !
I converted project from C to C++ with right click on project-> Convert to C++. The problem occurs when I generate the code in graphic configurator . It creates main.c file. Which is also loaded to controller if I run it. How to solve this problem?
Good afternoon....Can someone tell me how to use constants that are #defined in main back in the .ioc file? I have run the CubeMX and generated the ioc file then generated main. I then do work in main and make some changes to the initialization features that CubeMx generated. Now I am finding (for other reasons) to go back into CubeMx but each time I regenerate I overwrite the #defines with values. Is there a way to just fill in the integer values with constant names in the ioc file ??? Is there a way to do variables from main backwards to the ioc file (guessing not here but wanted to ask)???ThanksSteve
I'm trying to get my embedded skills back from many years ago, so I have an STM32L475 L475E board I am working with. I am using Blinky to reference from, but I can't get the output pin to toggle in the thread for the flashing led./* Private defines -----------------------------------------------------------*/ /* USER CODE BEGIN Private defines */ #define I_GPIO_PORT_A GPIOA #define I_GPIO_PORT_B GPIOB #define I_GPIO_PORT_C GPIOC #define I_GPIO_PORT_D GPIOD #define IT_ENCODER_CH1_A GPIO_PIN_0 #define IT_ENCODER_CH2_A GPIO_PIN_1 #define I_ENCODER_CH1_B GPIO_PIN_2 #define I_ENCODER_CH2_B GPIO_PIN_7 #define IT_FRONT_BUMPER GPIO_PIN_2 #define IT_REAR_BUMPER GPIO_PIN_3 #define IT_LF_SIDE_OPTIC GPIO_PIN_4 #define IT_LR_SIDE_OPTIC GPIO_PIN_5 #define IT_RF_SIDE_OPTIC GPIO_PIN_8 #define O_DIR_CH1 GPIO_PIN_1 #define O_PWM_CH1 GPIO_PIN_2 #define O_PWM_CH2 GPIO_
I migrated an STM32F401 project from CubeMX 6.3.0 to CubeMX 6.4.0 (on a Windows 10 machine),Now, after the migration, I see that some files are missing in the C_SOURCES list in my customized makefile.All files of the following paths are missing, respectively have been removed by CubeMX 6.4.0 from the previous (working) makefile.Drivers/STM32F4xx_HAL_Driver/Src/... Middlewares/Third_Party/FreeRTOS/Source/... I did a lot of such makefile project migrations in the past, starting from STM32CubeMx 4.x, and I never experienced such a problem till now. (I experienced other issues like CubeMX not correctly initializing variable "uwTickPrio", but that are different stories...)I also see changes in the generated .mxproject file (by CubeMX 6.4.0), that could be a hint about what's going on here.1.) There are now backslashes in the paths instead of forward slashes(?)2.) The HeaderPath and the SourcePath became relative instead of absolute.excerpt of .mxproject file by CubeMX 6.3.0 (before mi
Hello all, I just start a new project with STM32CubeMX v6.3.0, STM32CubeIDE v1.7.0 & STM32F103RC. When I add the SDIO @ CubeMX, the program just freeze @ MX_SDIO_SD_Init. So I go deeper & find out in function SDMMC_GetCmdResp1, SDIO_FLAG_CTIMEOUT flag is set, causing error status. And the error handler always loop back to MX_SDIO_SD_Init. Can anyone repeat my problem? Attached please find my project
I am very new in STM32, earlier i tried it on CubeMX but no use of it.now i want o start code on register base. like belowlike, https://controllerstech.com/how-to-setup-uart-using-registers-in-stm32/but i am not getting where is alternate function chart ,there i can assigned UART to GPIO.thanking you
I downloaded this package >750Mb to get acquainted, see screen.How can I remove it?
Called from SystemClock_Config.The pointer is clearly ok, as you can see in the Vars window, but the check detects it as null and exits with HAL_ERROR.Doesn't make any sense, any thoughts?
I use STM32CubeMX6.3.0 to config DAC ,DMA ,TIM2,and gererate projec for MDK,the initial order is below(auto create by STM32CubeMX6.3.0): MX_GPIO_Init();MX_DAC_Init();MX_DMA_Init(); MX_TIM2_Init();then I create a buffer for sin wave,data,and start DAC:HAL_TIM_Base_Start(&htim2); HAL_DAC_Start_DMA(&hdac,DAC_CHANNEL_1,(uint32_t *)sin_wave,256,DAC_ALIGN_12B_R);but no wave !I must change the initial order manually to below: MX_GPIO_Init();MX_DMA_Init();MX_DAC_Init(); MX_TIM2_Init();then the sin wave is generated by DAC+DMA+TIM2.is this a bug for STM32CubeMX6.3.0?
Hi, I would like to use cubeide (MX tool) to generate a project that use EXTI_13 but with IRQ disabled by default. I can choose Enable/Disable (generate all code or none), Create code on MSPInit function or in MX_NVIC_Init, call HAL_GPIO_EXTI_IRQHandler(EOC_MAG_Pin); on EXTI15_10_IRQHandler or doesn't but I can't choose that some IRQ have to start disabled on the generated code.Thank
The code generator is inserting the DMA_Init() and BDMA_Init functions in the wrong place, leaving DMA not working unless I manually move them after every call code generator run.I place them in the USER CODE segment above the INIT segment then remove the auto generated versions each time otherwise DMA doesn't work. /* USER CODE BEGIN SysInit */ MX_BDMA_Init(); MX_DMA_Init(); /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_USART3_UART_Init(); MX_USART2_UART_Init(); MX_TIM2_Init(); MX_DMA_Init(); // PLACED HERE BY CODE GENERATOR MX_LPUART1_UART_Init(); MX_BDMA_Init(); // PLACED HERE BY CODE GENERATOR MX_I2C1_Init(); MX_TIM3_Init(); /* USER CODE BEGIN 2 */
I am currently working on the STM35U5 family using STM32CubeMX, and I see that none of the code generated is using the standard libraries.Why is that? Should I avoid using standard libraries in my application code ?
Hi,When I set the USB class to anything in CubeMX, the compiler gives me the error - FLASH overflow. It happens even with a completely empty main.c file, so is there a way to make it work, or should I choose MCU with 32kB flash (it will fit then)? The current one has 16kB.
With STM32CubeIDE 1.7.0 (Windows) I try to setup SPI2 with DMA at an Nucleo-G431RB.After starting with an new STM32Cube C-Project for the Nucleo-G431RB with all peripherals at their default settings, I enable SPI2:Full-Duplex Master at PB[15:13]8bitsprescaler at 16all other settings at their defaultsA simple HAL_SPI_TransmitReceive(&hspi2, tx_buffer, rx_buffer, BUFFER_SIZE, 100);works as expected and I am able to transmit and receive data.If I then enable the SPI2_RX and/or SPI2_TX DMA in the Device Configuration, I am no longer able to upload the generated binaries to the Nucleo board: STMicroelectronics ST-LINK GDB server. Version 5.9.1 Copyright (c) 2021, STMicroelectronics. All rights reserved. Starting server with the following options: Persistent Mode : Disabled Logging Level : 1 Listen Port Number : 61234 Status Refresh Delay : 15s Verbose Mode : Disabled SWD Debug : Enabled InitWhile : Enabled Waiting for debugger connection... Debugger connected
I'm generating a CubeMX project for STM32H753.In the clock config, set the systick divisor 8 (see picture).Difference in the ioc file: for divisor 1:RCC.CortexFreq_Value=400000000For divisor 8:RCC.CortexFreq_Value=50000000RCC.Cortex_Div=SYSTICK_CLKSOURCE_HCLK_DIV8But the generated code is same for divisor 1 and 8.I don't understand where this divisor is used
I am using the following settings: STM32 CubeMX version 6.3.0Microcontroller: STM32L4P5ZGTxPEnabled peripherals: ADC1: SCAN mode: disabledCONT and DISCONT mode disabledContinuous DMA requests enabledUsing EXTI 11 to runDMA1 channel 1: Circular modeMemory word incrementsNo DMA synchronization requestsWhen I generated the code (checked for both Keil and Cube IDE), the initialization part of the main looked like this: ... MX_GPIO_Init(); MX_ADC1_Init(); MX_DMA_Init(); ...The ADC runs, and if the interrupts are set, you'll get the interrupts. But the DMA callback routine is never entered. When I changed the order to first initialize the DMA, and then the ADC1, the problem was solved. I would like to see if anyone can confirm this, or is it due to something else (possibly?).
Hi, When selecting LSI as output for LSCO pin, and generating code with integrated STM32CubeMX, no output is seen on LSCO pin. I have to manually add a call to this to see LSI on LSCO pin.HAL_RCCEx_EnableLSCO(RCC_LSCOSOURCE_LSI);When using MCO pin instead of LSCO pin, the code for source clock selection is generated correctly.I'm using STM32CubeIDE v1.7.0. and STM32L432KCU MCU.Thanks and kind regards,Pedro.
What is new in STM32CubeMX V6.4.0? • Added the support for new part numbers in the STM32L4 Series and STM32L4+ Series: STM32L443CCFx, STM32L452CETxP, STM32L452REYxP, STM32L476QGIxP, STM32L496QGIxS, STM32L4R5AIIxP, STM32L4R5QGIxS, STM32L4R5QIIxP, and STM32L4P5QGIxS • Enhanced the support of the cohabitation between Azure® RTOS USBX or USB and USB-PD for the STM32U5 Series and STM32G0 Series, making it possible to enable and disable the USB support from USB-PD middlewareKnown limitationsPlease refer the the release noteMain fixed issues107294 [STM32CubeMX-FreeRTOS] Heap usage estimation seems to be incorrect (using a static timer with CMSIS-RTOS v2). 107991 [STM32H7][Single core] NC balls F1 and G2 for TFBGA240+25 to be defined as VSS. 108330 [STM32CubeMX-STM32H7][FMC] SDRAM1/2 cannot be enabled. 109086 [STM32CubeMX-RCC] Wrong maximum allowed frequency for FMC. 109427 MCO2 PLL clock issue in STM32CubeMX V6.2.1. 109542 [STM32CubeMX-SAI][STM32H7] Faulty number of microphone pairs displayed
I am using CAN in normal mode and produced code using STM32CubeMX ide for Keil uVision IDE. While running the code my program stuck in HAL_CAN_INIT(). It produces a timeout error.I am not having any CAN transceiver so I am having only STM32 Nucleo Board connected to the power supply.So How to resolve this issue. Is there any way to debug the code without transceiver?
I've been developing with STM32F4 products for years. Never used HAL or Cube products as I've hand configured everything.Beginning a new MultiCore project using STM32H745. I find using CubeMX that when I select a peripheral (like SDMMC1 or SAI4 for example) - the tool selects what pins it wants to assign - and will NOT let me assign a different alternative pin.How can I force the tool to use MY pin selection?If I have used one of the peripheral default pins for something else - It make the whole peripheral RED and will not take my inputs.So far I find the tool very unusable so I'm hoping someone can tell me how I can tell the tool what I want - not what it wants.Please Note - Use SAI4 for example - I selected the alternative pin, I assigned its function from the dropdown list - but when I try to enable the peripheral - its ALL RED - so I have pins assigned but no peripheral enabled or recognized for code generation. Thanks
I have a working H743zi2 FW 1.7 which does a ping and web respond and works great.I moved to FW 1.9 and a new project now fails to even ping.The interesting part is that if I run the project based on FW1.7 first, keep power on, then run the one based on FW1.9 the new project works.If I power down then back up it then stops working.It looks like FW1.9 is now not initiallising something properly. Its pretty clear as its completely repeatable.I have checked the IO (as it now defaults to Slow on ETH pins) and forced it to Very High. Still not a fix.Has anyone any ideas. Clearly something got broken from FW 1.7 to 1.9, which is frustrating.If I can get it working then I have a working solution that from reading other posts I'm sure would be useful!
Hello Friends,I have a problem about Uart send via DMA. I had created a configuration via cube. the configuration has Uart2 Rx on DMA1 channel6 and Uart2 Tx on DMA1 channel7. Both of DMA channels are in normal mode. Uart2 interrupts are closed. My MCU platform is Nucleo-L476RG. I use hercules for uart tx rx tests. My aim is to send and receive messages with DMA without Uart Rx and Tx interrputs. I have to use HAL library but I don't like it, I'm used to using CMSIS library :( I can receive messages many times from terminal without uart receive interrupt, but I can send message only once. When I try to send another message to terminal, there is no happen. I checked it in debug mode, I saw that HAL_UART_STATE_READY was busy in stm32l4xx_hal_uart.c file. I would like to point that message that was sent only once after reset can sent completely. HAL_UART_TxCpltCallback doesn't run when DMA send proccess is complete. But DMA1_Channel7_IRQHandler run two times (transfer half and full complet
There are a lot of entries about this problem as I saw. But I also want to tell my story :DSTM32F407VE is used as MCU and USB3320 is used as external PHY for obtaining high speed rate in USB operations. And, STM32CUBE IDE is used to generate code and debug the code in MCU in my PCB. the initial optimizations for USB_OTG_HS and CDC Class are done according to documents in literature, and then the clock that is sent to MCU(from USB3320) is 60 Mhz. However USB_CoreInit() function in HAL Driver of " stm32f4xx_ll_usb.c " return to HAL_TIMEOUT and MX_USB_DEVICE_Init() goes into directly while(1) loop inside the "Error Handler". As shared code below;USB->GRSTCTL |= USB_OTG_GRSTCTL_CSRST; do { if (++count > 200000U) { return TIMEOUT; /// After counter code returns with TIMEOUT error\\\ } } while ((USB->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST);What can be possible reasons for why USB C
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.