Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Migrated from v1.7.0 and main.c removed the #include "spi.h" which was just a compile warning with MX_SPIx_Init() where x is 1,2,3,4. Chip used was STM32F723ZE
..
I have trying DAC with DMA from STM32G474 eval board. I can see the values being updated to the DOR register and the DAC EN is set to 1. However, the output of the DAC is stuck at 0.I have attached the cubeide settings.
STM32L010C6TxSTM32CubeMX V 5.4.0FW_L0 V1.11.2When creating a new project that used the ADC with the DMA and some unrelated peripherals, cubeMX will generate the following initialization list in main: /* Initialize all configured peripherals */ MX_ADC_Init(); MX_DMA_Init(); MX_TIM2_Init(); MX_TIM21_Init(); MX_GPIO_Init(); /* USER CODE BEGIN 2 */This is a bug - MX_DMA_Init() should be called before MX_ADC_Init(). The ADC init function will attempt to write the the DMA CCR1 register, but will fail because the DMA has not yet been initialized.
CubeMX version 6.3.0CubeIDE version 1.7.0STM32Cube_FW_H7_V1.9.0The code section in the conf.h file to enable the USART (line 79) is block commented out and line 78 is not commented out which reads:#define HAL_UART_MODULE_ENABLEDAlso I have ENABLED the Register Callbacks for the USART and see that reflected in the stm32h7xx_conf.h but I do not see any code actually registering my callback functions. In fact if I highlight USE_HAL_USART_REGISTER_CALLBACKS in the conf.h file and search for any references to that text in the project, the search comes up empty.I must be missing something.
I am trying to generate a periodic signal with the DAC on the STM32G474 using DMA. There are tons of examples of this, and I´ve done the same in the past with an STM32L4 and F4 with no issues. However, I´m not sure if there is a problem in the STM32G4 line or a bug in the libraries/HAL code generation. I set up a simple example, just with a circular buffer of 2 samples at a slow rate, but I never get anything out, it generates on start a DMA transfer error and disables DMA.I have tried different pins and channels. In the STM32G4, the DMA streams are multiplexed so you can use any as long as you are not using the same for other peripherals. I tried starting the timer first, including delays, calling HAL_DAC_Start() before HAL_DAC_Start_DMA() (which is redundant). Setting a value manually to the DAC works with no problem. I have tried also using Timer2. I´m using STM32CubeIDE 1.3.1 and the code is generated with STM32CubeMX 5.6.1, the latest versions.The main.c is here, it includes all c
There is a bug in the CubeMX Code Generation in STM32CubeIDE Code Generation (Version 1.7.0 updated to 1.8.0) for the STM32F767ZI. (STM32Cube FW_F7 V1.16.2)The bug was found by debugging a not working auto generated code that is using a DMA circular buffer to read from uart.In the auto generated initialization code for the hardware the ordering of the function calls was:MX_GPIO_Init(); MX_USART3_UART_Init(); MX_DMA_Init();Because DMA_Init starts the clock to the dma the dma isn't clocked when initializing the uart which uses the DMA.This leads to a non functioning dma transfer and the uart overflow error is triggered because nothing is reading from the uart peripheral.As a work arround you can write:LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1);before the block with the MX initializiation functions or you can swap the calls to dma init and uart init.
Working on a hardware design for the STM32L562VET6Q (because that's all that's left with enough memory!)Want to add an S1D13517 (Epson) display controller. Said controller is memory mapped, 16 data bits, needs CS, etc, and one address line to select register/data (indirect memory mode). FMC on F767 supports this under LCD. L5 has FMC and LCD mode, but apparently only allows multiplexed connections (A16 is first address line available.) This is consistent with multplexed SRAM (which may be all this chip can do).However, the data sheet says it does straight SRAM, and CubeMX says it doesn't (and doesn't give me the support software).Which is correct? The limitation of non multiplexed SRAM not supported seems odd, but it could be a pin limitation in the LQFP-100 chip. However, didn't see anything about that in the data sheet.What's the answer?
HiI want to use a program i made before with the new IDE 1.8. It should reveive som data with the UART2 until EOL is received. It works on time and after it throws an interrupt (loops in the void USART2_IRQHandler(void)) but doesn't call the HAL_UART_RxCpltCallback anymore.I think I tried everything, here some parts of the code:int main(void) { ... HAL_UART_Receive_IT(&huart2, (uint8_t *)Rx_data, 1); //activate UART receive interrupt every time HAL_NVIC_SetPriority(USART2_IRQn, 3, 0); HAL_NVIC_EnableIRQ(USART2_IRQn); __HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE); } while (1) { if (Transfer_cplt > 0)// Daten vorhanden { ... do someting with receive data } } static void MX_UART2_UART_Init(void) { huart2.Instance = USART2; huart2.Init.BaudRate = 19200; huart2.Init.WordLength = UART_WORDLENGTH_8B; huart2.Init.StopBits = UART_STOPBITS_1; huart2.Init.Parity = UART_PARITY_NONE; huart2.Init.Mode = UART_MODE_TX_RX; huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE
I am trying to test Slave Mode / Gated Mode on TIM10 on my NUCLEO-STM32F401RE EVK.RM0368 describes this mode as:"Slave mode: Gated mode The counter can be enabled depending on the level of a selected input."I am trying to use CubeIDE to generate the code, but I do not see this can be configured through the tool.I don't see a way to configure any slave mode.Is it true that CubeMX can't generate code for this configuration?
Step1: Start My project from ST Board:Step 2: Selected the board and Start Project:Step 3: In Project Manager, chose EWARM as Toolchain/IDE:Step 4: Generate Code and Open Project:Step 5: Built the code without errors:Step 6: Downloaded the code and got Fatal error:IAR product info:
Hi,I can generate projects for keil with STMCube but when I choose FreeRTOS and keil, when I choose the compiler version to be V6, the build would fail. is there any work around this?
Hi!I am currently working with the stm32h747, trying to sample current and voltage using the internal ADC with its analog pins. My samples are wrong, the values sampled are coming out with a wierd offset (for example: 0 voltages is samples as ~1.87v). i can see that aplying votage on the pins or shorting them to GND gives some effect but the values are still wrong.the init code is standard and generated by cubeMX, My cube defenitions look like this: Here is an example of how i sample:the following function is called and i configure the specific pin i want to sample.float CAdc::GetAnalogIn(void){ float val, Result; ADC_ChannelConfTypeDef sConfig = {0}; sConfig.Channel = ADC_CHANNEL_18; //set MNTR_APD_Pin channel sConfig.Rank = ADC_REGULAR_RANK_1; //Work with one channel sConfig.SamplingTime = ADC_SAMPLETIME_16CYCLES_5; //number of cycles HAL_ADC_ConfigChannel(&h
programmed and thereafter either the controller resets or simply hangs. I tried both GUI and Cube programmer. The result is the same. If I change the BOOT0 and BOOT1 pins to FLASH execute mode and apply power the code works but changing the jumpers many times is eating into my time and testing time has increased enormously. I have switched to Windows 11 recently, but even after that I used the applications without any issue. Now I am facing this issue and I have some deadlines to meet. Can some please hep me resolve this issue ASAP. Thank you.
Today i lost 4 hours to get UART DMA working, to find out CubeMx put some initialisation code in the wrong order. I would like to tell ST employees about this.This was generated by CubeMx, UART DMA did not work at all MX_GPIO_Init(); MX_SPI2_Init(); MX_USART1_UART_Init(); MX_CRC_Init(); MX_DMA_Init(); MX_TIM16_Init();After moving the DMA init before UART init, everything worked well./* Initialize all configured peripherals */ MX_GPIO_Init(); MX_SPI2_Init(); MX_DMA_Init(); MX_USART1_UART_Init(); MX_CRC_Init(); MX_TIM16_Init(); /* USER CODE BEGIN 2 */
Hello, I searched all the documentation for STM32F4xx MCUs to find the proper source of the clock for each of SPIx peripherals - no result. Please somebody point to a proper document/chapter/page ...All chapters on SPI in the reference manual talk about "peripheral clock" Pclk without specifying which one APBx is used for clocking each SPIx.Also related to the above : the manual talks about prescalers for SPI clocking, yet, CubeMX does not provide option to setup prescaler for SPI2. Looks like some of SPIs do have prescaler but others don't . I can add manually the prescaler value into the MX-generated SPI setup but may be I am missing something in CubeMX SPI or clocks department ?Please help.
Hi,In CUBEMX with LQFP144, there is no configuration for both SRAM and SDRAM? But with other packets (LQFP176, LQFP208) there is a configuration like SDRAM1, SDRAM2, SRAM. Is it not possible with the LQFP144 or if I configure the parameters directly from the code, would it works? Because I believe all packets have the same properties except the pin numbers. Thank you.
Hi all,It is embarrassing when the browser crash when writing long text...Here is the original thought:I am trying to implement some low power in my MCU but not looking for extreme standby mode. I first try to stop CPU but it doesnt save too much power because the AXI are still running at high frequency. Then I try this, a dynamic CPU clock (possibly with AXI memory clock).From the clock tree, I can see there are 2 registers to control the clock to CPU and most of the peripherals. My goal is to change the CPU clock without affecting the peripherals clock. I am using an RTOS so I can easily know when to enter idle thread (task) (reduced CPU clock) or user thread (high CPU clock). I implement the below codes to switch between high and low clocks. These code are called bay RTOS's scheduler, when it switch to idle, call low_performance, when it switch to user threads, call the other. static inline void cpu_high_performance() { LL_RCC_SetSysPrescaler(LL_RCC_SYSCLK_DIV_1); LL_RCC_SetA
Hello Everyone!I've tried to configure SD Card to STM32F030R8T6 via SPI1.For reference I took this link: https://controllerstech.com/sd-card-using-spi-in-stm32/After configuration CubeMX in STM32CubeIDE I've got the start code.Without any other coding I builded the project, just to avoid any possible errors.When build has finished I've got 5 errors as shown on the picture below.If anyone get experience how to configure correctly the FATFS?I'll be much appreciate if you share with me. Thanks in advance
I'm working with a STM32F051 Discovery board. I've created a project that should allow me to adjust the output voltage to the DAC pin PA4, but the expected step voltage output to that pin remains at ground voltage level.I'm sure that I'm missing something simple but not sure. All configuration was created using the most recent STM32CubeMX 6.4.0 and I'm running my code with the STM32IDE 1.8.Attached is the main.c method as well as the .ioc project created by CubeMX,Can someone explain why my DAC output does not provide any signal?Thanks.
I configure STM32F767I(G-I)Tx via CubeMX. I enabled ADC_IN4 and DAC_OUT2 on dual-channel DAC.ADC_IN4 shares pin with DAC_OUT1. Even though DAC_OUT1 was not enabled in CubeMX I can see it applies voltage on the pin breaking ADC reading,This can be solved by adding sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_DISABLE; HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1);to MX_DAC_Init().Which means CubeMX enables DAC channel which was not configured/enabled in GUI.IMO, it's better to be fixed at CubeMX level than adding user code which disables unused DAC channel.
In CubeMX ther is missing optines to select charging of the battery and the seceltion of charging resistor 1.5K or 5KI would expect it to be under "System Core" -> RCC as it should go into resig PWR_CR3 So for my system I have to duck in "main.c" HAL_PWREx_ConfigSupply (PWR_LDO_SUPPLY); to HAL_PWREx_ConfigSupply (PWR_LDO_SUPPLY | PWR_CR3_VBE | PWR_BATTERY_CHARGING_RESISTOR_1_5);But it gets keeping over written from CubeMXIt is this 2 bits in PWR_CR3Bit 9 VBRS: VBAT charging resistor selection 0: Charge VBAT through a 5 k Ω resistor. 1: Charge VBAT through a 1.5 k Ω resistor.Bit 8 VBE: VBAT charging enable 0: VBAT battery charging disabled. 1: VBAT battery charging enabled.
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.