Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Could you consider adding the following feature to CubeMX:Provide a free text comment field for each peripheral to be printed in the PDF and to appear as a C Language comment above the peripheral initialization code block and DMA code block.This would make it easier to track what each peripheral has been used for i.e."USART 2 GPS Interface""USART 3 WiFi Modem Interface""ADC 1 Voltage Inputs."/* USART2 init function */ /* Real Time Clock Sattelite Sync (UART 3) */ <<== Example of comment field output to code. void MX_USART2_UART_Init(void) { huart2.Instance = USART2; ... ... }Such a feature would enhance the value of CubeMX, particularly where the project uses a lot of the same type of peripherals for different functional interfaces.Best regardsRob
Hello,i am using the STM32F103C6 MCU and i would like to produce 3 different Center Aligned PWM signals with 16KHz frequency and Duty Cycle 1 to 99%. I would like to change the duty cycle on fly using the CCR registers.I am configuring the 3 of TIM1's channels as Output Compare:Then i choose the Center Aligned_3 mode and setting the frequency on 16KHz (frequency is correct):Finally, every channel has the same settings as below:With CubeMX's default code, i am just starting the OC and setting the desired pulse:/* Initialize all configured peripherals */ MX_GPIO_Init(); MX_TIM1_Init(); /* USER CODE BEGIN 2 */ HAL_TIM_OC_Start(&htim1, TIM_CHANNEL_1); HAL_TIM_OC_Start(&htim1, TIM_CHANNEL_2); HAL_TIM_OC_Start(&htim1, TIM_CHANNEL_3); TIM1->CCR1 = 400; //Channel_1 ~ 82% Duty Cycle TIM1->CCR2 = 1125; //Channel_2 ~ 50% Duty Cycle TIM1->CCR3 = 2200; //Channel_3 ~ 2% Duty CycleAnd on simulator everything is correct:If we change the CCR1 to lower value:T
I am working with a STM32G474RE and I want to use a MCO as an output of HSE(27MHz).I used STM32CubeMX Ver.5.6.1 for generate simplest init. code, which would work only for MCO function at PG10 Pin. here's my setup.I builded the init. code by SW4STM32 without any modification.27MHz crystal is connected betoween PF0 and PF1. I measured wave form at PG10 and PA8 Pin by oscilloscope.PG10 wave form was tied to 3.3V DC, and PA8 wave form was 27MHz clk signal. I thought that I must write something to set PG10 as standard GPIO in order to avoid confliction with NRST function. Therefore, I can't find how to do it.Thank you.
Hi,I designed a small board with STM32L433RCT6 MCU because in addition to meeting my requirements it also has SDIO. I've confirmed this in reference manual and in CUBEMx. While I was waiting for my board, I bought a Nucelo-L433RC to start develop some code. For my surprise, when I chose this board in CubeMx the SDIO doesn't appear on Connectivity section.Any one knows how can I fix or mitigate this problem?Thanks in advance
HiAlthough I configure in the cube that no external transceiver is used the define is set in the file (stm32h7xx_hal_conf.h).Any idea?Regards Jakob
HiI'm very new to STM32. I create a project with STM32CubeMX for the STM32F746-Disco board and I need to use USB OTG HS for sending data to PC through VCP. The data size which I need to send to PC is 24576 Bytes. The USB connected properly but after some second the send data became corrupted! I mean that the data did not send true, Although the USB connection still is established.Is there a way to solve this problem?
Dear ST,I would like to use an STM32F042F4 MCU with CAN communication. I saw the CAN bus in STM32CubeMx by Connectivty, but i can't select it (it is grey)? I read in the datasheet of the MCU that i have to remap CAN bus pin to PA10 and PA9.Can you help me, how can select CAN bus in STM32CubeMx?Thanks
When I enable TIM16 and TIM17 for a project on the STM32H753ZI in CubeMX (version 5.6.1) and I select Input Capture direct mode from Remap, I can select TI1 remap capabilities (see picture below).The generated code below is not correct. Line 17 calls HAL_TIMEx_RemapConfig() which is not suitable for this timer. The code should call HAL_TIMEx_TISelection(&htim17, TIM_TIM17_TI1_RCC_HSE1MHZ, TIM_CHANNEL_1) instead./** * @brief TIM17 Initialization Function * @param None * @retval None */ static void MX_TIM17_Init(void) { /* USER CODE BEGIN TIM17_Init 0 */ /* USER CODE END TIM17_Init 0 */ TIM_IC_InitTypeDef sConfigIC = {0}; /* USER CODE BEGIN TIM17_Init 1 */ /* USER CODE END TIM17_Init 1 */ htim17.Instance = TIM17; htim17.Init.Prescaler = 0; htim17.Init.CounterMode = TIM_COUNTERMODE_UP; htim17.Init.Period = 0xffff; htim17.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim17.Init.RepetitionCounter = 0; htim17.Init.AutoReloadPreload = TIM
I'm attempting to add a USB connector to my project, but my MCU lacks a "VBUS_SENSING" pin like another MCU I've been experimenting on has. Is there a way to simulate this pin? I'm using the MCU as a self-powered deviceMCU: STM32L052K6U6 (UFQHPN32)Programs: CubeMX, CubeIDE
I've noticed that when I enter the specific development board model, say for instance Nucleo-32 STM32G431 in my case, if I switch to HSE, the crystal is always set to 8Mhz, even if the crystal on the board isn't (i.e. it's 24Mhz in this case).It would be great if the UI could be updated to additionally fill this in to match the hardware that the user has purchased.It's the little details like this that make the software feel more approachable for users.Thanks!
Hello to all, I am having problems with the CDC USB Device application. Does some one have a working USB example for STM32L1? . I am using latest version of CubeMx and STM32L1 firmware v1.9.0. The problem is that PC does not recognize the USB Device (Device unknow error 43).I put together a very basic app, just to check if windows (W7 or W10) recognize the USB device but it fails. I have been doing some HW and SW check and looks all fine but can't find the problem.I would like to test a working USB example for STM32L1 or otherwise an older firware version just for testing.Will be very grateful if I can get some help on this.Thanks
I´m unable to generate the code for the CMSIS core of the STM32F407 Discovery kit.I have configured correctly everything (as shown in image 1, the other configuration tabs haven´t been modified from default ) but it gets stucked (image 4) in the bar and I find task manager shows a high consum,ption in Java Platform SE Binary.Please help!
..
So I wanted to use a single DMA with the Dual regular simultaneous ADC mode on a NUCLEO-L476RG. However I noticed that just the master ADC value was present in the buffer of the DMA, even though the Data width of the DMA is set to Word.After some investigation, I found that in the file stm32l4xx_hal_msp.c in the function HAL_ADC_MspInit, automatically generated by STMCubeMX:hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;Changing manually DMA_PDATAALIGN_HALFWORD to DMA_PDATAALIGN_WORD is working, but I wanted to know if there is an option in STMCubeMX to configure that ?FYI here is the parameters I set in STMCubeMX v5.6.0-RC6: ADC Master : ADC Slave : DMA :
there is a strange issue when generate a code. The code generation cannot be ended with an error - "But EWARM V8project generation have a problem. before the code can be generated without an errors. After run generated code, always be hang at SystemClock_Config(); halt on HSI_TIMEOUT_VALUE. I have no issues for the code with the previous version 4.27.0. Please advise on these two issues. thanks.Regards,Jiannong
This is a test, but for this 01.2.3 Prerequisite - STM32Cube MX HAL MOOC , it's not a video and I'm stuck at 1% ... It should be 100%, if open no ? I put a screenshot here :
I cannot for the life of me find out where the interface descriptors are defined. Examples I have found on the web indicate ( for a CDC device at least ) a file "usbd_desc.c / h" that contains the definitions. There is no equivalent usbh_desc.c file. I can find the structures ok but not where they are initilised. So, my question is: in which file are the interface descriptors initialised?
Hi, I appreciate that you have a bunch of examples on the LwIP for this board and other boards, but I'm having a great deal of difficulty compiling any of them under Linux. My tool chain is STM32CubeMX, and I'm using Ac6 (eclipse) to compile the projects into a binary. The examples provided don't have ioc files, and only basic guidance on how to setup the networking in STM32CubeMX, like small notes like use the default timers etc. There is also no makefile provided with the project LwIPexamples, which makes compilation problematic for me.What I would like is to use RTOS with a simple network example using BSD sockets, to open up a socket, bind to a power, listen and accept a connection, nothing complicated, I'd be satisfied with just an LED turning on when some data is received on that port. However, I seem to keep getting stuck with numerous issues. I can't work out if I need to be using RTOS 1 or RTOS 2. I can't seem to find any guidance on this, which should i use? When I create a p
.... There is a tick box to say force DMA interrupts but that isn't ticked.It's annoying because I have to remember which ones I actually want and I need to make sure that I do this before regenerating the code. Probably something I am doing but it's not obvious.Regards.J.
I'm using STM32CubeMX to create a project for a NUCLEO-F746ZG with the LwIP middleware.Unfortunately, the IP Address Settings (IP, Netmask, Gateway) don't show up in the code anymore. In MX_LWIP_Init() there's justvoid MX_LWIP_Init(void) { /* IP addresses initialization */ /* Initilialize the LwIP stack without RTOS */ lwip_init(); ...without the actual address settings.Before updating CubeMX the settings where done in between those two comments like this:void MX_LWIP_Init(void) { /* IP addresses initialization */ IP_ADDRESS[0] = 192; IP_ADDRESS[1] = 168; IP_ADDRESS[2] = 0; IP_ADDRESS[3] = 2; NETMASK_ADDRESS[0] = 255; NETMASK_ADDRESS[1] = 255; NETMASK_ADDRESS[2] = 255; NETMASK_ADDRESS[3] = 0; GATEWAY_ADDRESS[0] = 0; GATEWAY_ADDRESS[1] = 0; GATEWAY_ADDRESS[2] = 0; GATEWAY_ADDRESS[3] = 0; /* Initilialize the LwIP stack without RTOS */ lwip_init(); ...I can't seem to find them anywhere else (they only show up in the .ioc file).Am I missing something or is this a bug
Hi!I tried to set peripheral initialization order in Project Manager->Advanced Settings.After I finished sorting the list and saved the project, the function list mixed.The problem is reproducable. When you save the project, the function list gets a random order.It would be good if somebody has a solution to this problem.Thanks!
Hi I am using below configuration to read adc channels but I get some good values and some very bad values.My configurations are : void MX_ADC1_Init(void){ /* USER CODE BEGIN ADC1_Init 0 */ /* USER CODE END ADC1_Init 0 */ ADC_MultiModeTypeDef multimode = {0}; ADC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN ADC1_Init 1 */ /* USER CODE END ADC1_Init 1 */ /** Common config */ hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV8; hadc1.Init.Resolution = ADC_RESOLUTION_12B; hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE; hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.ContinuousConvMode = DISABLE; hadc1.Init.NbrOfConversion = 1; hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.ConversionDataManag
File \USB_HOST\Target\usbh_conf.h has the definitions:#define USBH_malloc malloc#define USBH_free freeThis does not work with FreeRTOS. It will be better, but maybe not perfect:/** Alias for memory allocation. */ #if (USBH_USE_OS == 1) #define USBH_malloc pvPortMalloc #else #define USBH_malloc malloc #endif /** Alias for memory release. */ #if (USBH_USE_OS == 1) #define USBH_free vPortFree #else #define USBH_free free #endif
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.