Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
There is an error in the ADC LL example projects on STM32G0 (Fw 1.5.1).Initalisation function (MX_ADC1_Init) call function LL_ADC_SetTriggerFrequencyMode()with inadmissible argument LL_ADC_CLOCK_FREQ_MODE_HIGHpermissible arguments are LL_ADC_TRIGGER_FREQ_HIGH or LL_ADC_TRIGGER_FREQ_LOWAlso CubeMX generate the same problem.
1.volatile uint16_t ADC_Value[4];-this is my array for the values to be stored2.void ADC1_Configure(void) { ADC_InitTypeDef ADC_InitStructure; ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; ADC_InitStructure.ADC_ScanConvMode = ENABLE; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfChannel = 4; ADC_Init(ADC1, &ADC_InitStructure); ADC_RegularChannelConfig(ADC1, ADC_Channel_4, 1, ADC_SampleTime_55Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_5, 2, ADC_SampleTime_55Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_6, 3, ADC_SampleTime_55Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_7, 4, ADC_SampleTime_55Cycles5); /
Hi!Problem described in title. The same setup working fine with 6.5.0 version of STM32CubeMX.Screenshot attached.
Hello,After creating a blinky project in CubeIDE version 1.11.0 running on Linux and setting up FreeRTOS within the .ioc file, the default task fails to run.A project created with STM32CubeMX V6.6.1 works, but when it was migrated to V6.7.0 (by opening the .ioc file and re-generating the code), it no longer works.It was found that: The osThreadNew(Task, NULL, &Task_attributes); functions were never generated in main.c! In its place, a copyright notice was printed instead (what is printed at the top of main.c).I assume someone used the wrong variable in the code generation software?Apologies if this is not the correct place to post these bugs, if not, please direct me where this information should be sent.
Hello,In my project I need CPU frequency independent CANBUS and SAI2 Master clock output.CANBUS is running out of PLL2P clock, while SAI2 MCLK is selected from PLL3PIf I only enable one or the other, they work great, but if I enable them all together desister ! My CANBUS traffic is just garbage and it hangs while the SAI2 clock is good. They are all on completely different PLL’s I don’t understand how it happens and how to fix itHere is SAI2_MCLK enable:void DCMI_Master_Clock_Config(void) { LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOC); LL_RCC_SetSAIClockSource(LL_RCC_SAI2_CLKSOURCE_PLL3); LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SAI2); LL_GPIO_SetPinMode(GPIOC,LL_GPIO_PIN_11,LL_GPIO_MODE_ALTERNATE); LL_GPIO_SetPinSpeed(GPIOC,LL_GPIO_PIN_11,LL_GPIO_SPEED_FREQ_VERY_HIGH); LL_GPIO_SetAFPin_8_15(GPIOC,LL_GPIO_PIN_11,LL_GPIO_AF_13); LL_GPIO_SetPinOutputType(GPIOC,LL_GPIO_PIN_11,LL_GPIO_OUTPUT_PUSHPULL); SAI2_Block_B->CR1 &=~SAI_xCR1_SAIEN;
I'm setting up the DMA to move received bytes from USART3 to a circular buffer. But the DMA don't move the received data to the buffer. The received data is received by USART3 (The DR contains the received byte and SR.RXNE is set to 1).All I need to do to make it work is to edit in main.c. I move the call to MX_DMA_Init() to be called before MX_USART3_UART_Init().Is this a STM32CubeMX bug?/* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); // I moved MX_DMA_Init() up here. Then it works. MX_USART3_UART_Init(); MX_TIM1_Init(); //MX_DMA_Init(); // DMA don't work if we call MX_DMA_Init() here MX_DAC_Init(); MX_TIM14_Init(); MX_ADC1_Init(); MX_SPI3_Init(); MX_CRC_Init(); MX_I2C1_Init(); /* USER CODE BEGIN 2 */
Hi,I have installed STM32CubeMX v6.7 on my laptop. The installation was successful.Loaded a project which was setup with STM32CubeMX v6.3 using FW_GO v1.5.0.The code is generated successfully, however when pressing to open the project, " Not a valid ioc file" errors on the screen.Attached STM32CubeMX log file.Any idea how to resolve it ?
I have wrote an product with tcp communication, last modification September 2021...Today I need a small evolution ( move from HSI-RC to HSE)...the Ethernet does not run now.I have try to work with doc concerning the new driver versus legacy...help-me.Eric
I am using Linux Linux kubuntu 22.10 5.19.0-26-generic and when I click on the GPIO Pull-up/Pull-down column elements nothing happens except the color of the row changes.
My idea is, to implement a timer (TIM1 in this case).Given a certain key pressed, I want to fire it up, let it count down causing an interrupt.This are the parameters I gave it in the init procedure. (STM32F103C8T6) static void MX_TIM1_Init(void) { /* USER CODE BEGIN TIM1_Init 0 */ /* USER CODE END TIM1_Init 0 */ TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; /* USER CODE BEGIN TIM1_Init 1 */ /* USER CODE END TIM1_Init 1 */ htim1.Instance = TIM1; htim1.Init.Prescaler = 7200; htim1.Init.CounterMode = TIM_COUNTERMODE_DOWN; htim1.Init.Period = 5000; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim1.Init.RepetitionCounter = 0; htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim1) != HAL_OK) { Error_Handler(); } sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL
I'm configuring a STM32F205RET for SPI: hspi1.Instance = SPI1; hspi1.Init.Mode = SPI_MODE_MASTER; hspi1.Init.Direction = SPI_DIRECTION_2LINES; hspi1.Init.DataSize = SPI_DATASIZE_8BIT; hspi1.Init.CLKPolarity = SPI_POLARITY_LOW; hspi1.Init.CLKPhase = SPI_PHASE_1EDGE; hspi1.Init.NSS = SPI_NSS_SOFT; hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8; hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB; hspi1.Init.TIMode = SPI_TIMODE_DISABLE; hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; hspi1.Init.CRCPolynomial = 10; HAL_SPI_Init(&hspi1);...with the relevant pins:MCU Pin SPI FunctionPA4 (Pin-20) Chip select (CS)PA5 (Pin-21) SPI1 SCK (D0)PA7 (Pin-23) SPI1 MOSI (D1)PB0 (Pin-26) Data command (DC)PB1 (Pin-27) Reset (RES)3V3 —GND —I'm using blocking functions like:HAL_GPIO_WritePin(OLED_DC_GPIO_Port, OLED_DC_Pin, GPIO_PIN_SET);HAL_GPIO_WritePin(OLED_CS_GPIO_Port, OLED_CS_Pin, GPIO_PIN_RESET);if ((HAL_SPI_Transmit(&hspi1, pData, nBytes, SPI_TIMEOUT_MAX)) != HAL_OK) &nb
Hello!I have faced the problem with ADC checking using DMA on my F446RET6 MCU. The software tools are CubeMX 6.7.0 and CubeIDE 1.10.1. The Firmware is FW4_1.27.1. Perhaps, it is my mistake, but i canntot understand how to fix it. Here is the simple project directory in cubeIDE https://www.dropbox.com/s/g1o8yunmubjjmk1/F446_ADC_DMA.zip?dl=0 together with .ioc file.After HAL_ADC_Start_DMA(&hadc3, (uint32_t*)c_buff, ADC_CCONV); call there is no HAL_ADC_ConvCpltCallback() interrupt, yet i could not capture the interrupt inside the standard DMA2_Stream0_IRQHandler().Looking forward for your advice.
I'm having an issue reading one of the channels on an ADC. It is working for one channel but not the other, even though the settings are the same. I am verifying what the expected value should be based on an oscilloscope measurement taken right off of the pin. What are some of the things I should look out for? For some more details:I am using an STM32F303RBT6, and ADC 4. Channel 4 is working, channel 3 is not. I have tried swapping their rank, but that seemed to have no effect.They are configured like this:I have tried both a polling approach and a DMA approach. Currently I'm focusing on the polling approach since it is more basic and I was seeing frequent crashes with the DMA approach. Polling approach based from controllerstech (can't add link)Code to poll for ADC:.... void ADC_Select_Channel(uint32_t ch) { ADC_ChannelConfTypeDef sConfig = {0}; /** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time. */ sConfig.Channel = c
This is for a STM32H70 When uploading from CubeMx IDE or STM32CubeProgrammer I get these errors:STM32CubeProgrammer:Warning: File corrupted, Two or more segments defines the same memory area. 17:11:15 : Number of segments: 6 17:11:15 : segment[0]: address= 0x20000000, size= 0x0 17:11:15 : segment[1]: address= 0x20010000, size= 0x0 17:11:15 : segment[2]: address= 0x24080000, size= 0x0 17:11:15 : segment[3]: address= 0x30000000, size= 0x0 17:11:15 : segment[4]: address= 0x38000000, size= 0x0 17:11:15 : segment[5]: address= 0x90000000, size= 0x1143A8 17:11:16 : Warning: File corrupted. Two or more segments defines the same memory zoneCubeMx IDE:"Error in final launch sequence:Failed to execute MI command:load ... .elfError message from debugger back end:Error finishing flash operationFailed to execute MI command:load ... .elfError message from debugger back end:Error finishing flash operationFailed to execute MI command:load ... .elfError message fr
Hello, I would like to connected my STM32F746G Disco board to the server on PC computer. I started from example from STM32CubeMX. I would like to do something like that:PC computer as server - I using Hescules Setup Utility.STM32F746NG - Disco as client LwIP no RTOS.My issues is that I cannot connect to the server.Please find in the attachment my firmware and raport from wireshark.I tried the solution from:https://community.st.com/s/question/0D50X00009XkgffSAB/stm32f746-ethernet-dma-transmit-problem?t=1639776494585But doesn't work for me.Ping from PC to STM32 work(<1ms).Pinging 192.168.0.100 with 32 bytes of data:Reply from 192.168.0.100: bytes=32 time<1ms TTL=255I noticed that during trying connection with server(Hercules) if I switch the tab in Hercules application to "TCP client" and click connect and return to TCP server I got connection and then I can even reset the STM32 board and I can connect to the server until I close Hercules. It seems weird but it's the only way I've
I'm trying to generate the files for a makefile project but it's grayed out :(I am able to do it for an STM32L496, but not for the STM32U575. Is there any particular reason for this?I'm using CubeMx v6.6.1Thank you!
Whenever I make a project with CubeMX, I explicitly tell it to copy the files it needs and to NOT make references in CubeIDE. Nothing making sharing projects more painful than eclipse references.That being said, I just started a project with an STM32H745 MCPU and I've told it to copy the files: But, for some reason.. It doesn't. It's still making references. Incredibly annoying.
Hello,I want to generation code with FreeRTOS in Trustzone at STM32L562ZET6Q.I want to use FreeRTOS in Non-Secure Zone.So, I enabled FreeRTOS in Middleware division.And, I want to change about Timebase Source in SYS_NS.But, all timers are disabled(inActive) except SysTick.So, there occur warning message about SysTick when run code generation.Environments :STM32CubeIDE : v1.11.0STM32CubeL5 : v1.5.0Best regards.
Hi,In CubeMx V6.6.1 - Windows 11 i am having the 2 following issues.In Project Management if i select Makefile as the Toolchain / IDE then i cannot access the toolchain location folder to make it a new location, the input box is not enabled.To work around the point above i do the following steps:choose first EWARM as Toolchain / IDEupdate the Toolchain location folderchoose Makefile as Toolchain / IDEGenerate the codeUntil this point all goes ok and the toolchain files are correctly generated in the toolchain folder.But if i close CubeMx project and reopen it again the toolchain location is lost.I looked inside the project.ioc file and it is correctly stored there.It seems like this might be a bug.ThanksPaulo
I have Nucleo U575ZI-Q board and I am trying to unable ADC with DMA and Interrupt but not able to get any reading. I am trying to see the adcBuf value in live expression but it is not working./* USER CODE BEGIN Includes */ #define max_channel 2 uint32_t adcBuf[max_channel]; uint32_t test=0; /* USER CODE END Includes */ ADC_HandleTypeDef hadc1; DMA_NodeTypeDef Node_GPDMA1_Channel0; DMA_QListTypeDef List_GPDMA1_Channel0; DMA_HandleTypeDef handle_GPDMA1_Channel0; UART_HandleTypeDef huart1; PCD_HandleTypeDef hpcd_USB_OTG_FS; void SystemClock_Config(void); static void SystemPower_Config(void); static void MX_GPIO_Init(void); static void MX_ADC1_Init(void); static void MX_UCPD1_Init(void); static void MX_GPDMA1_Init(void); static void MX_USB_OTG_FS_PCD_Init(void); static void MX_USART1_UART_Init(void); int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration------------------------------------------
I've been trying to use the ADC of an STM32F7 so that when the level exceeds a certain threshold it start to sample the input continuously. Here is the configuration. Then I have implemented the code as followsvolatile ITStatus adc1OutOfWindow = RESET; void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef *hadc) { HAL_GPIO_WritePin(LED_BOARD_GREEN_GPIO_Port, LED_BOARD_GREEN_Pin, GPIO_PIN_SET); if (hadc == &hadc1) { if (adc1OutOfWindow == RESET) { adc1OutOfWindow = SET; HAL_ADC_Start_DMA(&hadc1, (uint32_t*) adc1DoubleBuffer, ADC_DOUBLE_BUFFER_SIZE); } } } // Called when first half of buffer is filled void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc) { if (hadc == &hadc1) { osMessageQueuePut(mqAdc1Dma, &adcFirstHalfMsg, 0U, 0U); } } // Called when buffer is completely filled void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc) { if (hadc == &hadc1) { osMessageQueuePut(mqAdc1Dma, &adcSecondHalfM
Hi,I have an application running on STM32F429ZIT6 using USB stack to communicate with PC client.MCU receives one type of message of 686 bytes every second and receives another type of message of 14 bytes afterwards with 0,5 secods of delay between messages. The 14 bytes message is a heartbeat so it needs to replied by MCU.It happens that after 5 to 10 minutes of continuous operation, MCU is not able to send data because hcdc->TxState is alway 1, ie, busy. Reception works fine.During Rx interruption, application only adds data to ring buffer, so that this buffer is later serialized and processed by main function.static int8_t CDC_Receive_HS(uint8_t* Buf, uint32_t *Len) { /* USER CODE BEGIN 11 */ /* Message RX Completed, Send it to Ring Buffer to be processed at FMC_Run()*/ for(uint16_t i = 0; i < *Len; i++){ ring_push(RMP_RXRingBuffer, (uint8_t *) &Buf[i]); } USBD_CDC_SetRxBuffer(&hUsbDeviceHS, &Buf[0]); USBD_CDC_ReceivePacket(&h
I have a custom board using a STM32F446RET6 with a SD micro card slot.The card is formatted to exFAT with one partition.Using STM32CUBEMX V6.6.1 with firmware F4 V1.27.1For testing I have a minimal configuration as follows:SDIO Mode SD 4 bits Wide bus DMA enabled for RX and TX SDIOCLOCK divide set to 4 SDIO global interrupt enabledUSB_OTG_FS Mode is Device Only USB OTG global interrupt enabled USB_DEVICE Class for FS IP = Mass Storage Class MSC_MEDIA_PACKET size is 512 bytes (I have tried increasing this)MCU clock 168 MHz using 12 MHz external crystal SDIO clock is 48 MHz USB clock 48 MHzRunning this setup when I plug a usb cable to the board the following shows in the log:usb 2-1.6: new full-speed USB device number 67 using ehci-pciusb 2-1.6: New USB device found, idVendor=0483, idProduct=572a, bcdDevice= 2.00usb 2-1.6: New USB device strings: Mfr=1, Prod
Hello, Updated CubeMX as well as H7 libraries, and now see problems with clock configurator, as well as some LL function calls in system clock init has no definition !STM32H743XI should have 480MHz clock... And if we generate code, we get problems like this : (H7 V1110) LL_PWR_EnableRange1BoostMode();Error[Li005]: no definition for "LL_PWR_EnableRange1BoostMode"
Hello,I've created a new project and it seems like code wasn't generated as it should.Modified only clock configuration and added FREERTOS to my project.I think here tasks should be started, instead I have duplicate for header:Is it normal, have I missed something?Best regards,Krzysztof
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.