Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Posted on January 10, 2017 at 23:56Cannot find STM32L082xx WLCSP49 in CUBE MX#stm32 #cube-mx
Posted on April 12, 2017 at 13:41Hi.I have an stm32nucleo board with the stm32F051 chip.In CubeMX v.4.20.1 I have created a project based on stm32F030 (F051 is not available) where USART2 and Green LED gpio are activated.In main() I loop - toggle the LED and transmit a UART message.I'm running Keil MDK and my project compiles successfully.When I load the project onto the nucleo the LED starts blinking but there is no activity on the TX pin (PA2).Does anyone have an idea of what might be wrong? (My project is attached.)Could it be because my cubeMX project is based on a slightly different ship? In the STM32F0x Reference manual (RM0091) it seems that the F03x and F05x are very similar.Thanks,-Esben#usart #cubemx #stm32f051 #nucleo
Posted on April 11, 2017 at 21:24I think subject describes every thing.It could be so good if there was a read-only field (like the one in SPI configuration which shows baud speed) which could calculate and show target timer period based on configurations.#request #cubemx #timer #hal
Posted on December 11, 2016 at 23:47Since the last update to CubeMX, new projects created for SW4STM32 on OSX are not compiling anymore. The project settings for C symbols are missing quotes:__weak=__attribute__((weak)) instead of __weak='__attribute__((weak))'__packed=__attribute__((__packed__)) instead of __packed='__attribute__((__packed__))'#stm32cubemx
Posted on March 31, 2017 at 13:35Hi, I would like to sugest an insertion of 'user code' entry inthe MX_***_Init() functions between the Peripheral init and its NVIC config, like:...... GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> HERE <<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* EXTI interrupt init*/ HAL_NVIC_SetPriority(EXTI0_IRQn, 5, 0); HAL_NVIC_EnableIRQ(EXTI0_IRQn);�?�?�?�?�?�?�?�?�?�?�? ......�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?Because in my application when this code is executed it will generate an INT, hanging my application in an fault (as its posts to an RTOS queue not yet created)So I would like the option to insert ' __HAL_GPIO_EXTI_CLEAR_IT(0xFF);' before initializing interrupts of th
Posted on April 07, 2017 at 08:05Hello,im using the STM32F407 DIS with CubeMX to generate a USB CDC device.All works fine but if i unplug the STM32f407 and then plug in, Windows 10 didnt detect the driver(just unknown USB-Device)i have to reset the STM and then Windows detect the driver.What can i do to use the STM32 with plug and play?i use VCP 1.4#vcp-stm32f4 #cubemx-f4
Posted on March 10, 2017 at 15:57Hello! Recent update of CubeMX v4.20 introduced a bug in SystemClock_Config() function which cause HAL_RCC_OscConfig() fail. I am using STM32F103C8T6 chip with SW4STM32 v1.14 under Windows 10.In previous releases of CubeMX (v4.19 and older), when HSE turned on for Crystal\Ceramic Resonator the following code was generated as part of SystemClock_Config(): RCC_OscInitTypeDef RCC_OscInitStruct;/**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); }In v4.20 the same part of code (generated by same .ioc file) looks like this:RCC_OscI
Posted on April 06, 2017 at 13:14Hi,I use STM32CubeMX to generate the configuration of LWip on my card (nucleo F429ZIT6). Once my card program, I address a fixed IP address but I can't see my card on the local networks.The code generated is :int main(){ HAL_INIT(); SystemClock_Config(); MX_LWIP_INIT(); While(1);}I have no mistake, should I be able to ping my card?Thank !#tcp/ip #lwip #ethernet #cubemx #stm32f4
Posted on March 16, 2017 at 13:08I am trying to get the STM32-MAT package to work with Simulink to do some test on a stm32f4discovery board and I am running into multiple issues.1. A simple Simulink setup for a normal build:When building this simple model, the above error occurs.2. Trying out the PIL filter demo from the STM32demos folder of the STM32-MAT package.I select the correct uart settings, the processor and speed. For the uart I use usart2 at PA3 and PA2. The toolchain I use is SW4STM32.When the configuration for STM32CubeMX opens, the uart port has the following configuration error:The correct keyword according to the program should be WORDLENTH_8B, not UART_WORDLENGTH_8B. This has to be fixed manually every time and prevents the project generation from working when the call to CubeMX is hidden.3. If the issue above is fixed manually and the project is generated and opened with SW4STM32, the compilation errors out with missing files. This is due to the include paths bei
Posted on September 16, 2016 at 22:59I'm really struggling to get Touch Sensing working on the stm32L152 RCT6 discovery board. I'm trying to use it with CubeMX and understand that there is a particular procedure to use the Touch lib with CubeMX. Could anyone please explain the process, and have an example project to get up and running with?I have looked at the example included in the firmware package for cubemx, but it is for the stm32l152D_EVAL board and I'm even having trouble getting that to compile.Thanks #cubemx #stm32l152 #touch-sensing
Posted on April 04, 2017 at 16:29Using the attached cube project TestSTM32F051R8_TimError.iocWhen I generate the source codes the CubeMx version 4.20.0 produces the following initialization code for the timers (I used only TIM1 and TIM3) but the error is exactly the same for both of them...............void MX_TIM1_Init(void){ TIM_ClockConfigTypeDef sClockSourceConfig; TIM_MasterConfigTypeDef sMasterConfig;htim1.Instance = TIM1; htim1.Init.Prescaler = 4800; htim1.Init.CounterMode = TIM_COUNTERMODE_UP; htim1.Init.Period = 65535; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim1.Init.RepetitionCounter = 0; htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; <--- Error this field is not defined in the structure and also the TIM_AUTORELOAD_PRELOAD_ENABLE is not defined anywhere in the HAL libraries. if (HAL_TIM_Base_Init(&htim1) != HAL_OK) { Error_Handler(); }sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; if (HAL_TIM_ConfigClockSource(&a
Posted on December 09, 2016 at 13:47Hi guys! I want to configure my Nucleo board to use USB Host for pendrive and HID (keyboard). I'm creating a project using STM32CubeMX. When I set USB_HOST -> Host supporting ALL classes, I can't select FATFS -> USB Stick (checkbox is disabled). I'm attaching a screenshot below. How can I configure this functionality?#stm32 #hid #usb-host #stm32cubemx
Posted on February 22, 2017 at 14:43Hello. I am trying to integrate SD Card (Transcend 4GB) with STM32F407 Disc board. I had followed all previous discussion & made corrections yet i am getting Error. I have attached my clock configuration, Pin diagram of STM Cube MX & Detail Code. Can anybody tell me what extra changes i Need to do to get rid of error. Usually i am getting Disc error (Program is not going aheaf 'f_mount()'). When i press reset button it gives Disc Error. I changed all GPIOs to 'Pull high'. I am not sure if 3V power is enough for the Memory Card as i am directly connecting my VDD pin (STM32F4) to Memory Card. I have connected Memory Card by following way to board:1. Card Detect (PIN1) to PC2 2.CMD (PIN2) to PD23. Clock(PIN5) to PC124. VDD(PIN4) to 3V5. DAT0(PIN7) to PC8Any comments about Code & configurations will be highly appreciated.#fatfs #stm32f4discovery-stm32f4 #stmcubemx
Posted on November 04, 2016 at 13:42 In STM32Cube MX 4.17 I have set up an empty STM32L476 Nucleo project with and created code for the Low-Layer API. The parameters were: LL_PWR_REGU_VOLTAGE_SCALE2LL_RCC_MSIRANGE_8 The function SystemClock_Config() of the generated code starts with void SystemClock_Config(void) { LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE2); LL_RCC_MSI_Enable(); /* Wait till MSI is ready */ while(LL_RCC_MSI_IsReady() != 1) { } LL_RCC_MSI_EnableRangeSelection(); LL_RCC_MSI_SetRange(LL_RCC_MSIRANGE_8); LL_RCC_MSI_SetCalibTrimming(0); LL_FLASH_SetLatency(LL_FLASH_LATENCY_2); if(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_2) { Error_Handler(); } LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); ⋮ The documentation (DocID024597 Rev 4, section 5.1.7 Dynamic voltage scaling management) reasonably states that the FLASH latency must be set up before the core voltage is changed. However the function SystemClock_Config() does it the other way aroun
Posted on November 23, 2016 at 17:30The absolute path of a CubeMX project is embedded in the .ioc file. This makes a little more difficult moving the project elsewhere or restarting with the project for example when retrieving it from a remote Git repository. It would be better having the option to keep the project location-agnostic and to regenerate the project-derived files in the directory which contains the .ioc file. #feature-request #stm32cubemx
Posted on February 26, 2017 at 19:34Hi.I have noticed some problems when generating code using STM32CubeMX 4.19.0. I included the zipped project in the attachments. In the Src/main.c file it generates the declaration of the FSMC init functionstatic void MX_FSMC_Init(void);but it is never defined. All the other functions get properly defined below the main function but this one does not. It would really help to have this code generated since using FSMC is tricky.There is also a second issue with the code generation. I have set up a DMA Memory to memory transfer and it generated some code for it but it didn't define the variable is uses. I had to put the variable definition manually in my private global variable definitions.static void MX_DMA_Init(void) { ... hdma_memtomem_dma2_stream0.Instance = DMA2_Stream0; /* <------ hdma_memtomem_dma2_stream0 is undefined */ ...#sram #dma #stm32cubemx #fsmc #code-generation
Posted on February 13, 2017 at 09:43Hello everybody,I'm working on a webserver application, and I use the lwip 1.4 tcp/ip stack generated from the Cube Mx older version. Unfortunatelly I don't remember which version of Cube Mx because it was a long time ago, when I generated this project.(2015) But I know that version of Cube Mx containes just the Lwip 1.4, while the latest version of Cube Mx already contains the LwIp 1.5. This project is an old project and sometimes I paused to develop other projects, but it's the time when I would like to finish it.I'm working on STM32F407 device. I implemented the binary file upload, which wasn't implement on the stack in default. Sometimes when I try to upload the files, get TCP retransmission and TCP Dup Ack error on network capture. Sometimes the file upload was succesfully and somtimes wasn't. Can You tell me somebody why it's caused? I didn't find the right solution up to now.The two captures(one when the upload was succesfully, one when
Posted on March 14, 2017 at 01:39Hello everyone,I'm using the STM32F767ZIT on a custom PCB with an external 25MHz crystal. The project greatly involves around receiving messages from three separate controller area network (CAN) buses at 1 Mbits.I used the STMCube to map the functions/pins to the hardware and to generate c-code for the inits. For some reason, I get stuck in the HAL_CAN_Init every time without even adding a single line of user code. CAN TX is connected to PB9 and CAN RX is connected to PB8.The microcontroller doesn't seem to reset the INAK bit and therefore gets stuck in the while loop at line 306 in the stm32f7xx_hal_can.c file. According to the reference manual,'This bit is set by hardware and indicates to the software that the CAN hardware is now in initialization mode. This bit acknowledges the initialization request from the software (set INRQ bit in CAN_MCR register). This bit is cleared by hardware when the CAN hardware has left the initialization mode (to be syn
Posted on December 06, 2016 at 21:19Cube slows down the point when it is pretty much very hard to use. Sometimes clock resolver ends up in an continous loop which leads nowhere. Also on chips with more pins like BGA packages Cube slows down noticeably. Not sure how it is on Windows or Linux as I only use OSX for development.#stm32cubemx
Posted on March 05, 2017 at 20:12Hi,I'm using STM32F4 as a USB Host for writing data to a mass storage (flash drive) in FS mode using CubeMX. As we know USB-FS nominal speed is 12Mbit/s and I set this speed in CubeMX for my application. However, the maximum writing speed that I reached is about 560 kbit/s!I don't know what is the reason. Is there any special setting in FATFS,USB_FS or USB_Host configurations that affects speed?My code is similar to CubeMX example in repository,but I use FS Mode rather than HS used in example.Is there anything important with preparing data buffer for writing (that affects speed)? My writing code is:for(int16_t z=0;z<1024;z++) { sprintf(buf,'%5.5f,%5.5f\r\n',fbuf[z][0],fbuf[z][1]); res = f_write(&MyFile, buf, strlen(buf), (void *)&byteswritten); if((byteswritten == 0) || (res != FR_OK)) {Error_Handler();} }Thanks #usb-mass-storage #usb-fs #stm32 #cubemx #fatfs #usb-host
Posted on January 27, 2017 at 10:38I use STM32CubeMX ver. 4.19.0.I've configured DMA channel for I2S peripheral and saved the project. But when I try to open it again I get this warning:The project is attached.#bug #i2s #stm32cubemx #dma
Posted on February 15, 2017 at 12:22Hello everybody,I encountered the following problem when generating code from CubeMX for the USART peripheral of a STM32L476QEIx:SETUP: STM32CubeMX 4.19.0CubeL4 Version 1.6.0CPU STM32L476QEIxPROBLEM: USART1 is configured with Word length 9 bits (including parity) and Parity even (so I get 8 bits data and one parity-bit)But CubeMX does not set the parity information in the USART_InitTypeDef structure in the auto-generated function MX_USART1_Init()It sets the values of the structure-element for the parity options none and odd though - see the attached screenshotsFor even parity the USART-registers are not correctly initialized, i.e. the Parity-Enable bit is not set and therefore no parity generated -> so this really is a problem and leaves the USART incorrectly initialized!Did anybody notice the same problem or knows how to solve it?Thanks already and best regardsMarkus#uart/usart-parity-and-wordlengt #stm32l476 #cubemx
Posted on December 31, 2016 at 08:52 Hi, I've created a very simple project in STM32CubeMX for the F3DISCOVERY board. The only things I changed from the default are enabling MCO, and setting the PLL multiplier to When I import the code into SW4STM32 and press build, I get the following error: 17:41:40 **** Build of configuration Debug for project test_64mhz **** make all Building file: ../Src/main.c Invoking: MCU GCC Compiler /Users/jeremy/stm32_test/rcc_64mhz/test_64mhz/Debug arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F303xC -I'/Users/jeremy/stm32_test/rcc_64mhz/test_64mhz/Inc' -I'/Users/jeremy/stm32_test/rcc_64mhz/test_64mhz/Drivers/STM32F3xx_HAL_Driver/Inc' -I'/Users/jeremy/stm32_test/rcc_64mhz/test_64mhz/Drivers/STM32F3xx_HAL_Driver/Inc/Legacy' -I'/Users/jeremy/stm32_test/rcc_64mhz/test_64mhz/Drivers/CMSIS/Device/ST/STM32F3xx/Include' -I'/Users/jer
Posted on January 21, 2017 at 19:42I'm trying to get familiar with CubeMX and STM32 development process and I'm a bit puzzled with the L1 Discovery.To do so, I'm trying to 're-create' the demonstration FW shipped with the board using CubeMX.When creating a new project for the L1 Discovery board, a number of pin are already defined, as they are used by the board design, which is normal.However, I cannot have the PINs properly assigned in CubeMX to reflect the board. For example, regarding the screen someof the segments are used by the touch sensors. I haven't found a way to tell the system to use some other PINs for the signals. The SEG 3 to 6 conflicts and the followings are shifted, preventing the declaration of the other SEGments.Would it be possible to create the demo FW with CubeMX, or the board differ too much from the original design, it has to be made by hand?#stm32l152 #cubemx #discovery-l1
Posted on February 24, 2017 at 11:30Hi There seems to be a bug in the uart driver for the STM32L0, STM32F7 and STM32F4 but not for the STM32L1The bug is that you can't send while receiving on the uart:The code for STM32L0, STM32F7 and STM32F4:HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size){ /* Check that a Tx process is not already ongoing */ if(huart->gState == HAL_UART_STATE_READY) {The Code for the STM32L1HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size){ uint32_t tmp_state = 0; tmp_state = huart->State; if((tmp_state == HAL_UART_STATE_READY) || (tmp_state == HAL_UART_STATE_BUSY_RX)) {or in overall, you can't use the RX if you are using TX and the other way around.In my case I'm using (STM32L0) DMA RX and that is all ways in use, so it is not possible for me to TX. #cubemx#uart
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.