Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
HelloThe tools i'm using: STM32CUBEIDE, a scope and an AFG for generating a 5ms pulse each 20ms (50Hz PWM signal on ETR1)The goal is to start each pwm pulse from the trigger detection with the timer pwm in one pulse modeLater, I will use the timer trigger ISR to start the ADCI'm using an STM32f407IGT6 base board with the minimal request and a jtag 5 wires debuging interfaceThe Combined Reset Trigger Mode option mode does not exist for this device in cubeMX.So i use the Reset mode with ETR1 as trigger source, pwm generation on channel 2 with the one pulse mode option.Here is the clock configurationWhen i test the code, the CC interrupt has no problem to go in the ISR, the breakpoint was working.But the trigger ISR is not working.The TIE bit in DIER register is set and when a falling edge occur on ETR1 pin, the TIF bit is set in the SR register but the programm is no executing the ISR.The code genarated by the MX inside the IDE for the timer init is the folowing:/** * @brief TIM1 In
HiI just tried to setup my STM32F407 using STM32CubeMX and chose the internal high speed oscillator (HSI), which is a 16MHz RC oscillator.By inspecting the generated code, I can see that the function SystemClock_Config() is called and basically initializes the Sysclk to be driven by HSI.Isn't that kind of redundant since the HSI is the default clock source after reset? Or is it just the way it is to use a generic HAL function provided by ST?I'm not complaining about it, I'm just a bit confused as I am fairly new to MCU programming and understand the datasheet/reference manual that the HSI does not explicitly need to be configured.I do understand prescaler, peripheral buses etc. need to be initialized, I am solely talking about the HSI initialization.Hope someone can enlighten me. Thank you,void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; /** Configure th
My code is posted below. Whenever I try to swipe my finger across the touch sensor, nothing seems to be read. However, my TSC interrupt handler is constantly firing and printing out the value from the TSC counter which for some reason is awlays the max count value of 16838?What am I doing wrong and why will my touch sensor not read my finger and change th value within the counter?/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @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/licen
Hello! In STM32CubeMX I tried adding a input Compare direct mode to a timer for the STM32F767 part.It did not work until I checked the option under "NVIC Settings" to make the timer a global interrupt.Excuse the beginner question, but should not all timer interrupts be global always? I'm not sure I understand the concept of a "local" interrupt and why there is even this NVIC option at all, if the interrupt does not work without it?ThanksRenato
Hello,We've been using STM32 for quite some time for multiple products.For a new design we would like to use the STM32G070RBT. However there is a strange behavior with GPIO PD0 and PD1:PD0 is configured as input with pullup enabled. PD1 is configured as output push-pull.When toggling PD1, PD0 changes it's voltage level. When PD1 is set low, PD0 is at 3.3V (as one would expect), and reads digital high. However, if PD1 is set high, PD0 is at 0.4V and reads digital low.This "crosstalk" has been tested with multiple chips bought from Mouser, as well as with the NUCLEO-G070RB board to make sure it's no hardware issue.The behavior is the same for code generated with CubeMX (using HAL) as well as with libopencm3. I also checked the peripheral registers using Segger Ozone to make sure the config is correct and no alternate functions are active.This leads me to think this might in fact be a silicon bug, which would be very unfortunate for our application.Please let me know if you have notice su
errors are...C:\Users\user\AppData\Local\Temp\ccqZJPGM.s:295: Error: selected processor does not support `dsb 0xF' in Thumb modeC:\Users\user\AppData\Local\Temp\ccqZJPGM.s:306: Error: selected processor does not support `isb 0xF' in Thumb modeC:\Users\user\AppData\Local\Temp\ccqZJPGM.s:350: Error: selected processor does not support `dsb 0xF' in Thumb modeC:\Users\user\AppData\Local\Temp\ccqZJPGM.s:371: Error: selected processor does not support `dsb 0xF' in Thumb modeC:\Users\user\AppData\Local\Temp\ccqZJPGM.s:492: Error: selected processor does not support `dmb 0xF' in Thumb modeC:\Users\user\AppData\Local\Temp\ccqZJPGM.s:555: Error: selected processor does not support `dsb 0xF' in Thumb modeC:\Users\user\AppData\Local\Temp\ccqZJPGM.s:566: Error: selected processor does not support `isb 0xF' in Thumb modeDrivers/STM32F4xx_HAL_Driver/Src/subdir.mk:63: recipe for target 'Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o' failedmake: *** [Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx
Hello folks,I discovered a problem in the code generation of CubeIDE and I don't know if it is a bug or a PEBKAC.I set up a project for te H755 nucleo board. First, I just started blinking some LEDs with both cores. Worked fine.Then I changed the HAL tick timer from Systick to TIM7 for the CM7 core. Works as intended, too. But when I enable FreeRtos for the CM7 the program gets stuck, because the default handler is triggered.I analysed that the interrupt that ended in the default handler ist the interrupt from TIM7. The reason for that is, when FreeRTOS is enabled, in the file "stm32h7xx_it.c" the IRQ handler for TIM7 is not generated that should normally look like this:void TIM7_IRQHandler(void) { /* USER CODE BEGIN TIM7_IRQn 0 */ /* USER CODE END TIM7_IRQn 0 */ HAL_TIM_IRQHandler(&htim7); /* USER CODE BEGIN TIM7_IRQn 1 */ /* USER CODE END TIM7_IRQn 1 */ }I added the snipped manually and everything works fine. But why is this code snippet not generated? In older
Hello, I have recently switched computers and i have installed Keil IDE and CubeMX 5.6.0 onto the new PC, but when i create a project i get an error saying:"The code is successfully generated under........ but MDK-ARM V5.27 project generation have a problem" I have tried multiple different locations to see if it was that causing the problem , but no change. I installed CUBEMX 5.5 and 5.4 and they both show this problem however if i used V5.3 the project generates successfully. i can obviously just work from V5.3 but this would mean i cant open any recent projectsAny help would be appreciated -i'm out of ideas what to try
STM32F103 MCU , CubeMX generated code for Atollic True studio.TIM1 configured in Combine Channel -> Encoder Mode , User Parameter ->EncoderMode -> Ti1 and Ti2 , NVIC Settings -> TIM1 Update Interrupt enabled.HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) - method implemented in main.ccontains only a GPIO LED togglemain() method contain timer init generated code and timer start callHAL_TIM_Encoder_Start_IT(&htim1,TIM_CHANNEL_ALL);Also contains methods to print encoder counts.As the encoder is turned, encoder counts are printed, but when the Counter period ARR - value over flows the interrupt is not fired.Is period elapsed the correct call back? do i need to do something more?I tried with TIM4 similar setting enabled global interrupt, but same results, encoder count is printed but overflow / underflow interrupt is no called.Any suggestions?RegardsSamit
Hello, I am working with STM32H7. I need to configure the CAN FD to work as Classic CAN 2.0. I have found an example that configures the CAN FD as Classic CAN 2.0, but in the example the system clock is different from my system clock. I need to find the method to configure the STM32H7 CAN FD as CAN 2.0. Please help me cause I am not able to find this method anywhere. Thank you in advance. Best regards, Vouria
Hey guys,I'm pretty new to Stm32 controllers, but I might find a bug. Just want to report it, in case I am right.Im using Stm32 Workbench Eclipse, Stm32CubeMX and a Nucleo-L476RG.I tried to get a sd card working on my board. So I had a SD-Card onboard with a 4-bit bus on my Nucleo with following configs: PC8 ------> SDMMC1_D0 PC9 ------> SDMMC1_D1 PC10 ------> SDMMC1_D2 PC11 ------> SDMMC1_D3 PC12 ------> SDMMC1_CK PD2 ------> SDMMC1_CMDThe moment I set the settings in CubeMX I get this standard
STM32F437, STM32CubeIDE Version: 1.3.0Build: 5720_20200220_1053 (UTC)OS: Windows 10, v.10.0, x86_64 / win32Java version: 1.8.0_202IOC attached.In CubeMX-generated main.c, the Q register is not set:PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_PLLI2S; PeriphClkInitStruct.PLLI2S.PLLI2SN = 100; PeriphClkInitStruct.PLLI2S.PLLI2SR = 3; PeriphClkInitStruct.PLLI2S.PLLI2SQ = 2; // <<<<< DRN: Add value CubeMX forgot... ST - please verify you can reproduce this and a bug report filed.@Amel NASRI (ST Employee), @Camilo LEMOS (ST Employee) PS: Please note this is a different bug than my prior bug report regarding MCO2:https://community.st.com/s/question/0D50X0000BQQPIJSQ5/bug-cubemxgenerated-code-fails-to-properly-initialize-plli2s-mco2-etcIt looks like that was fixed, but this bug added as a new feature???
comparator does not interruptThis function handles TIM6, DAC1 and LPTIM1 interrupts (LPTIM1 interrupt through EXTI line 29). LL_EXTI_LINE_17 ? 17 ? 29 ? @file : main.c LL_TIM_GenerateEvent_CC1(TIM6); LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_17); LL_EXTI_EnableEvent_0_31(LL_EXTI_LINE_17); @file : main.c/** * @brief COMP1 Initialization Function * @param None * @retval None */static void MX_COMP1_Init(void){ /* USER CODE BEGIN COMP1_Init 0 */ /* USER CODE END COMP1_Init 0 */ LL_COMP_InitTypeDef COMP_InitStruct = {0}; LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA); LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC); /**COMP1 GPIO Configuration PA6 ------> COMP1_OUT PC5 ------> COMP1_INP */ GPIO_InitStruct.Pin = LL_GPIO_PIN_6; GPIO_InitStruct.Mode = LL_G
I have an existing project, and I'm switching from HAL drivers to LL drivers. I noticed that my workspace is missing many of the LL drivers, despite the fact that I've downloaded the STM32Cube MCU Packages via CubeMX. So, once I've downloaded the MCU package, how do I make it part of my CubeIDE workspace?
I am working with a STM32G474RE and I want to use HRTIM Timer F as PWM with DMA transfer.I used STM32CubeMX Ver.5.6.1 and CubeG4 FW V1.2.0 for generate simplest init. code, which would work only for HRTIM function for HRTIM Timer F.here's my setup and problem.In the Timer F tab:Could not set any DMA Request Sources. This form always returns to 0 automatically.In the Timer E tab:An error has occurred, although there were no DMA channel assigned for Timer E. (Timer A ~ D has no error if those were enabled)Is this STM32CubeMX bug??Thank you.
Hi,I am working on a custom board using the STM32F479NI.I have been able to use EXTI on the PC7 without problems.Now I need to implement it on PE2.But this time, the EXTI2_IRQHandler is being called over and over without any electrical changes on that pin.The schematic for that pin is very simple (one pull-up and a protection diode, Button is connected to PE2) : I am using STM32CubeMx to generate all the necessary code :And I made sure to call the MX_GPIO_Init() function.Right after calling the MX_GPIO_Init(), the EXTI2_IRQHandler is called over and over.I also made sure that the interrupt is being cleared, this is done in the CubeMx generated code in the function HAL_GPIO_EXTI_IRQHandler :The callstack looks like this :I did not modify any of the CubeMx generated code, so the EXTI2_IRQHandler and HAL_GPIO_EXTI_IRQHandler are the default one.Please note that when using PE2 as a GPIO_Input, and pooling it, I do not see the issue.I also noticed that the voltage at this pin is dropping wh
Hi all,I'm trying to develop a simple tcp echo application with my NUCLEO-F439ZI. I used CubeMX to configure my board. My app is under FREERTOS using LwIP library. I followed example indications I found but It really doesn't work fine. This is the my CubeMX configuration:-- CLOCK-- System base time source-- ETH-- FREERTOS-- LwIPMy code is the following:int main(void){ HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_FREERTOS_Init(); osKernelStart(); while (1){}}void MX_FREERTOS_Init(void) { osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 256); defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);}void StartDefaultTask(void const * argument){ MX_LWIP_Init(); tcpecho_init(); for(;;) { osDelay(1); }}void MX_LWIP_Init(void){ /* IP addresses initialization */ IP_ADDRESS[0] = 192; IP_ADDRESS[1] = 168; IP_ADDRESS[2] = 0; IP_ADDRESS[3] = 10; NETMASK_ADD
Hello,i switch from 1bit mode to 4bit mode in cubeMX (latest version on linux) an the reading only works in debug mode, when i connect my board to only power it doesn't work anymore.In CubeMX under SDIO the DMA2_RX and DMA2_TX is set to stream3 and stream6 of DMA2.But not i the drivers... :(.So i did a little research and found that the sd_read function never used the DMA function. Neighter in 1bit nor in 4bit mode.sd_diskio.cDRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count) { DRESULT res = RES_ERROR; if(BSP_SD_ReadBlocks((uint32_t*)buff, (uint32_t) (sector), count, SD_TIMEOUT) == MSD_OK) { /* wait until the read operation is finished */ while(BSP_SD_GetCardState()!= MSD_OK) { } res = RES_OK; } return res; }Function to call.uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)Also a problem, when I use 4bit mode with and with out any rework, the SD reading only works in debug mode not in real life. So I am now co
(If this is not the proper venue to post bug reports, please inform me--thank you.)CMSIS v5.6.0 installs fine.Here is the error dialog:
Hi!I've opened an issue on Github for the STM32H7 Cube HAL:https://github.com/STMicroelectronics/STM32CubeH7/issues/33Because the bug is in the CubeMX generated code, I hope this is the right Forum to report the bug.Best regards,Thomas
Hello There,I've been working on a big firmware for some time (freeRTOS, LWip, etc...). It is based on CubeMX 4.27 and firmware package 1.12.I was trying to update today to get the latest version of freeRTOS (10) and LWIP (2).When using original tools (cubeMX 4.27 and firmware package 1.12) code is generated fine. I was able to upgrade up to version 5.01 of cubeMX without code generation problem.Trying to get to a version greater than 5.01 generates this popup (5.1, 5.2 or 5.6) :In the log file of cubeMX (C:\Users\wt********\.stm32cubemx\STM32CubeMX.log)I can see this :2020-03-09 15:35:02,366 [ERROR] FreeRTOS:936 - Null or empty value: should not occur! (nothing added to the table)and later this :2020-03-09 15:40:45,180 [INFO] ToolchainGenerator:445 - stack trace : java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
Hello. I am using CubeMX to generate project and code. Without using DMA I can write SD card successfully, while I enable DMA f_open will wait for 30 seconds ( timeout) and fail with an Error 1 output.The CubeMX project is in the attachment.I need your advice to solve this problem, thanks.
Hi all,I am implementing Mass Storage class device with USB_OTG_HS. The implementation is configured from CubeMX and works perfectly until I enable USB_OTG_HS internal DMA. As soon I do this everythig stops, and no functions from usbd_storage_if.c are called anymore. Along with that there are no calls to Error_Handler().Regards,Dmitry
I try to configure my project by Cube MX enabling additional software X-CUBE-BLE2 as start point. When I try to compile I get the error "hci.h not found". I think something is missing, but all the code is Cube generated,Is there a ready to use HCI stack for my purpose? Where can I find it?
Hi, I just noticed that if Enable Full Assert option is enabled in the Project Manager, the generated stm32l4xx_hal_conf.h file has the following definition for assert failed:void assert_failed(char *file, uint32_t line);Which conflicts with the other definition in main.cvoid assert_failed(uint8_t *file, uint32_t line)I guess one of the two must be changed because this causes compile errors.Also I would suggest to change the definition of the assert_param() macro when the full assert option is not enabled form#define assert_param(expr) ((void)0U)to#define assert_param(expr) ((void)(expr))so that it will prevent unused variable/parameter compiler warnings in some cases
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.