Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
I have just created a new project with the latest version of CubeMX for an STM32G030F6Px and am using the code generator to provide basic bring-up code. However the generated project does not compile.I am using System Workbench (version 1.17.0.201812190825; all updates applied), with the SW4STM32 option set in the Project Manager. However I receive the message: ../Drivers/CMSIS/RTOS2/Template/cmsis_os.h:157:10: fatal error: cmsis_os2.h: No such file or directoryI have not enabled FREERTOS in the project settings, so I'm not sure why this is being compiled. Any ideas?!
In my project the debug pins are used for the release version but naturally I would like to debug the code. Right now I have a debug macro and using #ifndef in the middle of MX_GPIO_Init function to avoid initializing debug pins. These conditions are outside of the user defined code and will be overwritten when the code is regenerated. Is there any descent way around it other than just remembering to add them every time?
Regarding supported SPI clock frequencies:The STM32H753xI datasheet speaks of various miracles; e.g., page 48 says, "The devices feature up to six SPIs (SPI2S1, SPI2S2, SPI2S3, SPI4, SPI5 and SPI6) that allow communicating up to 150 Mbits/s in Master and Slave modes..." and page 193 mentions test conditions of Master Mode SPI clocks of 90 MHz to 133 MHz in Master Mode.But, experimenting with STM32CubeMX, I don't see how the SPI peripheral can be configured for >24 MHz (SPI 1,2,3) or >32 MHz (SPI 4,5,6).So, what's reality here?
OverviewWhile the I2C module is enabled by CubeIDE Device Configuration Tool, CubeIDE 1.3.0Nucleo H743ZIHAL FW 1.7.0Reproduce the problemFollow : Create a new Nucleo H743ZI project Generate the code from the Device Configuration Tool as default condition (All I2C are disabled) You can find Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_i2c.h while I2C is not chosen in the Device Configuration Tool.This excessive I2C generation define a HAL_I2C_MODULE_ENABLED incorrectly, and it interferes the program which have IFDEF block with HAL_I2C_MODULE_ENABLED.Demonstration of the problem This problem can be demonstrated by the d009-nucleo-h743rb-i2c project inside attached d009.zip. This program doesn't have I2C as configured module. And this has following code in the main() function. HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_RESET); #ifdef HAL_I2C_MODULE_ENABLED // In this project, we don enable I2C by CubeIDE configuration. // So, if the following code is executed,
HI !Is it possible to lock or mark some pins as not available for STM32CubeMx ?(If not please see this thread as a feature request :smiling_face_with_smiling_eyes: )The use case would be a software package which is configuring these pins on its own.Best regards,Michael.
This is the code: /* USER CODE BEGIN WHILE */ while (1) { HAL_GPIO_WritePin(GPIOA , LED_Pin, GPIO_PIN_SET); HAL_Delay(10); HAL_GPIO_WritePin(GPIOA , LED_Pin, GPIO_PIN_RESET); HAL_Delay(10); char p[] = "128"; HAL_UART_Transmit(&huart2, (uint8_t*)p , sizeof(p), HAL_MAX_DELAY); HAL_Delay(200); }This is the UART config:/* USER CODE END USART2_Init 1 */ huart2.Instance = USART2; huart2.Init.BaudRate = 9600; huart2.Init.WordLength = UART_WORDLENGTH_8B; huart2.Init.StopBits = UART_STOPBITS_1; huart2.Init.Parity = UART_PARITY_NONE; huart2.Init.Mode = UART_MODE_TX_RX; huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart2.Init.OverSampling = UART_OVERSAMPLING_16; if (HAL_UART_Init(&huart2) != HAL_OK) { Error_Handler(); }The attachment show the clock configuration:
Hi,after the formatting my laptop, i set up MDK529 keil and stm32cubemx 5.6.0 in the same time.i have stm32103c8 development board. I configured on stm32cubemx and i opened with mdk uvision. when i compile configured program, i saw this error " error: L6236E: No section matches selector - no section to be FIRST/LAST."what can i do get rid of this error??? pls help me...
Hi, I want to receive 32 bit data from a SPI master but in the cubemx options there are only two options available, 8 bits and 16 bits, so what if I want to receive 32 bits frames, what should I do?Thanks
Even though I configure the RCC to use an external high speed crystal as a clock source (HSE), the HSI remains selected even after the SystemClock_Config routine is executed!! (I have checked the HSE pins and it appears that the clock driver (PH0/PH1) is not turned on.)The SystemClock_Config code generated is:void SystemClock_Config(void){ RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; /** Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); /** 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_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PL
When I created a new project using the stm32cubeide, and set the new project to be able to go to standby mode and then wakeup using RTC timer, it works.But when I try to add the standby mode with RTC Wakeup timer to a pre-existing example project, I can't seem to be able to wakeup from sleep but I am using the same configurations that I use in the new/blank project.For Context, I am using the HAL Libraries to produce the standby mode and RTC Wakeup timer and adding it to the fp-ind-predmnt1 example project of ST, is there anything that I missed doing to configure the example project? also this example project doesn't have ioc so I don't know to configure anything that needs stm32cubemx ioc files
I am new to using PWM, so not sure if this is a bug, invalid default settings or wrong documentation.I configured my project using STM32CubeMX.I'm using the internal clock, and the default setting for PRESCALER is 0. I can see in Keil using the debugger that the CNT register is counting (random value appears on each refresh), but the PWM output on the actual MCU output only updates when I update the RELOAD register. However, if I change the PRESCALER to 1, it works. Hardware documentation says that the prescaler can be set in the range 1-65536, implying that you should subtract one in order to fit this into the 16bit sized registry.Is the actual valid range 1-65535? If so, should STM32CubeMX change it's default value, and flag 0 as an invalid value?
Hi everybody,I hope someone there could help me. I am trying to read the WHO_I_AM register of the LIS3MDL magnetic sensor (reg 0x0F). I have a custom pcb with a STM32L151VET6 . I got largley inspired by the STEVAL-WESU-1. I am using STMCubeMx for the set up and STMCubeIDE. I debug with serial wire (STLink v2).I have spent hours but I cannot find my error. I just get random values, the most common being 0xff out of RxData[0]. I don't think I have a Hardware error since I'm also unable to get a correct reading with the STEVAL-Wesu-1 that works completely fine. Its my first time with SPI and HAL.These are my SPI parameters set in STMCubeMX :Motorola8 BitsMSB FirstPrescaler 16 (since Im runing from a 24 Mhz crystal)CPOL high and CPHA 2 Edge since the LIS3MDL datasheet says : "Those lines are driven at the falling edge of SPC and should be captured at the rising edge of SPC. "Unfurtunately I don't have an osciloscope or a logic analyser available at the moment.. working from home..Thank you
i want to generate above signal with variable Toff and Ton fix.i generate code but i don't get my desired out put signal./** ****************************************************************************** * File Name : TIM.c * Description : This file provides code for the configuration * of the TIM instances. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "tim.h" /* USER CODE BEGIN 0
..
I have migrated some Code from a STM32f103 to my new STM32f411CEU6 Microcontroller. While configuring the Timers for the PWM generation I ran into a problem, namely the pulses are about 1500us, when they should be 1000us.Here are my Clock and Timer configurations from the STM32CubeMX:Clock configuration:My PWM Setup:The Measured Signals:So I think i have configured the systemclock to have a frequency of 100Mhz, which gets fed to Timer3. A Prescaler of 99 should divide this pulse to 1us and a Pulse of 1000 should then result in Pulses with a width of 1000us.I do not call any functions in my code, other thanHAL_TIM_PWM_Init(&htim3); HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);The from the CubeMX generated initialisation code for timer 3 looks like this and is called at the start of my program:static void MX_TIM3_Init(void) { /* USER CODE BEGIN TIM3_Init 0 */ /* USER CODE END TIM3_Init 0 */ TIM_MasterConfigTypeDef sMasterConfig = {0}; TIM_OC_InitTypeDef sConf
According to AN2606 (STM32 microcontroller system memory boot mode), Section 4.3, we require a 'HOST' peripheral, to communicate with STM32 MCU, in order to get new firmware from the peripheral (while booting from System Memory).Flowchart from Section 5.2 shows that bootloader will wait until it receives either 0x7F from USARTx OR some specific byte from specific peripheral.After reading this document, I think we must have a HOST Controller (like another MCU) in our development board, to do FOTA.Am I correct ?Is there any alternative to flash new code in main flash memory, using the default bootloader ?All I need to do is do FOTA using STM32L432KB.Please suggest me all possible ways for that.
Hello, I am generating code using STM32MX CUBE. Please let me know how bust increment for peripheral and memory will affect compunction. Thanks
Hello guys,I got a "STM32F407-DISC1" board and if I configure the external oscillator, it goes into "error_handling:RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 8; RCC_OscInitStruct.PLL.PLLN = 336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 7; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } Afterwards program stops and does not continue. What do I need to change in my code? or is it due to a hardware failure?Cheers
I reporte a bug of STM32G4xx LL library, the Definition of DMAMUX_LL_EC_REQUEST Transfer request in header file "stm32g4xx_ll_dmamux.h" as shown below.#define LL_DMAMUX_REQ_FMAC_WRITE 0x0000006EU /*!< DMAMUX FMAC WRITE request */#define LL_DMAMUX_REQ_FMAC_READ 0x0000006FU /*!< DMAMUX FMAC READ request */#define LL_DMAMUX_REQ_CORDIC_WRITE 0x00000070U /*!< DMAMUX CORDIC WRITE request*/#define LL_DMAMUX_REQ_CORDIC_READ 0x00000071U /*!< DMAMUX CORDIC READ request */But the STM32G4 Series reference manual is defined as below.110 FMAC_Read111 FMAC_Write112 Cordic_Read113 Cordic_WriteThe HAL library is defined as follows.(stm32g4xx_hal_dma.h)#define DMA_REQUEST_FMAC_READ 110U#define DMA_REQUEST_FMAC_WRITE 111U#define DMA_REQUEST_CORDIC_READ  
Our system communicates primarily through CAN bus, we issue a command to the micro controller and then it will reset and jump into the bootloader.From there we have implemented the protocol as described in AN3154.This looks like it is working as intended, we can verify that all bytes for the new firmware where written.The issue I am currently facing is on exit.To exit we request the bootloader to jump to the application (at the start of flash).This seems to work, we can communicate with our code and the firmware seems to function as normal.The issue I am running into is that two interrupts do not work correctly after this “soft�? reset.They are GPIO interrupts, lines driven by two external chips, they trigger when there is new data for us to read from them.I have determined this is not a code problem, since if I reset the module (reset button connected to NRST), everything works as expected.Other interrupts are not impacted by this issue, we are using CAN, SPI and I2C interrupts and I
Every code in HAL driver has the below structure that doesn´t care about overflow on HAL_GetTick().... tickstart = HAL_GetTick(); while (Something()) { if (Timeout != HAL_MAX_DELAY) { if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U)) { DoAnything(); return HAL_ERROR; } } ...I believe it can face some issues when the tick counter is about to overflow when the HAL is called and the results will be unpredictable.Does anyone face this kind of problem?One option to check the elapsed time is below:uint32_t HAL_GetElapsedTimer(uint32_t u32_Time) { uint32_t u32_Tick = HAL_GetTick(); uint32_t u32_ElapsedTimer = ((u32_Time > u32_Tick) ? (uint32_t) (((uint64_t) u32_Tick + (1ULL<<32)) - u32_Time) : (uint32_t) (u32_Tick - u32_Time)); return u32_ElapsedTimer; }And final HAL code:... tickstart = HAL_GetTick(); while (Something()) { if (Timeout != HAL_MAX_DELAY) { if ((HAL_GetElapsedTimer(tickstart) > Timeout) || (
Hi,I am using NUCLEO-F411RE for development and wondering whether I can developed user USB Device application with custom VID and PID. I tried custom hid example from STM32Cube_FW_F4_V1.24.0 SDK but seems not working, once downloaded I can see only 1. STM32 STLink, 2. ST-Link mass storage usb devices but not my custom hid usb device in device managerPlease let me know is it possible to develop user usb application with NUCLEO-F411RE
Hello,i try to implement an USB3300 ULPI PHY on STM32F429ZI Nucleo which an attached "daugtherboard", a WavesShare USB3300 USB HS Board, populated with an SMSC USB3300.I want connect an USB stick to write down some data in High Speed mode. I am using the STM32F429 ZI USB HS ULPI interface.I am using a System Workbench project created by CubeMX including RTOS, FATFs and some code to forward printf output over SWO. I have zipped the whole project and appended it on this thread for testing.I have enabled logging in the host driver by setting#define USBH_DEBUG_LEVEL 3UThe log output is:Starting ... (My own log)USB Device Connected (Logs from USB Device stack starting..)USB Device Reset CompletedPID: c24chVID: 46dhAddress (#1) assigned.ERROR: Control error: Device not respondingUSB Device ConnectedUSB Device Reset CompletedERROR: Control error: Device not responding[permanent retries each half second]On power on therer is a communication, the PID and VID is bein
I have searched, but I cannot find any information how to get the newer STM32CubeMX 5+ or the STM32CubeIDE to include the DSP header files arm_math.h, arm_const_structs.h, and arm_common_tables.h. They were copied on the older versions. How do I tell CubeMX that I want these files included? They exist in the Repository under Drivers/CMSIS/DSP/Include, but they no longer get added to the project when files are generated.
Hi, I am using cubemx to configure a stm32f411ve board as slave in receive only, polling mode and sofware NSS, in the code generated I have only added a few lines of code, only which I consider neccesary**the master sends 12 bytesoutside main function:uint8_t rxbuffer[12]; void Timeout_Error_Handler() { while(1){ HAL_GPIO_TogglePin(GPIOD,GPIO_PIN_13); //led orange HAL_Delay(500); } } void Error_Handler2() { HAL_GPIO_WritePin(GPIOD,GPIO_PIN_14,GPIO_PIN_SET); //led red } inside main function:// I have commented the while (1) because for my test the master sends data just one time //while (1) { /* USER CODE END WHILE */ MX_USB_HOST_Process(); /* USER CODE BEGIN 3 */ switch (HAL_SPI_Receive(&hspi5,rxbuffer,12,5000)) { case HAL_OK: /* Turn LED6 on: Transfer in reception process is correct */ HAL_GPIO_WritePin(GPIOD,GPIO_PIN_15,GPIO_PIN_SET); //led blue break; case HAL_TIMEOUT: Timeout_Error_Handler(); break; case HA
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.