Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
After attempting to code it up myself and after it didn't work attempted to verify using CubeMX.I have 2 questions:CubeMX does not give me the ability to select Alternate Function 2 on GPIOB pin 1 as input for TIM3_CH4, while Datasheet - STM32H750VB STM32H750ZB STM32H750IB STM32H750XB - 32-bit Arm® Cortex®-M7 480MHz MCUs, 128 Kbyte Flash, 1 Mbyte RAM, 46 com. and analog interfaces, crypto States PORTB alternate function does connect to TIM3_CH4 for AF2. Is this correct should TIM3 be able to do capture compare off PORTB_PIN1, or did I miss something?After doing HAL_TIM_IC_Start_DMA, I see the DMA copy TIM3->CCR4 to the destination (in memory) continuously even before any edge input comes in on PORTB_PIN1. Is additional synchronization needed or should this work as I expect after a __HAL_LINKDMA?
In CubeMX v6.6.1 with STM32G0 MCU package 1.6.1, there is no option for I2C2 to select SMBus-two-wire interface. Only I2C and SMBus-Alert-Mode.Is this by design (then why?) or an error in CubeMX?
CubeMX version: v6.6.1 MacOSMCU: STM32G0B1CCUxIssue:When selecting PLLQ driven from HSE in USB Clock Mux in CubeMX and choosing LL as RCC driver, the clock source for USB is never actually set in the generated code.This line is missing in the SystemClock_Config function:LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_PLL);When selecting HSI48 as USB clock source, this explicit setter is not necessary for some reason.
In the manual RM0468 for the STM32H730 say that the reg "PWR_D3CR" bits "VOS" has 00: Scale 001: Scale 3 (default)10: Scale 211: Scale 1Also in the code defines in "stm32h7xx_hal_pwr.h"#define PWR_REGULATOR_VOLTAGE_SCALE0 (0U)#define PWR_REGULATOR_VOLTAGE_SCALE1 (PWR_D3CR_VOS_1 | PWR_D3CR_VOS_0)#define PWR_REGULATOR_VOLTAGE_SCALE2 (PWR_D3CR_VOS_1)#define PWR_REGULATOR_VOLTAGE_SCALE3 (PWR_D3CR_VOS_0)But in CubeMX Version "6.6.1" Lib version "1.10.0"Only Scale 0,1,2 is selectebel. Se image
Please if you can give me a good link that show how can I use the HAL layer to write and read from the flash.
HelloI am familiar with STM32. I have a simple project with CubeMXOne ADC reads 3 channels, continuousmade disable , DMA active.I turn everything on and start the first ADC conversion with a function HAL_ADC_Start_DMA.My questionsHow do I start another ADC conversion?What should I test to make the program wait for the ADC conversion to complete and the data transfer via DMA?Thanks you
Hello, when I tried to create an stm32 project, at the last step of generating the code, I came across this warning and the code was not generated.After it tried to unzip stm32cube package, it says "Target directory already exists". I did already download and unzip the package. But it seems not using that folder and files. Do I have to remove the one I unzipped and then creating the project?
I have a STM32F103C8T6 bluepill board. I´m trying to use the Timer3 to TRIGGER the ADC1 conversion + DMA transfer.The ideia is: when the timer 3 trigger the ADC1, a conversions starts and the dma transfer the result of conversion to a buffer, in circular mode.I´m using the STMCubeIDE.In the TIM3 Mode and Configurations, in the tab Parameters Setting, in the field Trigger Output (TRGO) Paramters, i´ve set Trigger Event Selection like Update Event. These settings are shown in the figure below.No modo e configuração ADC1 fiz a seguinte configuração. The code:/* Private variables ---------------------------------------------------------*/ADC_HandleTypeDef hadc1;DMA_HandleTypeDef hdma_adc1;TIM_HandleTypeDef htim3;/* USER CODE BEGIN PV */#define Buflen 10uint16_t dmaBuffer[Buflen];/* USER CODE END PV */ /* USER CODE BEGIN 2 */ HAL_ADCEx_Calibration_Start(&hadc1); HAL_TIM_Base_Start(&htim3); HAL_ADC_Start_DMA(&hadc1, (uint32_t*)dmaBuffer, Buflen)
hey I tried to write a code that waits for sd card to be inserted to the micro-contorllersomething like this:while (FR_OK != f_mount(&SD, "", 1));the problem is that even after I insert the sd to the micro-controller f_mount keep returning FR_DISK_ERR.I tracked the problem back to this function:DSTATUS disk_initialize ( BYTE pdrv /* Physical drive nmuber to identify the drive */ ) { DSTATUS stat = RES_OK; if(disk.is_initialized[pdrv] == 0) { disk.is_initialized[pdrv] = 1; stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]); } return stat; }the obvious problem with this code is that disk.is_initialized[pdrv] is set to 1 without checking the return value of disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]) to know if it failed or not.this seems like a bug so I'm reporting it..this function generated by STM32CubeMX Version 4.26.0 in STM32Cube/Repository/STM32Cube_FW_F7_V1.11.0/Middlewares/Third_Party/FatFs/src/diskio.c:91. although it is under fatfs this isn't p
I'm first time configuring STM32L072 using CubeIDE. To be specific, I have 5 (yellow) GPIO conflicts on my I2C2 pins and I need to use all of the GPIO's and the I2C interface. What is the implication of this or where might I look to understand how those conflicts will impact my coding later on. Simply stated; I can't seem to figure out what they mean?
Hi, I was wondering does TIM1 has "global interrupt" like TIM2, TIM3... have?I dont see such in STM32CubeMX app, is it called differently or does not have such interrupt?Should I avoid using TIM1 if I need such interrupt?
Hello, I am working with a STM32H747XI. I have connected a digital input on PA0_C & PA1_C. I used CubeMX for the initialisation.The initialisation code is : /*Configure GPIO pins : UI_ENC0_Pin UI_ENC1_Pin */ GPIO_InitStruct.Pin = UI_ENC0_Pin|UI_ENC1_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);When I read the pin, it stays always at 0 (GPIO_PIN_RESET)bpState1 = HAL_GPIO_ReadPin(GPIOA, UI_ENC0_Pin); bpState2 = HAL_GPIO_ReadPin(GPIOA, UI_ENC1_Pin);The pin PA0 is at " Reset State".I dont know what I have to do to solve it.Many thanks for your help.Bertrand
Hello,We have implemented LWIP with FreeRTOS on a STM32F407VE with a LAN8720A PHY.Everything worked fine until our client submit our card to a IP vulnerabilities tester : during the test the card stop responding to ping.The test consists to try a connection on random TCP ports, about hundreds time each seconds... Please see below wireshark screen shot.By looking deeply in the source code, it appears that ETH_IRQHandler() is no longer generated in that case. So ethernetif.c/ethernetif_input() stay blocked on osSemaphoreWait() call indefintly.All code was generated with STM32cubeMX (5.3)/Atollic TRuestudio with RTOS 10.0.1 and LwIP 2.0.3.I have found a workaroud by adding a timeout in osSemaphoreWait() of ethernetif_input() loop. When timeout occurs low_level_reinit() is called and everything run well.void ethernetif_input( void const * argument ) { struct pbuf *p; struct netif *netif = (struct netif *) argument; for( ;; ) { if (osSemaphoreWait( s_xSemaphore, 5000/*TIME_WAITING_F
..
Same configuration and same code working fine with older version of CubeMx. Do you think i miss something or it is problem with the new version ?
I am working on STM32 NUCLEO - F411RE and want to use the interrupt. If not using STM32CubeMX to generate IOC and code, is there any example which uses UART interrupt? ( I have problem using MX to generate code right now.)
If I reduce the clock speed on a STM32F4 from 168Mhz to 96Mhz, with bus speeds reduced accordingly.Should the current consumption of the processor be reduced.I've been trying to take some current measurements, and there does not seem to be any reduction in current consumption of my board when I reduce the clock speed.By comparison, I have another board which uses a NXP / Freescale MK22 MCU, and to save power we reduce the clock speed to 16Mhz when the board is idleI can't use low power modes, becuase I need to maintain PWM on pins for things like backlight intensity, so reducing the clock speed was our only optionBut with the STM32F4 I'm not seeing any reduction in current, even if I reduce clock speed to 16MHz, and use the maximum dividers on all the busses.
I try to receive data with the USART1 in LIN mode using interrupts. Unfortunately I can't get it to work. This is the configuration of the USART1:The signal on the LIN bus is composed of the LIN break (HAL_LIN_SendBreak(&huart1);), the sync part (HAL_UART_Transmit_IT(&huart1, 0x55, 1);) and an ID (HAL_UART_Transmit_IT(&huart1, 0x0A, 1);).The signal looks proper on the oscilloscope. While debugging, I can observe that at least the LIN break is detected by the USART1 (LBDF is set). I expected, that at some point the HAL_UART_RxCpltCallback is called, but that never happens.What am I doing wrong?main.c:/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2022 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be f
Hello all,I have just write the code on newly buyed STM32F429z board of sending 3 characters continuously through USB HID but is not being detected on PC. Same code i fired on STM32F407 board then it is detected but Device descriptor error is occurring. I am tired of all solutions. Attaching the images for your reference. Please help me out
Hi,I'm facing on hardfault error.:(I have used many ST32F MCUs for projects.STM32G030C8T6 has two UART.UART1 is used for debugging message out, and UART2 is for communicated with other system I am using.But, a few message out thru UART2 cause the hardfault error. just call HAL_UART_Transmit().just in main.c /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_ADC1_Init(); MX_USART1_UART_Init(); MX_USART2_UART_Init(); while (1) __io_putchar_u2('*');---int __io_putchar_u2 (int ch){HAL_UART_Transmit (&huart2, (uint8_t *) &ch, 1, 1);return ch;}I have not seen this situation for STM32.UART1 is no problem.What cause the hardfault on this?BRPaul
This bug is present in F1, F2, F4 and F7 series examples and CubeMX generated code with RTOS and is one of the biggest flaws in ST's lwIP integration.Problemhttps://github.com/STMicroelectronics/STM32CubeF7/blob/3600603267ebc7da619f50542e99bbdfd7e35f4a/Projects/STM32F767ZI-Nucleo/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS/Src/ethernetif.c#L376lwIP core (also known as the "tcpip_thread") calls low_level_output(), which calls HAL_ETH_TransmitFrame(). While the latter is processing, Ethernet input thread (ethernetif_input() function) can call low_level_input(), which calls HAL_ETH_GetReceivedFrame_IT(). Because both of those HAL functions use HAL's ingeniously stupid "lock" mechanism, HAL_ETH_GetReceivedFrame_IT() returns HAL_BUSY. Subsequently that makes low_level_input() to return NULL and ethernetif_input() to go back on waiting for a semaphore.ConsequencesReceived frames are not processed and Rx buffers are not released to DMA.When the next frames are received, code will iterate
The reference manual states that the STM32L452 should be able to use an TIM3_TRGO as a trigger for ADC conversion:Though when I try to setup the "External Trigger Conversion Source" in STM32CubeMX there is no drop-down option for Timer 3, only TIM1/TIM2/TIM6/TIM15:Am I doing something wrong? Can I just ignore the STM32CubeMX and insert the appropriate EXTSEL-bits in the code myself?
As to save cost we are running the clock of internal RTC in STM32G070RBT6 by our HSE of 8MHz. We have not used an LSE of 32.768KHz.But due to this, we are observing that our clock is not working properly and after 1 day our current time increase by 5-6 seconds. We have tuned the clock to the calendar unit by the given formula of ST in application note AN3371. As per this application note, the calendar unit clock must be 1 Hz.we have tried with values like PREDIV_A to 124 and PREDIV_S to 1999 to give exactly 1 Hz clock to the calendar.But still, with this, we are getting variation in actual RTC time like on one board RTC time is up by 35 seconds in 6 days, and on another board, it is up by 19 seconds in 4 days.So can you help us with how we can correct our RTC configuration so that it works correctly or with external crystal HSE of 8MHz this variation expected?With temperature, variation will be more. HSE crystal part no. on our board:TXC CORPORATION9C08000012Crystal 8MHZ 9C-8.000M
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.