Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Posted on December 02, 2017 at 10:36Hello,CubeMX is a good software but there are many things it's still missing, it'd be very neat to have these options implemented:1- A Timer calculator similar to the external tool by mikroelectronika but for all MCUs and for all Timer modes.for example i just want a timer to count a limited time(without interrupts) but i have to read the datasheet just for that.it could be as simple as what we have for SPI clock or just more advanced to have all the option illustrated with a simple text(or GUI)2- All peripherals could benefit a description section which can be modified inside CubeMX.(for example just to comment what that specific timer is used).3- in Clock Configuration window it would be very nice to have the option to know which peripherals are connected to which APB bus. currently it shows some of them and for example for timers we need to read the datasheet.4- datasheet specifies we can have peripheral to peripheral DMA requests , why don't we
Posted on November 29, 2017 at 14:41I'm trying to create a MSD for the STM32L073RZT6, and want to use 64K of the flash memory as storage.I've tried to get the erase/write correct, but Windows says the format fails...Can anyone spot the obvious mistake?&sharpdefine EEPROM_START 0x8020000&sharpdefine EEPROM_LENGTH 0x0010000&sharpdefine STORAGE_LUN_NBR 1&sharpdefine STORAGE_BLK_SIZ 0x200&sharpdefine STORAGE_BLK_NBR (EEPROM_LENGTH / STORAGE_BLK_SIZ)int8_t STORAGE_Read_FS (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len){ /* USER CODE BEGIN 6 */ uint32_t newAddr = (STORAGE_BLK_SIZ * blk_addr) +EEPROM_START; memcpy(buf, (void *) newAddr, blk_len * STORAGE_BLK_SIZ); return (USBD_OK); /* USER CODE END 6 */ }int8_t STORAGE_Write_FS (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len){ /* USER CODE BEGIN 7 */ FLASH_EraseInitTypeDef eraseInfo; uint32_t PageError; HAL_FLASH_Unlock(); // 128 byte pages in our flash, so 4 pages per s
Posted on November 27, 2017 at 10:40hi,I set external interrupt 3 on cubemx to Rising edge and need to change of trigger level that on its routine.I write this code on interrupt 3 routine, but it always trigger by rising edge (down't execute falling edge) (PLEASE: see attach image)how can I fix this problem with HAL driver command?void EXTI3_IRQHandler(void){ /* USER CODE BEGIN EXTI3_IRQn 0 */switch(valuee){ case 10: HAL_GPIO_WritePin(RLED_GPIO_Port,RLED_Pin, GPIO_PIN_SET); CLEAR_BIT(EXTI->RTSR,0X03); SET_BIT(EXTI->FTSR,0X03); valuee=15; break; case 15: HAL_GPIO_WritePin(RLED_GPIO_Port,RLED_Pin, GPIO_PIN_RESET); CLEAR_BIT(EXTI->FTSR,0X03); SET_BIT(EXTI->RTSR,0X03); valuee=10; break;} /* USER CODE END EXTI3_IRQn 0 */ HAL_GPIO
Posted on November 12, 2017 at 10:03Hello.I want to teach simple programming for my friend, and guess what, none of DSI examples for STM32F469i-Disco worked from CubeMX folder.\STM32Cube_FW_F4_V1.16.0\Projects\STM32469I-Discovery\Applications\Display\LCD_PaintFor the love of god, discovery kits suppose to give simple examples how to use device, and I spend 2 hours trying all DSI examples, none of them worked. This is not right.Had to rewrite it in SPL, it start to work, but touchscreen porting was to difficult, so i have to switch to STM32F429i to make it work.Please ST, fix this problems, and please, use SPL for H7 and F7 series, we love SPL, and we don't need CubeMX bugs ruing our lifeI only use CubeMX for footprints and AF functions, that it !#bugs #hall-with-bugs #hall-does-now-work #hall-sukcs #cubemx #where-is-spl
Posted on November 24, 2017 at 16:09There is an issue with the PLLI2S initialization in generated Code from CubeMx 4.23.0. It is skipped under certain conditions detailed below.The clock network given in the picture is initialized with the following struct field in SystemClock_Config():PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_PLLI2S | RCC_PERIPHCLK_USART3 | RCC_PERIPHCLK_CLK48; The PeriphClkInitStruct is then passed to HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit) in stm32f7xx_hal_rcc_ex.c. This function checks each bit of the bitfield and initializes the corresponding clock if necessary. However, the bit for PLLI2S is not checked properly. Here is the faulty code: /*-------------------------------------- PLLI2S Configuration ---------------------------------*/ /* PLLI2S is configured when a peripheral will use it as source clock : SAI1, SAI2, I2S or SPDIF-RX */ if((plli2sused == 1) || (PeriphClkInit->PeriphClo
Posted on December 21, 2016 at 09:01Hello. I found something strange in my STM32F100RC controller. I made a clean project in latest CubeMX to show this error.When I try toswitch my MCU from full JTAG (reset state) to use only SWD pins the programming/debug interface stops working completely. I was forced to reflow two ICs before I found there is the error with init procedure.The code:int main(void) { uint32_t initPauseCounter = 0xFFFFF; // pause that helps us to burn new firmware while(initPauseCounter--); // before SWD stops working /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_USART1_UART_Init(); __HAL_AFIO_REMAP_SWJ_ENABLE(); printf('AFIO->MAPR state: 0x%08lX\n', READ_REG(AFIO->MAPR)); printf('AFIO_MAPR_SWJ_CFG_NOJNTRST: 0x%08lX\n', AFIO_MAPR_SWJ_CFG_NOJNTRST); printf('writing...\n'); __HAL_AFIO_RE
Posted on November 23, 2017 at 11:27Hi HAJJEM.Oussema after some time CUBEMX brings in trouble in an IAR project in a way that 'go to definition of variables or functions' no longer works. CPU usage of IAR keeps growing and growing. Can you reproduce this?1. generate any project with cube2. Add you own user files AND directories3. add some timers or what ever in cube4. regenerate project5. loop steps 2-4 couple of times6.the following feature is broken in IAR -> 'go to definition of ' variables or functions. This feature in IAR becomes in stable. 99% of the time it will be broken.When I look at ewd/ewp files of IAR, with every CUBE MX generation the file grows. Why does CUBEkeep adding <state></state>?Basically ewp files grows in content for no reason!Workaround:1. delete EWP/EWD files.2. Regenerate project with cube.3. add user files, user inculde directories , and all your changes to the compiler which you hopefully remember ;)4. 'go to definit
Posted on May 20, 2017 at 15:56Hi,After generation of code with STM32CubeMx (release 4.21.0), Error_Handler() interface present in main.h is not specified to be used in C-style linkage as it's done in the rest of the code.This performing a linkage error with IAR C++ compiler.Please, fix it in the next release.Thx and Regards#main.h #c-style-linkage #stm32cubemx-4.21.0 #error_handler()
Posted on September 07, 2017 at 18:31I am trying to compile the CubeMX expansion for AWS, but I get an Error[Lp050]: placement includes both uninitialized sections (example 'ro data section UNINIT_FIXED_LOC in iot_flash_config.o symbols: [lUserConfig]') and sections with content (example 'initializers for P3'). Does anyone know how to fix this?#cubemx #aws
Posted on November 13, 2017 at 23:41Hi,I am working with STM32F072RB and I am developing composite device. The device consists of 3 different interfaces but only one has in and out endpoints. It's custom HID with input and output report of 64 bytes. Really nothing special. My code includes many define switched so I can easily switch from composite device with 3 interfaces to simple Custom HID device. So to my question...I am sending data from PC to device. If I am using device as a custom hid device I can receive data and DataOut function gets always called. static uint8_t USBD_HID_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum){...}Received data is valid.Then I switch to composite device configuration and that same Custom HID is just one those 3 interfaces in that composite device. In that case I experience strange behaviour...The first packet I send from PC to device has all zeros inside... so no data is present. If I retry to send same data again I get valid data. So th
Posted on November 10, 2017 at 08:05I am using the STM32F765BIT micro controller(208 pin package) in our custom board, I am using STM CubeMx generated code. I have selected two SPI (SPI1 & SPI2) interface both are with same configuration. with SPI2 I can able to access external SPI-device (both read write is working).But when I tried with SPI1 I can't able access same device . I also cross checked the signal levels of SPI1 interface , No signal is coming (CS,CLK,MOSI). Is there any additional configuration needed to use SPI1 interface. Can you please give some brief details regarding this.Thank youBest regards Maheshwar#keil-mdk5 #stm-32f7 #cubemx #stm32-f7 #spi-write-and-read
Posted on October 17, 2017 at 22:27Hello,I am trying to estimate power consumption on the stm32h7. The use case i am interested in is sampling 6 channels using ADC3 and transferring the sampled data to memory using BDMA, all this while D1 and D2 domains are in stop mode and only D3 is working. The thing is that i am not able to configure the D1&D2 to stop modes. If i set the power mode to RUN, then D1 has only two options - DRUN/CRUN and DRUN/CSLEEP, in which case D2 only has DRUN. If i set the power mode to STOP, then D1 has DSTOP/DSTANDBY, D2 has DSTOP/DSTANDBY and D3 only has DSTOP.The power consumption in the first case looks too high to me - 17mA. And off course in the second case D3 is in DSTOP, so it is not what i want.I am doing something wrong with the configurations, or is it because STM32CubeMX Version 4.22.1 does not support this work mode in power consumption calculator?Thanks,Evgeny#stme32-cube #stm32h7 #low-power-stop-mode #power-consumption #cube-mx-power
Posted on October 10, 2017 at 23:15I know it's kind of stupid. But I still want to make sure if the repository folder can be changed? Because the capacity of my C is not big enough.#stmcubemx
Posted on November 07, 2017 at 12:53Hello everyone, In this project I just want to use the user button to toggle a LED on my board. The model is designed by using Simulink and initialization codes are generated by STM32CubeMX. During the experiment, I was facing to a big problem: I don't know how to correctly set the sample time of Simulink model Ts and how to correctly make the clock configuration in STM32CubeMX. Fig. 1: Simulink Model Sample Time Fig. 2: Clock Configuration in STM32CubeMX Here, I want to describe my problem in detail:1) When the sample time of Simulink model is set to Ts = 1E-5 (fs = 0.1 MHz) and MCU HCLK is only set to HCLK = 1 MHz (all prescalers after HCLK are not modified), the LED can be toggled while pressing the user button.2) When Ts = 1E-6 (fs = 1MHz) and HCLK = 1 MHz, the LED can't be toggled.3) When Ts = 1E-6 (fs = 1MHz) and HCLK = 168 MHz (max. Value), the LED can be toggled.4) When Ts = 1E-7 (fs = 10 MHz) and HCLK = 168 MHz (max. Value), the LED ca
Posted on November 02, 2017 at 14:15Hello,I'm new to this exiting world of MCUs.I tried many installs from scratch, did all the available updates I found, but I still can't see my 'STM32F407G-DISC1' in the list of boards in STM32CubeMX.I find 2 'STM32F4DISCOVERY' with the only difference about the on-board ST-LINK version, one is 'V2', the other is 'V2-1'.Can someone give me a hint on how to get my board listed in the tool, please ?I also noticed that the boards listed are labeled 'MB997A' (top right of the picture), where mine is 'MB997D'.many thanks for your support,Cheers.PS : I read through similar questions, but nothing gave me the solution to add this specific board to the list.#stm32cubemx* #stm32f407g-disc1
Posted on November 02, 2017 at 18:18I am using NUCLEO-F767ZI board where I observe that when I use the internal clock (HSI), the mcu runs fine, but when I configure the cubeMX project to run on external 8MHz clock (HSE), the mcu fails to run. Following is the code generated by CubeMX when HSE is selected:/** System Clock Configuration*/void SystemClock_Config(void){RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;/**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE();__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);/**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 4; RCC_OscInitStruct.PLL.PLLN = 96; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
Posted on November 02, 2017 at 17:16Hi everyone,I have been just getting started with the model-based design using MATLAB/Simulink with the Target Support Package for my STM32F407VGTx Discovery Board.But with the configuration for the MCU using STM32CubeMX done, there is no input port in the ADC_Read block availible.In my STM32CubeMX Project (in the attachment, Version 4.22.1) I actived three channels of ADC1 (IN0, IN1 and IN2). Principally, these three channels must be availible in my Simulink project. However, as shown below, CH0, CH1 and CH2 couldn't be checked.Is there anyone who can help me to solve this problem?Thank you!#adc #cubemx #simulink #stm32-mat/target-matlab
Posted on January 23, 2017 at 10:02The latest Version of CubeMx (4.19.0) the 'FLASH_WaitForLastOperation' function causes errors if the HAL_GetTick() function is near its rollover point. The cause seems to be 'uint32_t timeout = HAL_GetTick() + Timeout', which causes an error of the comparison 'HAL_GetTick() >= timeout'. With a 1ms resolution the error happens after 49 days, which could cause a serious problem in real systems. It would be nice, if this could be corrected.best regardsThomas#cubemx
Posted on October 26, 2017 at 10:35Today I have just updated my STM32CubeMX to the 4.23 version.I migrated the project I am using currently. It uses a STM32F767VITx. So far, I was using the 4.21.1 version of STM32CubeMX.Today I made some changes in my STM32CubeMX project in order to change some settings. But when I was about to commit this changes to GIT, I noticed the file ''rtc.c'' (generated automatically by STM32CubeMX and never edited manually) had changed. So, I opened this file in order to see what it changed.In the image below, you can see the problem: STM32CubeMX now generates the variables ''sTime'' and ''sDate'' as global variables, but never initializes them. So all the settings you configure in the STM32CubeMX are never used. I looked for this variables over all my project and I didn't find any call or use, so these two variables are never initialized to any value.This error (I guess it is an error) have appeared in this new release.Even I started I new project from scrat
Posted on July 21, 2017 at 11:02I am trying to create a project for either the L469 Discovery or Nucleo-144 board using CubeMX.My setup is the following:CubeMX 4.22.0L4 Firmware v1.8.1Using STM32 AC6 latest versionIt appears as though CubeMX does not populate the FreeRTOS related directories with the required source files.Doing the same thing for an F4 board I have no problem, so I'm assuming it is an issue specific to either cubeMX or the latest version of the L4 firmware.Does anybody else have this issue?Anthony. #cubemx-project #stm32l4 #bug #cubemx #freertos
Posted on October 25, 2017 at 18:38I'm using an STM32F746VGT6 microcontroller configured from STM32CubeMX for all the clocks and I'm getting roughly 220% higher clock rates reported for SystemCoreClock when compiled. For instance I have an HSE crystal at 11.2896MHz with the following main PLL settings:PLLM /11PLLN *234PLLP /2PLLQ /5I have selected HSE for PLL source and PLLCLK as System Clock Source. Doing that in STM32CubeMX yields 120.080291MHz.However, after SystemClock_Config(), SystemCoreClock = 265909059.Due to that discrepancy, the microcontroller thinks it's working 220% faster than it actually is so all my timings are off by that much.My first clue was when I configured SAI_BlockA1 and measured MCLK to be double than expected. Then testing an output with HAL_Delay(50) gave me actual delay of 110ms.Has anyone else seen this issue and what could be the problem here? Thanks for any insight.#stm32f746 #stm32cubemx
Posted on June 27, 2017 at 16:27Hello ST team,I think the STM32CubeMX code generator has a big problem with screen resolution. I'm using a laptop with 4K display, so my CubeMX appears like following screenshots, which are annoying in many cases: Almost half of most table rows appear vertically, the texts sometimes are too small or too large and so on:Can this problem fix?Bests,Misagh#cube-mx #stm32cubemx
Posted on October 17, 2017 at 07:54Hello GeeksI'm new bie with at STM, I need to read at-least 3 adc channel of STM32L152RC having interruptI've used Cubemx and generate the code having property ofscan->EnableNo of Conversion->3Global interrupt ->EnableRank from 1-3->48 cycle Sampling rateNow the problem is when i compile and load the code on MCU then it's working and shows 4095 Samples for 3.3V attached at IN0 but this result is same for all first 3 channel! it means all remaining 2 configured channel shows 4095 samples even they are floating!here is the debug logsADC_raw[0]--->4095 ADC_raw[1]--->4095 ADC_raw[2]--->4095 -----------------------------------------------ADC_raw[0]--->4095 ADC_raw[1]--->4095 ADC_raw[2]--->4095 -----------------------------------------------ADC_raw[0]--->4095 ADC_raw[1]--->4095 ADC_raw[2]--->4095 -----------------------------------------------ADC_raw[0]--->4095 ADC_raw[1]--->4095 ADC_raw[2]--->4095 -----
Posted on October 24, 2017 at 06:21When I meet a bad block in a NAND flash,it will stop here forever.The 'tickstart = HAL_GetTick()' should put in front of 'while(HAL_NAND_Read_Status(hnand) != NAND_READY)'.#nand-flash-driver #stm32cubemx #bug
Posted on October 17, 2017 at 12:49Hi All,in order to build new project (using STM32l073v8t processor) folder, I used the STM32cubeMX.I've set all IOs, change the clock tree using its UI and etc' according to my project.When I check the generated code source folder I see that all files are updated while the system_stm32l07xx.c is old and doesn't modify also I change the clock tree parameters.Also, i can't find clock generator tool for this processor family.Please advise how should I modify the clock file.Thanks in advance,Moran.#stm32l073v8t #cubemx
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.