Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Hi all, been working on my project for a while with great success using a STM32L496.As of late when I generate code from my .ioc file that it fails to to add the function name for the GPIO initialization function. Herewith the code generated:/** * @brief GPIO Initialization Function * @param None * @retval None */{ GPIO_InitTypeDef GPIO_InitStruct = {0};Note the lack of a function name.I've deleted main.c and re-created. Same result. Note that the GPIO Initi function is also missing from main. Apart from this everything else seems to be ok.Any suggestions?
New to STM32CubeMX. I am using a stm32f4-discovery. I want to use a CAN channel. It seems that the external memory may be blocking me.Is there a way to get a CAN channel available for this dev board? I would like to end up with the LCD + UART + CAN. I hope there is a lighter weight LCD library that will let this happen in the 2MB of STM32 FLASH and avoid the external FLASH.
I've been trying to get full-duplex mode running on my board, using this configuration (source: STM32F76xxx datasheet)Using I2S_A (I2S_2) in master-rx and I2S_B (I2S_3) in slave-tx :My I2S config bits (generated by SMT32CubeMX) are as follows:void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; /** Macro to configure the PLL multiplication factor */ __HAL_RCC_PLL_PLLM_CONFIG(16); /** Macro to configure the PLL clock source */ __HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSI); /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT
When creating project for STM32H7 board. In Additional Software none of installed packages can be seen. For STM32F7 it works correctly. Is it a known issue?(CubeIDE 1.2.1)
I have the following code:HAL_UART_Transmit_DMA(Outgoinghuart, (uint8_t *)message, sizeOfMessage); delay(10000); HAL_UART_Transmit_DMA(Outgoinghuart, (uint8_t *)message, sizeOfMessage);The second DMA transmit is always busy, no matter how big the delay. (I checked the delay function is 100% working on the scope)I have tried using:/*##-3- Wait for the end of the transfer ###################################*/ while (UartReady != SET) { } /* Reset transmission flag */ UartReady = RESET;and tried everything else in that GitHub example. It doesn't make any difference the gStateis always busy after the first transfer. It works 100% if I use HAL_UART_Transmit(). Any ideas would be great (I have scanned every forum post on this and none of them work)Even ideas on diagnosing the issue would be great! Thanks =)
HiIs there a way to make a cold start(reboot) in C language in the STM32Cube Environment using a Nuclei board?In other IDE's for other CPU's it waspossible to create a function that inserted a RESET assembler mnemonic for thetarget CPU like thisvoid ColdStart(void){ ASM("RESET")}Is it possible to archive the same omST's ARM cpu.Do the HAL have a function all that do a cold start?Perhaps it is possible to set a bit in some register?Is the only way to start a watchdog and neglect to update the watch dog?(the only watchdog i found was in theETH HAL module but it is not what I want)If so, how is this done?Regards
Hi all,When I click on the little "i" (info) icon in the FreeRTOS configuration screen in CubeMX, I get the following message: Current version shows as 10.0.1 and under Diagnostic, it says "New version available for L4". Indeed, I checked on FreeRTOS website and the current version is 10.1.1. How can I upgrade to the newer version in CubeMX? I think the obvious choice is to manually copy/paste files directly from FreeRTOS repository and hope for the best but every time I update CubeMX project, it will get overwritten by the 10.0.1 version.I checked thoroughly everywhere in CubeMX (version 5.0) with no signs of how to upgrade. Is this even possible?
Hi all,I'm using an STM32F746ZE in my application that uses USB OTG HS with internal FS Phy in Host only configuration.Originally, I have setup the clock in the following manner:in order to have 48MHz clock for USB. With this configuration, any device connected is not recognized and the USB host device does not work at all.I try to change the clock configuration in this manner:and all work properly, also if I change USB role to CDC device (virtual COM).What is the reason for this apparently strange behavior? In both setup configurations, the final clock sources for USB device are 48MHz.
I am using the STM32F103C8T6 Microcontroller to read a sensor via I2C. I am using the stm32Cubemx to generate the initialisation code and Visual Studio and VisualGDB for debugging. My STM32CubeMX setup reads as follows:and my clock configuration:But when i try reading the i2c bus by callingHAL_I2C_Master_Transmit(&hi2c2, IMU_address, buffer, 1, 100);It takes very long and my logic analyzer reports a SCL frequency of about 4.4kHz instead of 100kHz. I tryed using fast mode, too, but it behaves the same.I would be very happy, if you could help me and tell me, why i am not getting the desired faster clock and transmission speeds. The generated initialisation code looks as follows:static void MX_I2C2_Init(void){ /* USER CODE BEGIN I2C2_Init 0 */ /* USER CODE END I2C2_Init 0 */ /* USER CODE BEGIN I2C2_Init 1 */ /* USER CODE END I2C2_Init 1 */ hi2c2.Instance = I2C2; hi2c2.Init.ClockSpeed = 100000; hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2; hi2c2.Init.O
In CubeMXthere is not possible to select SD-Card support in FATFS if CMSIS V2 interface is selected for FreeRTOS.It worksonly for CMSIS V1.Are there any plans to support FATFS on SD-card for V2 Interface?
I use STM32CUBEMX 5.5.0 create code for Nucleo-G474RE, when I set PIN PC2 to GPIO_EXTI2, after create code, the code didn't create correct code, only create two lines for EXTI15_10_IRQn, how EXTI15_10_IRQn can handle PC2?
I can only imagine that __HAL_LOCK(x) is designed to make access to the HAL drivers thread safe. However, since the lock itself is not thread safe, the driver it's trying to protect is not thread safe either.I've spent a day trying to work out how the UART transmitter was occasionally being disabled mid steam. It turned out to be a race condition with the UART receiver which should have been prevented by the __HAL_LOCK(x) macro.The problem with __HAL_LOCK(x) has been known for several years and ST has promised a fix, but I haven't seen anything yet. I've only had experience with a couple of other HALs, but they were both thread safe.I'm no expert, but to make it atomic, don't you just make the flag volatile and disable interrupts while it is being locked? You'd also need a memory barrier before re-enabling the interrupts.Any, I just want to add my +1 to getting it fixed.CheersDavid
I think there is a mistake in cubeMX generated HAL_MspInit() when using VREFBuf: at firmware startup, HAL_MspInit() calls HAL_SYSCFG_EnableVREFBUF() but the clock of VRREFBuf is not enabled before, so it fails in timeout.To fix this I have added call of HAL_SYSCFG_EnableVREFBUF(); at the begining og HAL_MspInit() user code.
I just wonder why I am not able to set up LPTIM1 as time base for FreeRTOS.Background: For battery powered applications I often use FreeRTOS with tickless mode and a sleep instruction in the idle hook function. This, allows automatic switching in sleep mode, when there is nothing to do. Perfect,Problem: When I use a normal timer as time base for my RTOS then I am only allowed to use the "Sleep Mode". But in sleep mode the µC consumes a high amount of power. So I would like to use the "Stop Mode" But in "Stop Mode", the core is stopped and the only oscillators that are able to run are the LSE and LSI.Setting up FreeRTOS for low-power usage using LPTIM1 or LPTIM2 as clock base is not possible in CubeMX. See the attached screenshot. Does anybody ran into a similar problem? How do you setup your RTOS based systems for ultra-low-power applications?
STM32CubeMX is V5.5.0, but I suppose device definitions have different version numbers.
I have a project which uses STM32F767VGT6 MCU. I have the basic initialisation done through CubeMX and it runs on 40MHz frequency. During runtime, I would like to increase or decrease this CPU frequency. Is it possible to do so, and if yes can you please guide me on how to do this? Thanks
Seems like bug.CubeMx 5.5.0STM32G030K8TxItems are duplicated in ADC settingsSamplingTime Common 1 twice in "Sequencer set to not fully configurable mode"
I'd like to report 2 bugs/errors in CubeMx and the documentation in the stm32g4xx LL driver file:Setting the "Internal Voltage reference scale" in the "SYS" menu of CubeMX to SCALE2 (2.9V), won't take effect and the selected value always falls back to SCALE0. I'm working with an STM32G474 device.Also the values of the scales in CubeMX are wrong, where it's written:SCALE0: 2.5VSCALE1: 2.048VSCALE2: 2.9VWhereas the correct asignments are:SCALE0: 2.048VSCALE1: 2.5VSCALE2: 2.9VFurthermore the documentation in the LL driver in "stm32g4xx_ll_system.h" has the documentation wrong for LL_VREFBUF_VOLTAGE_SCALE2, where a voltage is 2.8V is documented instead of the correct value 2.9V
Using STM32Cube MX 5.5.0 and STM32Cube FW_H7 V1.6.0 I observed two curious things1) When I use LL drivers to generate a project, the function SystemClock_Config() contains:/* Intermediate AHB prescaler 2 when target frequency clock is higher than 80 MHz */ LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_2); LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL1); LL_RCC_SetSysPrescaler(LL_RCC_SYSCLK_DIV_1); LL_RCC_SetAHBPrescaler(LL_RCC_AHB_DIV_2); LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2); LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_2); LL_RCC_SetAPB3Prescaler(LL_RCC_APB3_DIV_2); LL_RCC_SetAPB4Prescaler(LL_RCC_APB4_DIV_2); LL_Init1msTick(400000000); LL_SYSTICK_SetClkSource(LL_SYSTICK_CLKSOURCE_HCLK); LL_SetSystemCoreClock(200000000);The line 2 contain the constant LL_RCC_SYSCLK_DIV_2 which is not related to register RCC->D1CFGR. The value should be LL_RCC_AHB_DIV_2, as in line 6.This hang randomly the MCU. It kept me busy for a while.2) Is about system core clock frequen
Hi All, I have a problem on Ethernet connection while using RTOS, I tried to figure it out but no positive result. Everything is fine (Ethernet is working) until I use RTOS. I tried to find the solution in CubeMX example package, and this article https://community.st.com/s/article/FAQ-Ethernet-not-working-on-STM32H7x3 <- on how to configure MPU for ethernet, but still got no result. My program used to publish periodically a simple payload to mqtt-server via ethernet, unfortunately when i scanned my device using IP scanner, none of my device was found in the network. has anyone faced the same problem?what is probably the cause of this problem?Board : NucleoF767ZICompiler : True StudioCompiler setting : No OptimizationMQTT lib : http://www.nongnu.org/lwip/2_0_x/group__mqtt.htmlHere I attach main.c file and cubemx setting.Regards
..
Hi, I suppose that the STM32CubeMX V 5.5.0 has a bug for AHB1,2 Peripheral Clocks configuration for the STM32H7A/7B microcontroller. If you try to configure the AHB1,2 clock to 280MHZ. It indicate a Clock Configuration error: "AHB1,2 Clock Frequency must be =< 140MHZ".Is it a bug of the CubeMX or the AHB1,2 clock really must be =< 140MHZ?
I try to get by PWM ( and with DC->DC converter) regulated output voltage from 0.0 to 2.5 volts ( not currently minimal voltage 0.9 V )?
Here i attached my main.c file.andWhen I run my debugger , i see that my program is stucked in error handler//////////if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK){_Error_Handler(__FILE__, __LINE__);}//////////And for measuring internal clock sources such as HSI, HSE. it worked fine but whenever i include LSE source :it stuck in error_handler///////////////RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;//////
On the same computer it is present in the selection list of STM32CubeMX 5.5.0 . Answers on internet not found. I need it in IDE. OS is Win 7 Professional SP1 . MCU STM32F746NGH6.I have downloaded stm32cube_fw_f7_v150.zip, stm32cube_fw_f7_v151.zip and stm32cube_fw_f7_v1150.zip in repository .
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.