Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
I'm using an STM32F446RE nucleo-64 board with STM32CubeIDE. I was testing a potentiometer and noticed that the default code generated by cubeMX leads to an overrun error in the ADC peripheral. The issue can be manually solved by calling MX_DMA_Init() before MX_ADC1_Init() in main.c.To reproduce the issue, my configuration on the CubeMX interface is as follows:ADC1_channel0 enabled.DMA2 stream 0 in peripheral to memory, circular mode.DMA and continous mode enabled.Only 1 regular conversion.sampling time of 480 cycles per conversion.In main(), the regular conversion is triggered by HAL_DMA_START() just before the while loop.This works as expected :int main(void) { HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_USART2_UART_Init(); MX_DMA_Init(); // Has been moved manually before MX_ADC1_Init(); MX_ADC1_Init(); if (HAL_ADC_Start_DMA(&hadc1, g_raw_adc_reading, BUFLENGTH) != HAL_OK) Error_Handler(); while (1) { } }But if line 9 & 10 are inverted
I am using cubeIDE 1.5.0 with STM32F103RBTI configured 2 injected channels, triggered by Tim1 trigger out event in the device configuration tool. After thatcode generation for Initializing ADC injected group (call to function LL_ADC_INJ_Init) is completely missing andSequencer Rank configuration contains calls function LL_ADC_INJ_SetSequencerRanks with LL_ADC_REG_RANK_x instead of LL_ADC_INJ_RANK_xWorkaround (added to USER CODE BEGIN ADC1_Init 2): //Cube IDE does not generate code for ADC INJ Mode initialization. //SequencerLength setting must be done !!BEFORE!! LL_ADC_INJ_SetSequencerRanks LL_ADC_INJ_InitTypeDef init_inj; LL_ADC_INJ_StructInit(&init_inj); init_inj.SequencerLength = LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS; init_inj.TriggerSource = LL_ADC_INJ_TRIG_EXT_TIM1_TRGO; init_inj.TrigAuto = LL_ADC_INJ_TRIG_INDEPENDENT; init_inj.SequencerDiscont = LL_ADC_INJ_SEQ_DISCONT_DISABLE; LL_ADC_INJ_Init(ADC1,&init_inj); //Re-initialize
It's not that disturbing and obviously it doesn't prevent anyone from using it, but it's years that you have "Search (Crtl+F)" instead of Ctrl in every search box.:grinning_face_with_sweat:
Hi , I am working on STM32F469I-DISCO kit.In that actually Internal RTC time is not runningI configured internal rtc from cubemx. I am getting Time what i did set time only.no more time is running. support me what the issue for not running time.
Hello,I am trying to use the DMA in burst mode to send data to a timer, to configure two PWM channels at every update event, but the DMA doesn't seem to write any data, however it doesn't trigger an error and triggers the transfer complete flag .I am trying it on a Nucleo-H723ZG, Tim8 CH3 on PC8 and CH4 on PC9. I have also a debug Pin on PC10I don't believe I have the usual memory problem with DCM: my data is at the address 0x24000020.I believe I configured everything correctly:#define K_LenBurst 16 uint16_t DataBurst[K_LenBurst]; void BurstInit(void) { LL_DMA_SetMemoryAddress(DMA1, LL_DMA_STREAM_0,(uint32_t)DataBurst); LL_DMA_SetPeriphAddress(DMA1, LL_DMA_STREAM_0,(uint32_t)&TIM8->DMAR); LL_DMA_SetDataLength(DMA1, LL_DMA_STREAM_0,K_LenBurst); LL_TIM_ConfigDMABurst(TIM8, LL_TIM_DMABURST_BASEADDR_CCR3, LL_TIM_DMABURST_LENGTH_2TRANSFERS); LL_TIM_EnableDMAReq_UPDATE(TIM8); LL_TIM_SetAutoReload(TIM8, 150); LL_TIM_EnableCounter(TIM8); LL_TI
I m trying to configure the ADC1 in DMA modality with STM32F303K8when I debug the values does not change at all.With the breakpoint i could see that DMA1_Channel1_IRQHandler is called./* Private variables ---------------------------------------------------------*/ TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim3; UART_HandleTypeDef huart1; /* USER CODE BEGIN PV */ int32_t enc_value1; int32_t enc_value2; /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_TIM2_Init(void); static void MX_TIM3_Init(void); static void MX_USART1_UART_Init(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGI
ADC Sampling rate :-Total Conversion Time (Tconv) = Samplingtime + 12 (This 12 is for 12-bit resolution of ADC). If I set 12.5 Cycles in MX based on the settings of the controller STM32L9RI My ADCCLK Cycle will be =24.5 . Please confirm whether 12 to be added for calculation In STM32Cube MX if the PCLK2/Prescalar value is 64 MhZ Which is 0.016 us Total sampling time is therefore:= 24.5 * 0.016 us = 0.392 us Sample Rate = 1/.392 which is 2.55 MHz. Kindly confirm the calculation is correct
Hello there.I've setup simple transfer from SRAM4 to FMC NE1 on my STM32H750 board using MDMA. Write transfer itself complites, however no MDMA callbacks is ever called. After some digging i've found out that HAL_MDMA_IRQHandler is never called. On top of the HAL file I've spotted following text:(+) Configure the MDMA interrupt priority using HAL_NVIC_SetPriority() (+) Enable the MDMA IRQ handler using HAL_NVIC_EnableIRQ()I've done in my main entry just that, but it did not help, becuase underlying function MDMA_IRQHandler is never redefined by the HAL.I'm using freertos CMSIS_V1. I do not see any NVIC settings in CubeIDE like with UARTs, ETH and so on. I'm just wondering how are you supposed to setup that.
I am attempting to use CubeMX to generate the code necessary to do a very basic demo of TX DMA using the LPUART and the BDMA peripheral (which as I understand it handles DMA for the LPUART1 which I'm using).Based on my reading of the reference manual, I'm supposed to enable the DMA TX channel under the LPUART DMA tab. I am assuming I can choose any of the BDMA "channels" (which I assume are the new version of DMA Streams in older STM32 MCUs); I picked BDMA Channel 0, and checked the "Enable Event" and used Event Request 10 (per Reference Manual RM0468 Table 121, Page 678). I also enabled the LPUART1 Global Interrupt, BDMA Channel 0 Global Interrupt and the DMAMUX2 overrun interrupt. However, if I generate the project using these settings and attempt to use the HAL_UART_Transmit_DMA() function to send a sample string, I get nothing as output. I am still able to use the polling calls to send data. Is there anything additional the user is expected to do to make this work? I'm tearing my h
Hello,I tried to create a new project with STM32G0B1RC using CubeMX, but the button 'Start Project' is disabled. When I mouse over the message 'STM32CubeMX cannot load this Mcu'' is displayed: In a similar thread regarding this message I read about the MCU being in preview mode, but not yet supported by HAL and CubeMX.Could you please provide a date, when full availability of STM32G0B1RC is planned?Thanks in advance for any support.Best regards,Hendrik
keyboard-pc-usb-stm32Is it possible to read state of capslock on/off with stm? Using HAL and cubemx HID configuration.I can send report. But how to receive report - status?
Hi!I'm using a STM32L433V and have to deal with that whole energy-saving topic.My use-case is the following:I've to count and debounce pulses from an external sensor with an 78Ah battery for about 5 years without charging. The pulses do come with about 10Hz average and there are no significant delays between pulses, so I think standy- and stop-modes are not suitable for this specific case (correct me if I'm wrong). There are a save- and a send-interval. Usually the save-interval is about 1min. In this interval the count of the pulses is getting saved to an SD card. In the send-interval (usually 12 hours) the stored count gets sent via an lpwa module.In both the save- and send-interval I need the HCKL to be as high as possible (80MHz) to make these intervals most efficient. (I've done some measurements on that and compared them with 16MHz).Arithmetically, I need the current-consumption of the µC to be below 600µA in average in the "pulse measuring"-mode.I took a look at the datasheet of
Firstly come context:I have seen some differences in my sandbox project between what CubeMX auto-generates for my STM32H745I-DISCO and working examples I can download from github. Different GPIO settings which seem significant, for example. The ST github demo code works, but the generated code doesn't (even when I add device specific config). I can hot swap the working parts out of github demo code into user sections of generated code to get things to function with the other generated stuff. Which seems not the idea!I have also created a new project for this specific discovery board and let CubeMX go ahead and generate its idea of a default config for a project. When looking through some of the RAM timings and display settings in the resulting .ioc file (and being reasonably familiar with the normal settings now) what I am getting seems to be totally wrong. SDRAM timings all set to 16 cycles, display dimensions that are nothing like the board I have, or simply zero...So my questions ar
Hi,I bought some NUCLEO-L452REP (wich include STM32L452RET6 MCU with an SMPS support) particulary because of its SDIO interface.But this interface is not available (not displayed) in CubeMX for the nucleo while it is available if I choose the spare MCU (L452RET6) in the board/MCU selector.Is it a bug or a constrain ?(EDIT : The prblem isn't on the Nucleo vs MCU. The L452RET6P hasn't SDIO interface available in cubeMX but the L425RET6 (not P) has one. The datasheet seems to say that both MCU have SDIO interface)Cube MX with the MCU selected : CubeMX with the Nucleo Selected :Thank you for the time you spend with my problem.François
Use TIM3 PWM --> GPIO_AF0_TIM3but #define GPIO_AF1_TIM3Error??
I've followed this tutorial word by word and I'm not entirely sure why:1) Nothing is being written to that rx_buffer[]2) Why the void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) isn't being called/triggered as shown in the videoI'm also using the STM32F411RE Nucleo boardHere's the link to the mentioned tutorial : https://www.youtube.com/watch?v=5i-Gw7OC7oo&t=2s&ab_channel=STMicroelectronicsI have a jumper wire going from D8 to D2 that would connect the UART RX and TX pins.And I'm using RealTerm to monitor the output and I am getting all the values of the buffer_tx[] being output on there.I've also included both the .ioc file and my main.c file to this postI know I'm not dishing out many details at the moment, but I'm not sure what else to include that would be relevant/helpful to resolve the issue I'm currently facing.
Step to reproduce:1) Generate a project in CubeMX v6.2.0 and save it2) Open and modify the 6.2.0 project with CubeMX v6.2.1 (no migration or wathever), save the project3) try to reopen the project with v6.2.0, these window will popup: I need to use this project with 6.2.0 version of Cube MX.looking into the .ioc from text editor, i see these lines:MxCube.Version=6.2.1MxDb.Version=DB.6.0.21Changing these two into:MxCube.Version=6.2.0MxDb.Version=DB.6.0.20with this change I can now re-open the file with previous CubeMX, is this procedure safe? There's something I'm missing that can broke the project?Thanks
Newly generated code by SMT32CubeMX (6.1.1) hang at SystemClock_Config(). the hardware can boot up with the old code generated by STM32CubeMX previously. Further investigation showed __HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_HSI or ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI)) is false /* Check if HSI is used as system clock or as PLL source when PLL is selected as system clock */ if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_HSI) || ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_SYSCLKSOURCE_STATUS_PLLCLK) && (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI)))The file - system_stm32f3xx.c is different code /* Reset the RCC clock configuration to the default reset state ------------*/ /* Set HSION bit */ RCC->CR |= 0x00000001U; /* Reset CFGR register */ RCC->CFGR &= 0xF87FC00CU;
STM32CubeG4 Firmware Package V1.1.0 / 28-June-2019Question with a best answer.Best AnswerThis was reported in another thread and I wrote a ticket about it at that time. It will be fixed in an upcoming release. by Markus GIRDLAND (ST Employee)
I am STM32L422 to measure ADC using internal reference voltage.My code is generated using CubeMX V6.2.I want to measure ADC from ADC1_IN1 using PA7.The data sheet says internal voltage is 1.2 V. Reading VREFINT register gave value 1658 which is 1.214 V from 3v full scale.My maximum voltage input is 3V. It is connected to ADC in through 20k/10k voltage divider.3V *10/30 = 1VBut I get 0.595 V.If Vref = 1.2, then I should get 1.2 V in Vref pin but Vref pin voltage is 0.535 volt.To enable internal reference voltage, I have checked Vrefint Channel in ADCint main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USE
My CubeMX Setup: DMA:ADC:ADC NVIC:After I had done this, I generated theCode and Started the ADC and the DMA with the HAL_ADC_Start_DMA function. Thefunction Started the ADC as I wanted, but the Registers of the DMA are not setCorrectly.The DMA register, which is not set correctly:I assumed that the CIRC and the MINC bit should be set, and also the PSIZE should be 0x01 and MSIZE 0x02. Have I done something wrong or what is happening?If you need some more Information, just say it and I will upload it as fast as possible.
Hi there!I have configured an STM32L432KC Nucleo board in STM32CubeIDE, with UART2 and TIM2 using DMA. The generated code doesn't set up these DMAs correctly. The root cause is that their MX_<peripheral>_Init() calls precede the MX_DMA1_Init(), and the MspInit() of these two peripherals initialize DMA channels at a time when the RCC clock for the DMA isn't enabled. The project setup is available here for reproducing the problem: https://github.com/benedekkupper/ProntoInfrared/tree/bc8280e38ce5fb5fe04d3c918bf8fa2542a05964
I have a NUCLEO-L476RG with X-NUCLEO-IDW01M1 Wi-Fi and X-NUCLEO-NFC05A1 NFC Card Reader expansion boards. I want to create a project that uses both these modules. I've downloaded the X-CUBE-*** software zip files and tried to import them into STM32CubeMX but they wouldn't import. The supplied quick start guides say find an example project that does what you want and modify it. This doesn't help for using both modules.So, I'll start with the basic question. How do I import the software into STM32CubeMX?
I am using a STM32F4 microcontroller, I have to read the ADC values from 3 gpio pins so i am using ADC1, ADC2, ADC3, with DMA and all ADC's is configured in a continuous mode, because i have to collect the ADC values from all ADC's during pulse time period, then have to find the mean value of each ADC for the data collected during the pulse time. So, with ADC1 i enabled and disabled the ADC1 with Capture Compare interrupt, and the found the mean of the data collected in the buffer of DMA, this is all good. But, when i use ADC2 and ADC3, how can I allocate the different Buffersize for each ADC's?? so that i can collect the data stored in each buffer to find the mean value of the data stored in each ADC. Below code is the initialization of DMA and ADC's (however for single ADC's DMA initialization is working, but if i enable ADC2 and ADC3 which has different channel's how can i initialize different buffersize for each ADC's so that i can take each buffer to process it), what approach is
I want to enable backup domain of STM32F103C8 but I cannot find the BKP option in .IOC file in CubeIDEplease advice thank you
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.