Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
when timer mode set as single shot, the timer will not run, but if the event filter is disabled, it can run normally.when event filter enabled, timer mode set as continuous mode wiill run normal.
I was working with the test code of QSPI. I generated the code using the latest STM CUBMX ver 1.10.1. But after generation also it didn’t worked. Then I compared the code with the sample test code. There I found the below mentioned code patch in the SystemClock_Config function. Note : The activation of the I/O Compensation Cell is recommended with communication interfaces (GPIO, SPI, FMC, QSPI ...) when operating at high frequencies(please refer to product datasheet) The I/O Compensation Cell activation procedure requires : - The activation of the CSI clock - The activation of the SYSCFG clock - Enabling the I/O Compensation Cell : setting bit[0] of register SYSCFG_CCCSR */ /*activate CSI clock mondatory for I/O Compensation Cell*/ __HAL_RCC_CSI_ENABLE() ; /* Enable SYSCFG clock mondatory for I/O Compensation Cell */ __HAL_RCC_SYSCFG_CLK_ENABLE() ; /* Enables the I/O Compensation Cell */ HAL_EnableCompensationCell(); After adding the above mentioned code the gener
STM32 MCU has 12 bits ADC resolution, but some MCU claim "up to 16-bit with hardware oversampling". When I setup ADC in STMCubeMX, no option for "hardware oversampling", how to achieve 16-bit ADC resolution?
How to correct to deinit a some built-in functions and, after my edits, initialize it again?For example, on this function "void MX_LWIP_Init(void)".
Hi all,I have just started working with stm32 and i am trying to port some example code from stm32f0 to stm32l0 board.When i configured my project on L073rz board with same configs in F0 series i am getting errors for some api's available in stm32l0xx _ll_ spi.h in F0 series code(e.g"LL_SPI_SetDataWidth())".When i checked the files in HAL_driver directory,i found that there is no file named "stm32l0xx _ll_ spi.h" which has those function definitions.Can someone please tell me what is wrong?
I'm trying to set up FatFs to interface with an SD card over SPI. I know SDIO is faster, but my breakout board for the SD card only breaks out the pins nessesary for SPI. In the microcontroller configuration section of the STM32Cube IDE (what you get when you open the name-of-project.ioc file), with all other options at the default values, when I go to enable FatFs both the SD card and USB options are grayed out. Only user configuration is available. The microcontroller is an stm32f446RE. Why is this grayed out? It can't be some random setting I selected because it's a brand new project and I haven't changed any other settings yet.
I am having trouble getting the TIM1 timer on the STM32F413VG chip to output PWM to pin PE9. My configuration and code in STM32CubeIDE can be seen in the attached images. Have I done something wrong? Every example I have found out there skips TIM1 and goes straight to TIM2, could it be that TIM1 does not support PWM generation, even though it is an option in CubeIDE?
Hi,I want to send via DMA different duty cycle to my TIM12 (I am trying to turn on a rgb led strip by using the method TIM+DMA ), but with CubeMx TIM12 don't have access to any DMA, any idea how I can reproduce?I am using STM32H7B3 and can't change the pin (this pin don't have other TIM, other TIM have DMA)Thank you
Hello I am working on stm32h745 controller, I am configuring the DAC SPI . For the DAC minimum frequency is 80 MHz. I want to set that frequency for SPI4 , but uanble to set how I can set the 80 Mhz frequency to SPI4. How can I set that if I set the 120 MHZ clock to SPI , but in prescaler it get divided by 2 so it set 60 MHZ, How can I solve that,please help me
I've beenm struggling against some issues related to line-ending (CRLF vs LF) and git repos shared between different developers.And I discovered that MDK-ARM V5 generator in STM32CubeMX 6.6.1 under Windows generates the uvprojx file with the wrong line endings.Probably it uses the native Windows CRLF, but Keil documentation (see https://www.keil.com/appnotes/files/apnt_279.pdf) clearly states that The project files uvprojx and uvoptx have UNIX-style line endings (LF).I confirm that if I work in Keil uVision, the uvprojx file created by uVision uses LF on Windows too.And so I use .gitattributes to configure git so that uvprojx files keep LF when checked-out to working dir in Windows too (line endings in "standard" text files are changed to CRLF on checkout).The same happens to the uvprojx genertaed by STM32CubeMX.But if I re-generate it, the file is generating using CRLF and so git show the file as modified.Is it possible having it fixed in the next STM32CubeMX release?
I am trying to port C libraries I made using LL Libraries generated from STM32CubeMX to C++ under STM32CubeIDE and I am looking for advice on how to accomplish the following:I Created and object wich uses USART_LL Libraries and wanted to have something simillar to:#include "main.h" #include "stm32l1xx_it.h" #include "object_lib.h" extern object_type object; void USART1_IRQHandler(void) { object.usart_ISR(); }But since the it file is a "C" one I cannot use this OOP style.So I've beeng thinking about creating a wrapper-like structure so I can call one function with no parameters where somehow the ISR will be called, but I got the feel the implementation won't be as portable as I would like considering we always stepped aside from dynamic memory allocation.//On interrupt C File #include "main.h" #include "stm32l1xx_it.h" #include "object_lib.h" void USART1_IRQHandler(void) { object_isr_wrapper(); } //On object_lib.h #include "main.h" #include "u
I also see this build error: make: *** [makefile:109: default.size.stdout] Error 1 your_project C/C++ Problem
When having those yellow /!\-info icons beside entries, like in the picture below,it is hard to catch them by hovering over them. They pop up too short to read them. (macOS BigSur in this case, Apple mouse) How can I read what's in there?
Hi AllI switched form a STM32L412CBU6 to a STM32L452CEU6 MCU and created therefore a new project. The enable of the Internal Wakeup with RTC is not generated anymore into the rtc.c file using CubeMX Version 6.6.1. (I'm using the option seperte .c/.h file in the code generation setting tab).
Hello,I try to synchronise 6 PWM outputs for an BLDC controller.I use 3 timers :My target is STM32F446RET6 and I'm using STM32CubeIDE.I read that I add to use master/slave mode. I'm not sure it is the best way, but I configured TIM2 (slave) as follow :I chose TIM1 for my master timer : For now, the PWM outputs don't start.I think I'm missing something. For example I chose ITR1 but I can't find in datasheet where does it come from.Thanks for your help,Best regards,Valentin
Hi. I am using STM32L412KB for my application and internal RTC for maintaining time. I get epoch time over UART and then I call the following function to set the time.void set_rtc_time(time_t epoch_time) { rtc_time = epoch_time; struct tm *time_sec = localtime(&epoch_time); RTC_TimeTypeDef time; time.Hours = (uint8_t)time_sec->tm_hour; time.Seconds = (uint8_t)time_sec->tm_sec; time.Minutes = (uint8_t)time_sec->tm_min; APP_ERROR_CHECK(HAL_RTC_SetTime(&hrtc, &time, RTC_FORMAT_BIN)); RTC_DateTypeDef date; date.Date = (uint8_t)time_sec->tm_mday; date.Month = (uint8_t)time_sec->tm_mon + 1; date.Year = (uint8_t)time_sec->tm_year - 100; // date.WeekDay = time_sec->tm_wday; APP_ERROR_CHECK(HAL_RTC_SetDate(&hrtc, &date, RTC_FORMAT_BIN)); }And after setting the time I respond back with the time set over UART. So, while creating the message to be transmitted over UART, I use following function to read the RTC and convert it to epoch time.time_
This is my first STM32 project and I am using an STM32F030C6T as a MODBUS slave device. I used the STM32CubeMX V6.6.1 to create a project template and STM32CubeIDE Version: 1.10.1 Build: 12716_20220707_0928 (UTC), along with an STlink interface.When I build the MX project using HAL driver under project settings/advanced the project builds correctly but when I download into the target device it crashes as soon as it tries to initialise the USART and other devices. If I comment those drivers out so only the GPIO is initialised I can get the GPIO to run for a very short time before in triggers the HardFault interrupt.If I rebuild the project and change to using the LL driver interface, the code builds and downloads and runs without issues. I can then add my 5 lines of code for a blinky light.Seems to be an issue with the HAL setup or my environment, any suggestions welcome.Footprint for the LL interface is HAL footprint
I tried to do a lot of changes of configuration,but it didn’t work. when I use comparator output as FLT input pin,fault protection works,however it‘s used as FLT_Int signal,it always doesn’t work.Hope your kind help,Thanks!
CubeMX (version 6.6.1 and others) generates this code. /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_USART3_UART_Init(); MX_I2C1_Init(); MX_UART4_Init(); MX_UART5_Init(); MX_USART1_UART_Init(); MX_DMA_Init(); MX_USART6_UART_Init(); MX_USART2_UART_Init();The purpose of MX_DMA_Init() appears to be to configure the clocks for the required DMA peripherals. I don't see this being done anywhere else.If DMA is being used for the UARTs, the MX_UART*_Init() functions call HAL_UART_Init() which calls HAL_UART_MspInit() which calls HAL_DMA_Init() which attempts to write to registers of the DMA peripheral(s).Unfortunately, in the case of USART3, UART4, UART5 and USART1 in the example above, the clock for the DMA peripheral has not been enabled at this point and so the writes to registers of the DMA peripheral fail. The UART then does not operate as intended.The workaround seems to be to explicitly call MX_DMA_Init() before this sequence. /* USER CODE BEGIN SysInit */ &nbs
New to STM32. I've ordered a NUCLEO-U575ZI-Q development board and have been playing with CubeMX in preparation for board arrival. In creating a project for the board I'm starting the project using the board selector and selecting the NUCLEO-U575ZI-Q. I select the option to initialize all the peripherals in default mode and the project initializes. But there are yellow flags all over the place indicating conflicts on the pins.Is this expected behavior?Specific examples (not comprehensive):RCC - partly disabled conflict with: USART1 Mode AsynchonousTSC - partly disabled conflict with: PB14 PB5 PC7 PB7DEBUG - partly disabled conflict with: UCPD1 UCPD Mode SinkFirst, it's not clear what there messages really mean. Not sure if it's a "real" conflict or a "potential" conflict.If it's "real", why would ST ship a template with all these conflicts?How do I resolve them?I've attached the project in case that's of any help in understanding the issue.Thanks in advance for any help.Shawn
Hi,I'm using CubeIDE: V1.10.1 (CubeMX v6.6.1).To configure my project in (internal) CubeMX, I have created a "user constant":Name: USER_01Value: 7In FreeFRTOS Config parameters -> LIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY,I have entered this "USER_01" When I save the IOC and generate code, everything is still fine.Then I close the IOC File.When I try to re-open the IOC, there is an error message "Not a valid ioc file".And CubeMX can not edit this IOC any more - it is "broken".---When I edit the IOC file manually with text editor and change one single linefrom"FREERTOS.configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY=USER_01"to"FREERTOS.configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY=7"CubeMX can re-open the IOC file again.---Am I doing something wrong, or is this a CubeMX issue?Best regards, Andy
Hello,has anyone a good code example for Stop Mode with FreeRTOS?I am using CubeMx but it seems the vPortSuppressTicksAndSleep function needs to be modified. Thank you
Hi,We have selected Firmware Package STM32Cube FW_H7 V1.9.0 from CubeMX. However, the HAL Driver source file has following line:/** * @brief STM32H7xx HAL Driver version number V1.10.0 */Are the Firmware Package and HAL Driver versions different things? Are we using HAL version 1.9.0 or 1.10.0?
Hi there,I'm using a stm32f401re with stm32cubemx and keil uVision5. I'm trying to interface the mcu with the gsm module. I'm sure that the module works fine. I tested it with arduino and it worked without any issues. When I try to send any AT command to the module using the HAL USART library I'm not able to receive any answer from the module. I have tried both polling mode and it mode but no success. I attach the code.Do you have any advice?/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2019 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
hi,How do I use CUBEMX to develop STM32F400? I can not find it.
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.