Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Posted on May 30, 2017 at 08:55Hi guys,CubeMX supports makefile generation starting from 4.21.0 version. I've tested the makefile, however, there are some issues:Major issues:- missing header files dependency (make won't update the output in case a header file is updated)Minor issues:- the arm-none-eabi-xxx path is by default /arm-none-eabi-xxx destination (instead of arm-none-eabi-xxx, so the user has to define the path while calling make)There might be other issues, however I haven't stumbled on them for now. I've opened this discussion to help update the makefile for future CubeMX release which would fit all!For those who are interested as I was already working on my own makefile, I would like to share it. It inherits some ideas from here & there and includes dependency generation (described here: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/).Makefile template description:- the makefile has to reside in the root of your project folder- c-files, h-fi
Posted on November 19, 2017 at 21:26(I'm sorry if this is the wrong place to report this)STM32CubeMX 4.23 (tested with MacOS High Sierra, Arch Linux x86_64 with x32 binary emulation) is generating spurious entries during Makefile generation (such as Src/main.c and various other files listed twice) which causes link errors such as:'.../Src/usb_device.c:63: multiple definition of `MX_USB_DEVICE_Init'build/usb_device.o:.../Src/usb_device.c:63: first defined here'The temporary fix is to remove any multiple entries from the Makefile, then all compiles and links (apparently) correctly.Apologies If there's something wrong with my setup that is causing this, granted I've seen it reported elsewhere when searching for solutions to these errors#stm32cubemx #bug #4.23
Posted on May 30, 2018 at 14:33Hello there,When configuring an ADC periph (STM32L452) the ranks are assigned incorrectly. Cube generates this:sConfig.Rank = 1;sConfig.Rank = 2;// etcInstead of this:sConfig.Rank = ADC_REGULAR_RANK_1;sConfig.Rank = ADC_REGULAR_RANK_2;// etcThus, it doesnt work.DAHMEN.IMEN‌#adc #stm32l4 #cubemx
Posted on June 01, 2018 at 05:35STM32CubeMX generate code in keil5 ,when project into debug environment ,why no periphral register window?#stm32cubeprogrammer
Posted on June 01, 2018 at 05:43what the advantage and convienient of STM32CubxMX generate Code in keil5 compare to classic library? Is there some documents for user about STM32CubxMX generate Code ? The principle of STM32CubxMX generate Code is ?#stm32cubeprogramer
Posted on May 30, 2017 at 19:08Hi,I'm currently evaluating the STM32F072 Discovery. We are tending moving from ATXMega to ARM and I have to verify if the device is fitting our needs, before investing more time in learning a new architecture.I successfully tested most of the peripherals, but I have some problems with USB / CDC. I started with the Cube examples that gave a quick start.My test consists of a PC C++ program opening the comport and transmitting a block of random size (max. 256 Bytes) to the board and it expects the block being echoed. When the content of the response matches with the data sent, it continues in a loop transmitting 100000 frames. Results are quite good and I'm getting approx. 300kByte / sec. (150 to the board and 150 back). Not too bad for a start.But, there is one restriction. I saw the test failing very fast on frames with 193 and 194 bytes (I guess it has something to do with 64 * 3). The test runs only if I exclude frames of these lengths.The problem is t
Posted on May 19, 2018 at 10:48Hi,I can not get the input compare mode working as expected. I need to use TIM2 CH1 as trigger to measure the frequency of external pulses. I have used the methode on a STM32F091 where it works fine.RCC and GPIO are initialized. And I will get a CC1IF interrupt as soon as I connect the external signal source BUT CCR1 is always 0! It seems to me the counter is not counting. My code to set up the counter:#define VEL_CLK 10000000 //System is running at 200 MHz PSC is set to 4TIM2->CCMR1 = TIM_CCMR1_CC1S_0 ; // ch 1 for input capture TIM2->SMCR = TIM_SMCR_ETP | TIM_SMCR_SMS_2 | &
Posted on May 24, 2018 at 09:10Extra line Rank 1and the code is generated the sameADC3 stopped workingHow to fix the problem?#stm32cubemx #adc3 #stm32cubemx-4.25.1
Posted on December 06, 2016 at 09:52I am trying to install CubeMX 4.18.0 on my Mac (Sierra), opening the installer appears to do nothing, if launched via spotlight i get a warning stating unable to open the programm.#cubemx #macos #sierra
Posted on June 07, 2014 at 14:35Hi,I'm using STM32CubeMX for a STM32F205 MCU.There is a problem with the use of the ADC1 configuration, regarding Injected Groups. 1/ when I choose the number of injected conversions, lots of intrusive 'ranks' display on the frame (normally, you should have the same number of visible ranks than the chosen number of conversions). I join a screenshot. Note that the generation of the code is consistent with the display - but then it generates a wrong code, that doesn't work, and that need to be manually changed. 2/ the number of injected conversions is missing at the code generation, and then the configuration of the ADC1 is wrong, the register JSQR is not filled, and it doesn't work. You must add it manually too. ''sConfigInjected.InjectedNbrOfConversion = 1...4''.Idem for ADC2.3/ the JAUTO mode is missing at the code generation, and then the configuration of the ADC1 is wrong (I don't even know why JAUTO is set without d
Posted on May 24, 2018 at 12:53Hey,I am getting started with FreeRTOS on NUCLEO-FO72RB.i set UART communication using DMA.i would like to writre tu UART from muliple taske using queue with size of 16 items;so i created 3 tasks.- one task1 to receive to read Data from Queue and send it to UART DMA; this task run each 1000ms to take data from queue- on task 'SW' that write to queue each 100ms the string 'Hey from SW Task; cnt2= %u';- one task 'ADC' that write to queue each 200ms the string 'Hey from ADC Task; cnt1=%u' ;the idea is that the 'SW' will load each time 2 data in queue and then 'ADC' load on Data.but when i run the code, � got this in virtual terminal:Hey from SW Task; cnt2= 1Hey from ADC Task; cnt1= 6Hey from SW Task; cnt2= 12Hey from ADC Task; cnt1= 8Hey from SW Task; cnt2= 12Hey from SW Task; cnt2= 12Hey from ADC Task; cnt1= 11Hey from SW Task; cnt2= 12Hey from SW Task; cnt2= 12Hey from ADC Task; cnt1= 14Hey from SW Task; cnt2= 12Hey from SW Task; cnt2= 12Hey from ADC Task
Posted on May 25, 2018 at 04:37I have discovered that renaming stm32f4xx_it.c to stm32f4xx_it.cpp in sw4stm32 causes interrupts to no longer work even after converting the project to C++.I have attached a minimum project for sw4stm32 that demonstrates the problem Don't let the size fool you, there are around 5 lines of user generated code in there.To build in C++, you need to exclude the .c version of the file (such as main.c) and rename it to have a .cpp extension in order to get everything to co-operate. I did this procedure with the stm32f4xx_it file, but no luck.From my rudimentary understanding of how this programming stuff works, I believe that this is a problem with the linker. I'm just not sure how. The directories that these files are in are included by default, so they should build just fine as far as I understand.#interrupts #c++ #sw4stm32 #cubemx
Posted on May 22, 2018 at 13:30Hello,Weird problem here.Every interrupt we get from the LPUART1 interrupts only once. I am sure we are clearing the flag for the interrupt. I can check it with the debugger and see its cleared.When the exact same interrupt condition happens for the second time, this time the code does not branch to interrupt in stm32l4xx_it.c. I can see that the corresponding flag goes high, the interrupt enable is still set but nothing happens.We are using IAR for compilation and debug.Does anyone have any idea what might be causing this behavior?Regards,Mete
Posted on May 22, 2018 at 21:29Hi,Is there a way to generate a condition inside the initialization code generated by CubeMx in TrueSTUDIO?I want to do something like this inside the MX_SPI2_Init() : if (HAL_GPIO_ReadPin(GPIOI, GPIO_PIN_11) == GPIO_PIN_SET) { hSPI2.Init.Mode = SPI_MODE_SLAVE; } else { hSPI2.Init.Mode = SPI_MODE_MASTER; }Currently, I can only have one or the other.Is it possible to do it with CubeMx or I should override the generated initialization code by hand?Thank you.#if-else #condition #init #cubemx
Posted on April 07, 2017 at 16:53Hi all!I want to you use all of the ADC of the STM32F407VG in triple regular simultaneous mode and to save a buffer of samples in RAM with DMA.I configure everything with CubeMX and when I debug it, I cannot access memory positions after the buffering. Getting inside the drivers, I found that the DMA channel of the ADC is configured as this:hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;Searching in the reference manual, I learned that the Common data register in triple mode has 32 bits, so the data is saved on the LSB of the register, but the memory transfer must be done with 32 bits. Reconfiguring the buffer to be 32 bit long and DMA: hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;It works ok!My question is, is this a bug of CubeMX for not notificate that half word DMA is not possible?Thanks to all!#adc #multi
Posted on April 12, 2018 at 12:55I am using a http://www.st.com/en/evaluation-tools/b-l475e-iot01a.html with STM32L475VGTx. When I generate the source code with STM32CUBEMX 4.25.0 and STM32Cube FW_L4 V1.11.0, i noticed that inside SystemClock_Config() in main.c, the following line of code is not used: RCC_OscInitStruct.PLL.PLLM = 1;So, my USB peripheral doesn't work because USB must be configured to 48Mhz. But if this line of code is not called, the USB frequency is wrongly-configured. But when I add manually this line (and the correct value), USB peripheral works perfectly.This bug appears in new STM32Cube projects as well as migrated ones.I have checked other projects made using STM32CUBEMX 4.24.0 and that line of code is not missing.#cpu-clock-frequency #stm32cube #stm32cubemx-4.25.0 #bug-report
Posted on January 25, 2018 at 12:27CubeMX 4.24.0 generated code does not seem to compile in EWARM 7.60.1.I am trying to create code to set up a STM32F071C8Tx.I get lots of errors relating to __DSB, __WFI, __WFE and __SEV saying cannot call intrinsic function from thumb mode in this architecture.Can you help me get this working?#cubemx #ewarm #cubemx-stm32f071c9tx
Posted on February 19, 2018 at 18:15Generating a project from CubeMX with TrueStudio selected in Project Settings, the generated project fails to compile. The links to HAL drivers aren't there and the same is true for any third party drivers like lwip/freeRTOS. To reproduce:1. Generate project for TrueStudio.2. Import project into workspace.3. Compile.Versions:STM32CubeMX v4.24.0Atollic TrueStudio 9.0#atollic #truestudio #code-generation #stm32cubemx #generator #bug
Posted on February 22, 2017 at 09:18Hey all,I want to write to SD card, I'm Using cube-mxstm32Nucleo-L476RG MCU ,and 4-pin SD card,I attach my cube project, the main program has the following code:declaring and init :FATFS SDFatFs; FIL MyFile; extern char SD_Path[4]; /* SD logical drive path */ /* USER CODE END 0 */ int main(void) { /* USER CODE BEGIN 1 */ FRESULT res; uint32_t byteswriten,byteread; uint8_t wtext[]='Hello from STM32!!\0'; /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*//* 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_DMA_Init(); MX_DFSDM1_Init(); MX_SDMMC1_SD_Init(); MX_FATFS_Init(); MX_TIM6_Init(); MX_SDMMC1_SD_Init();I am trying to write to sd card by the following code:if(res=f_mount(&SDFatFs,(TCHAR const*)SD_Path,0)!=FR_OK) { Error_Handler(); } els
Posted on May 16, 2018 at 16:13Hi CUBEMX Team,for NucleoL4R5ZI LPUART1 is taking as GPIOC port. It has to be GPIOG port. Please fix this ThanksPhanirajkiran#cubemx #bug
Posted on April 20, 2018 at 01:56Like a lot of modern desktop computers I have a small, fast system disk and a huge data disk. This means that I really don't need gigs of Repository on my system disk, I want to choose where it goes.In CubeMX 4.25.0, the Help->Update Settings->Repository Folder is greyed out.Can this facility please be enabled so I don't have to keep manually moving downloaded HAL libraries and having to change the Repository path for every new project?#cubemx-v4.25.0
Posted on May 10, 2018 at 16:32Hi.I'm trying to upgrade an existing PCB (so changing the MCU is not an option for now).The MCU used so far is the STM32f070F6. The MCU has USB peripheral and I want to use this as VCOM.When I generate the code with CubeMX and try to compile (with absolutely no code change), I get the message that the MCU do not have enough RAM: '/arm-none-eabi/bin/ld.exe: region` RAM 'overflowed by 1760 bytes'.I have already changed the CDC buffers to a size of 40 bytes (maximum of what I want to transfer), but I still have a similar error.Is there an example with this MCU in which the USB peripheral is used?Thank you.#cubemx #usbvcom #stm32f070f6 #stm32f070
Posted on May 16, 2018 at 18:21I'm starting to use Atollic TrueStudio for STM32 along with CUBE MX, I'm using the STM32F407ZGT microcontroller. Even without adding code to the program already at the beginning an error is occurring. can you help me?#cubemx #atollic-truestudio #stm32f4
Posted on April 30, 2018 at 14:43 Simple demo application on the Nucleo-L476RG generated in CubeMX with HAL version 1. Nothing but USB Host and a few GPIOs for LEDs enabled. When it comes to the `SystemClock_Config()` it freezes when enabling the clock source for the USB. if(PeriphClkInit->UsbClockSelection == RCC_USBCLKSOURCE_PLLSAI1) { /* PLLSAI1 input clock, parameters M, N & Q configuration and clock output (PLLSAI1ClockOut) */ ret = RCCEx_PLLSAI1_Config(&(PeriphClkInit->PLLSAI1), DIVIDER_Q_UPDATE); if(ret != HAL_OK)�?�?�?�?�?�? `ret` is always `HAL_ERROR` which causes an infinite loop at: if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }�?�?�?�? Just wondering if I have a hardware issue or something I missed in clock initialization. #clock #usb #bug #cubemx
Posted on May 09, 2018 at 04:18I created a very basic LED toggle project for my nucleo-103rb board using CubeMX that targeted Makefile. I opened the software, selected the chip, set PA5 as GPIO Output and clicked generate code. I did not change any options. [well I did choose to only inlcude used libraries]. After generating the code, I edited the makefile to remove the well known, duplicate source files. I also added the path to my tool chain (gcc-arm-none-eabi-7-2017-q4-major from GNU Arm Embedded). I added 3 lines in the while(1) loop:int i; for (i = 1; i <= 262143; i++){}; HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);Overall, these are very minimal changes to the project generated from CubeMX. I connected to my nucleo-103rb board with openocd/gdb and loaded the elf file. The led indeed starts blinking, but then my debug session goes dead! Disconnecting the power and reconnecting to my PC does not restore my ability to connect to the debugger. To return debugger access, I have to load
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.