Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Firmware package v1.25.0 introduced new define for USB stack called USE_USB_FS. This isn't generated anywhere even when USB speed in CubeMX is set to "Device Full Speed 12MBit/s". Previously, the following defines have been used (and they still are!):DEVICE_FS=0DEVICE_HS=1So you could pass to USBD_Init as last argument either DEVICE_FS (0) or DEVICE_HS (1) which worked fine. However, USBD_RegisterClass now has the following code block:#ifdef USE_USB_FS pdev->pConfDesc = (void *)pdev->pClass->GetFSConfigDescriptor(&len);#else /* USE_USB_HS */ pdev->pConfDesc = (void *)pdev->pClass->GetHSConfigDescriptor(&len);#endif /* USE_USB_FS */Since I define my own ConfigDescriptors, I've set HS descriptor to NULL. Now, guess what happens since USE_USB_FS isn't defined anywhere? The program crashes - null pointer is accessed obviously.Solution: If "Device Full Speed 12MBit/s" is checked in CubeMX, CubeMX should add USE_USB_FS to the list of defines.
I have a Nucelo-F767ZI development board and am having difficulties configuring all of the timers to run at 216 MHz using the CubeMX tool.According to the data sheet of the STM32F767xx, on page 38 all of the timers have a max clock speed of 216 MHz. Per the footnote on Table 6, the TIMPRE bit of the RCC_DCKCFGR register controls if some of these timers (specifically Timer 2) can run at either 108 or 216 MHz.I have confirmed I can get Timer 1 to run at 216 MHz. When attempting to configure Timer 2 to run in the same manner, I observe half the rate (of the PWM signal configured).This is all using mostly the HAL API and Clock Configuration in CubeMX. In the Clock Configuration, by changing HCLK to 216 MHz, APB2 runs at 216 MHz but APB1 runs at 108 MHz. This seems to explain my observations. I can't get the configuration to provide a solution to get both APB1 and APB2 to run at 216 MHz. In addition, and mostly due to my ignorance, I don't know which control is tied to the aforementioned TI
CubeMX doesn't let change the speed for the LTDC Pin PB11 to High, it only accepts "low",When activating the ADC3, the init has 3 lines wrong:static void MX_ADC3_Init(void){.. /* Peripheral clock enable */ __HAL_RCC_ADC12_CLK_ENABLE(); ->> Should be __HAL_RCC_ADC3_CLK_ENABLE();... /* Disable ADC deep power down (enabled by default after reset state) */ LL_ADC_DisableDeepPowerDown(ADC1); -->> Should be ADC3 /* Enable ADC internal voltage regulator */ LL_ADC_EnableInternalRegulator(ADC1); -->> Should be ADC3 ...Regards,Marco
C:\Users\marti\AppData\Local\Arm\Packs\Keil\STM32G4xx_DFP\1.1.0\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_fmc.c(176): error: #20: identifier "FMC_NORSRAM_TypeDef" is undefined HAL_StatusTypeDef FMC_NORSRAM_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_InitTypeDef *Init)C:\Users\marti\AppData\Local\Arm\Packs\Keil\STM32G4xx_DFP\1.1.0\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_fmc.c(176): error: #20: identifier "FMC_NORSRAM_InitTypeDef" is undefined HAL_StatusTypeDef FMC_NORSRAM_Init(FMC_NORSRAM_TypeDef *Device, FMC_NORSRAM_InitTypeDef *Init)C:\Users\marti\AppData\Local\Arm\Packs\Keil\STM32G4xx_DFP\1.1.0\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_fmc.c(201): warning: #223-D: function "__FMC_NORSRAM_DISABLE" declared implicitly __FMC_NORSRAM_DISABLE(Device, Init->NSBank);C:\Users\marti\AppData\Local\Arm\Packs\Keil\STM32G4xx_DFP\1.1.0\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_fmc.c(204): error: #20: identifier "FMC_MEMORY_T
Helloi'm using stm32f103rct.Use cubemx and just set RCC,and SYS(JTAG, Timebase Systick) compile with IAR and then download and debug press break.Hard fault exceptionhelp plz
..
I have downloaded Ethernet example code "LwIP_HTTP_Server_Netconn_RTOS" for NUCLEO-H743ZI board from STMCubeMX. Even though it is working on NUCLEO-H745ZI board without any changes but I want to change the drivers to actual STM32H745ZI board. I have lot of other drivers as well to be included going forward. Could you please guide me for the changes to be done to make it work for NUCLEO-H745ZI board?Also, Can we generate .ioc file for the example code from STM CubeMX?
Hi.I'm using STM32F746-DISCOVERY EVM with CubeIDE (v1.4.2)I'm trying to send uart rx char via osMessagePut API in uart ISR to other task which waits uart que.in uart isr callback, when I get rx char, I send rx byte via osMessagePut ().void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { if(huart->Instance == cliPort) { osMessagePut (uartQueHandle, huart->Instance->RDR & (uint16_t)0x01FF, 0); } }and receive part is belowuint16_t bsp_uart_gets(uint8_t* buf) { HAL_StatusTypeDef result; uint16_t size = 0; char ch; while(1) { result = HAL_UART_Receive_IT(cliHandle, (uint8_t*)&ch, 1); if(result != HAL_OK) { LOG("result - %d - %c\n", result, ch); } osEvent evt = osMessageGet (uartQueHandle, osWaitForever); if(evt.status == osEventMessage) { ch = evt.value.v; // in case of line end, return if( (ch == '\n') || (ch == '\r') ) { return size; } buf[size++] = ch; if(size > 64*2) size = 0; } else {
I am new to the ST world and have a Nucleo-H7A3ZI that I am testing with. I have STM32CubeIDE setup and have an LED toggling, so I am comfortable that I have the toolset configured properly.My next step was to send some characters over USB to the host. Once that is working, I am going to send from the host and echo them back to see both directions working. But I cannot get the Nucleo to transmit anything....I setup the connectivity for the Internal FS Phy to be "Device_Only". I tried Activate-VBUS both enabled and disabled. In middleware I setup the HS class as CDC and generated the code.Then in my main.c I:1 - #include "usbd_cdc_if.h"2 - /* USER CODE BEGIN 2 */ HAL_Delay(1000); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ CDC_Transmit_HS(buffer, sizeof(buffer)); HAL_Delay(1000); }No dice. I've done a few other things where people recommended adjusting a case statement in
I have tried to get the USB FatFS MSC example for Nucleo 144 - STM32F429ZI working. After about 10 day I have succeeded, but I had to change the MX_DriverVbusFS in the usbh_platform.c file as follows:original code:void MX_DriverVbusFS(uint8_t state){ uint8_t data = state; /* USER CODE BEGIN PREPARE_GPIO_DATA_VBUS_FS */ if(state == 0) { /* Drive high Charge pump */ data = GPIO_PIN_SET; } else { /* Drive low Charge pump */ data = GPIO_PIN_RESET; } /* USER CODE END PREPARE_GPIO_DATA_VBUS_FS */ HAL_GPIO_WritePin(GPIOG,GPIO_PIN_6,(GPIO_PinState)data);}WORKING code :void MX_DriverVbusFS(uint8_t state){ uint8_t data = state; /* USER CODE BEGIN PREPARE_GPIO_DATA_VBUS_FS */ if(state == 0) { /* Drive high Charge pump */ data = GPIO_PIN_RESE
Trying to to use PVD on F401 and CubeIDE but no relevant code is generated.I found on this forum code generated by CubeMx and it also works for me. Just copy and paste and corrected some minor differences like PVD_AVD_IRQn should be PVD_IRQnSo my question is: How do I make CubeIDE generating code for activating PVD ?The only relevant Item I found in CubeIDE is PVD interrupt through EXTI line 16Here is what CubeMX generated:The following code was generated by CubeMX in stm32h7xx_hal_msp.c:void HAL_MspInit(void) { /* USER CODE BEGIN MspInit 0 */ /* USER CODE END MspInit 0 */ PWR_PVDTypeDef sConfigPVD = {0}; __HAL_RCC_SYSCFG_CLK_ENABLE(); /* System interrupt init*/ /* PendSV_IRQn interrupt configuration */ HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0); /* Peripheral interrupt init */ /* PVD_AVD_IRQn interrupt configuration */ HAL_NVIC_SetPriority(PVD_AVD_IRQn, 0, 0); HAL_NVIC_EnableIRQ(PVD_AVD_IRQn); /** PVD Configuration */ sConfigPVD.PVDLevel = PWR_PVDLEVEL_7; sConf
I add TIM4, with prescaler of 63 and period of 9, and enable the interrupt. The ISR should trigger each 1 msec. It does not, it triggers about every 1.3 msec. When I look in the SystemClock_Config function it has the following unexpected behavior, in comparison to another project I have with the same settings that does work:These lines are missing: RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV2;PeriphClkInit.Tim34ClockSelection = RCC_TIM34CLK_HCLK;I expectPeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART3 |RCC_PERIPHCLK_ADC34|RCC_PERIPHCLK_TIM34;but getPeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART3 |RCC_PERIPHCLK_ADC34;And when I look in the graphical tool, at the Clock Configuration page, it does not show anything about TIM4, whereas I expect it to sh
So I said yes to updating to MXcube V 5.x and now I cannot compile the code because it generates code that is only compatible with the latest IAR EWARM versions. I have 6.x and there are evidently features in the new IAR versions that keep me from making it work.Is there a repository of older MXcube ? I hope so. I do not have many thousands of dollars to upgrade. Why do software companies do this ?
I am working on a project where I need 6000 samples per second converted by the ADC. In STM32CubeMX, I have the following configurations set for the ADC:What parameters can I change so that I am getting 6000 samples per second? Do I need to configure a timer? My understanding is that a sampling time of 12.5 cycles provides 12-bit resolution, and another 2.5 cycles is required for the sample period for a total of 15 cycles.
STM32CubeMX in version 6.0.1 does generate an invalid alternate function setting for PC8 and TIM3_CH3 for STM32F030C8. The datasheet states that this should be alternate function 0. See https://www.st.com/resource/en/datasheet/stm32f030c8.pdf. A look into the relevant GPIO-STM32F051_gpio_v1_0_Modes.xml file reveals that the signal description for TIM3_CH3 maps to GPIO_AF1_TIM3 instead of GPIO_AF0_TIM3 in case of GPIO pin PC8.
Hi everyone, We have discovered a bug with the STMCubeMX'S Pinout compatible feature between STM32F030C8 and STM32F030CC.Based on the STMCubeMX both MCUs (STM32F030C8 and STM32F030CC) are Full Pinout Compatible. Based on the STM32F030 datasheet, there are differences on pins #35 and #36 (LQFP48 package).Attaching images for your reference. Thank you,PS. We have create some prototypes assuming both MCU are fully pinout compatible but, after HW troubleshooting, we had to use some jumpers/wires to solve this pinout incompatibility issue.
Hi,STM32CubeMX allows to configure STM32H743 SYSCLK to 400MHZ, D1CPRE Prescaler to /2 and HPRE Prescaler to /1. (CPU CLK = 200MHZ and HCLK = 200MHZ)But this configuration is not allowed for the STM32H723. The HCLK box turns red and shows a message that HCLK clock must be <= 150MHZ. But HCKL max = 275MHZ for the H723.Is this a limitation of the STM32H723 or is it a STM32CubeMX bug?
Here is a screen shot of the options. It appears that PWM modes 1 and 2 are missing.
CubeMX does not support import for STM32H7 projects. Is there a way to change packages on an H7 project. Specifically, Can I change from a 144 pin STM32H745ZI to a 176pin STM32H745II ?Edit: For this specific package change (i.e. changing to a larger package), it appears I can manually edit the .ioc file, changing all MCU references. Are there any problems with doing this?
Hello, I am using Stm32CubeIDE. I configured simple program [code attached] in Cube to test if PWM works properly. I get expected results for PA1 and PA2 (channel 2&3), but no voltage at PA0.When writing this pin (PA0) as GPIO I get both low and high state. If I toggle this pin as GPIO in Tim2 cplt callback, I get ~1.5V as expected.Even more - if I map PWM output from channel 1 to PA8 instead of PA0, it works correctly.I tried two chips, both seems to have the same issue.Has anyone encountered similiar problems?/* 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";
In the attached .ioc file, when FreeRTOS V1 is enabled via Cube, the project does not compile and gives errors. The errors image is also attached.Another thing is that the LCD clock must be set to 96.875MHz to work properly! The tipycal clock for my LCD is 25MHz. My hardware is STM32F779-EVAL and it uses 25MHz external resonator.
I try to enable the External crystal for RTC in STMCUBEMX but I am unable to select the external crystal in STMCUBEMX .Kindly anyone help me to solve to solve this issues.
Hello,STM32CubeMx for the CDC Host mode, there seems to be a problem in the "static void CDC_ProcessReception (USBH_HandleTypeDef * phost)" function of the "usbh_cdc.c" file if we use the "USBH_CDC_Receive" function (USBH_HandleTypeDef * phost, uint8_t * pbuff , uint32_t length) "with length> wMaxPacketSize (here 64).Indeed, in the line 36 :/** * @brief This function responsible for reception of data from the device * @param pdev: Selected device * @retval None */ static void CDC_ProcessReception(USBH_HandleTypeDef *phost) { CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData; USBH_URBStateTypeDef URB_Status = USBH_URB_IDLE; uint32_t length; switch(CDC_Handle->data_rx_state) { case CDC_RECEIVE_DATA: USBH_BulkReceiveData (phost, CDC_Handle->pRxData, CDC_Handle->DataItf.InEpSize, CDC_Handle->DataItf.InPipe); CDC_Handle->data_rx_state = CDC_RECEIVE_DATA_WAIT; break; case CDC_R
I have tried several F7 MCU and the result is the same.
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.