Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Posted on January 23, 2017 at 03:31I just created a project for the stm32f0-discovery board including FreeRTOS and building with OpenSTM32/eclipse. The path to cmsis_os.h was missing and easily fixed by adding 'Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS' to the include paths. I have attached the .IOC file for your viewing pleasure. (Apologies for misnaming it - it should have been myMX19proj but it seems that once saved, it cannot be changed.)Thank you for your continuing support of Cube on Linux.best,hank#stm32cubemx #freertos
Posted on January 19, 2017 at 21:19I'm compiling and running GPIO_EXTI example code for Nucleo-F767ZI board (on SW4STM32). The handler that blinks LED1 isn't connected and this matches what readme.txt says:In this example: - EXTI_Line15_10 is connected to PC.13 pin - when falling edge is detected on EXTI_Line15_10 by pressing User push-button, LED1 toggles onceOn STM32F767ZI-Nucleo: - EXTI_Line15_10 is connected to User push-buttonSo, handler isn't set for the Nucleo board. When I push user button and pause (debugging) the program, it is then in default handler / infinite loop. All correct.However, the program never goes beyond those lines of EXTI15_10_IRQHandler_Config(void): /* Enable and set EXTI line 15_10 Interrupt to the lowest priority */ HAL_NVIC_SetPriority(EXTI15_10_IRQn, 2, 0); HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);When I pause, I'm still in HAL_NVIC_EnableIRQ(), the program never returns to ma
Posted on January 19, 2017 at 14:36CubeMX provides a library for using CDC but its not very clear and also i couldn't find any good descriptions of functions and what they are supposed to do so can anyone point me to a good tutorial i'll be glad#usb_cdc #cube-mx #stm32 #stm32f4-discovery #keil-uvision
Posted on October 30, 2016 at 18:46 I use STM32CubeMX v 4.0 to configure CMSIS SPI Driver. I believe I do right DMA configuration: But after code generation file MX_Device.h hasn't defines to enable DMA for SPI. /* DMA Configuration */ /* DMA SPI2_TX */ /* DMA SPI2_RX */ So, I have to modify it to enable DMA: /* DMA Configuration */ /* DMA SPI2_TX */ #define MX_SPI2_TX_DMA_Instance DMA1_Stream4 /* DMA SPI2_RX */ #define MX_SPI2_RX_DMA_Instance DMA1_Stream3 #stm32cubemx #dma #bug
Posted on January 19, 2017 at 01:39I have setup the STM32CubeMX project.. (STM32F302RExx)I use the ADC in continues / scan mode.I have DMAContReq = true..I then setup DMA on ADC1-CH1 with HIGH prio..but when i generate my Cube-code... i don't see ANY code for the DMA setup ??The ADC's works fine if i poll them.This : 'DMA_HandleTypeDef hdma_adc1;' I see..but thats IT .. no more references.. i have all in my MainFile..Any clues ?/M.H.p.s..I'm guessing i am missing something like THIS (THIS IS NOT TO FIND IN CUBE-GENERATED CODE):hdma_adc1.Instance = DMA1_Channel1; hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY; hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE; hdma_adc1.Init.MemInc = DMA_MINC_ENABLE; hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; hdma_adc1.Init.Mode = DMA_CIRCULAR; hdma_adc1.Init.Priority = DMA_PRIORITY_HIGH; if (HAL_DMA_Init(&hdma_adc1) != HAL_OK) { Error_Handler(); }__HAL_LINKDMA(&hadc1,DMA_Handle,h
Posted on January 20, 2017 at 01:51 I want to get UART Interrupted data to vary LED blinking speed. For example,If I send 1 then speed 100ms or send 2 then speed 200ms. I made a cod using CubeMX and Interrupting with just pressing ''Enter'' works perfect(Not sending any data) (I pressed ''Enter'' 3 times in Line Sender) but If I send some character like below, It iterrupts just one time and never interrupt again with my further interrupt action. Here is my Code. First of al,l I am getting Terminal ''printf''output into Serial usingcode below in function ''HAL_UART_MspDeInit''in usart.c. /* USER CODE BEGIN 1 */ #ifdef __GNUC__ /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf set to 'Yes') calls __io_putchar() */ #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) #else #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) #endif /* __GNUC__ */ /** * @brief Retargets the C library printf function to the USART. * @param
Posted on July 20, 2016 at 09:43Hi, in the last time I played with the power modes of the STM32L0 and discovered an issue with the GPIO-HAL driver. The used version of the HAL is 1.7.0 with a STM32L053 nucleo board. I discovered that the initialization of USART-TX and -RX pins will increase the power consumption in STOP mode considerably. So I tried to deinitialize the pins to their reset state with the function HAL_GPIO_DeInit() before going into STOP mode. But the consumption remains the same so I looked into the DeInit-function and recognized the line where the I/O mode is changed (line 327 in stm32l0xx_hal_gpio.c):GPIOx->MODER &= ~(GPIO_MODER_MODE0 << (position * 2U)); The I/O mode is changed to ''input'' but the reference manual for the controller (RM0367) says in chapter 9.4.1 that the reset state for the I/O mode is ''Analog'' . According to this I changed the line 327 toGPIOx->MODER |= (GPIO_MODER_MODE0 << (position * 2U)); and the power consumption get
Posted on January 13, 2017 at 14:51 edit: previously I wrote that problems occurs with freertos, I checked without it and I am having the same problem (ending in dead loop after sending more than 8 characters). Steps to reproduce: Create project in CubeMX for STM32F4DISCOVERY, enable USB_FS Device only. Configure clock: PLL_N = 72, PLL_Q=3, that gives me 48 MHz for usb, other settings remain unchanged. In configuration I enable CDC device with default parameters. Generate code for SW. I add some led toggle in order to know it it is running. /* StartDefaultTask function */ void StartDefaultTask(void const * argument) { /* init code for USB_DEVICE */ MX_USB_DEVICE_Init(); /* USER CODE BEGIN 5 */ /* Infinite loop */ for(;;) { HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin); osDelay(500); } /* USER CODE END 5 */ }�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�? In file usbd_cdc_if.c I am setting breakpoint at CDC_Receive_FS funct
Posted on December 21, 2016 at 14:31Good morning,In my project I use STM32F303RC and I have two ADCs working with DMAs and triggered by a timer. ADC1 has two analog channels to be sampled, ADC4 only one. While I was working with CubeMX 4.17 I had no problems.Then I updated CubeMX to 4.18. I did not change my program at all, but ADC1 stopped working correctly.For some reason in the ADC1 configuration CubeMX added this part:/**Configure the ADC multi-mode */ multimode.DMAAccessMode = ADC_DMAACCESSMODE_DISABLED; multimode.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_1CYCLE; if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK) { Error_Handler(); }This caused the ADC1 to work correctly only in DEBUG mode but not in RUN mode. It took me a bit to find out that this was the cause. When I remove this initialization everything works fine again.Now, my question is very easy: Is this Multi-mode correct, and I am doing something wrong not considering it, or it is inserted when i
Posted on January 12, 2017 at 10:59Hi !First, I use the version 4.18.0 STM32Cube V1.0, and Atollic True Studio 7.0.1, so both are (normally) the last ones.I try to generate, with CubeMX, a project on STM32F417VG, using several libraries, the STM32_USB_HOST_LIBRARY for MSC being one of them. My problem is that I cannot use this project !I generate the project -> I compile -> Works !I generate the project -> I add these lines in the main.h :&sharpinclude ''usbh_def.h''USBH_HandleTypeDef hUSBHost;I doesn't change anything else, and I don't write anything else but it doesn't compile, I have some strange errors. Four of them are about four different macros (USBH_MAX_DATA_BUFFER, USBH_MAX_NUM_ENDPOINTS, USBH_MAX_NUM_INTERFACES, USBH_MAX_NUM_SUPPORTED_CLASS) in the file ''usbh_def.h'' with this message :Macro undeclared here (not in a function)But those macros are declared in usbh_conf.h which is directly included in usbh_def.h.Another error is :USBH_DeviceTypeDef has no member
Posted on October 23, 2015 at 16:47There seems to be a bug in the new 4.11 release of STM32CubeMX. Previously in 4.10, regenerating an EWARM project with CubeMX kept the files manually added to the project. Now in 4.11, regenerating an EWARM project resets the project entirely. Is this a bug, a removed feature, or am I missing a setting somewhere in 4.11? I even reinstalled 4.10 to check that it keeps user files. Unfortunately 4.10 won't open files modified in 4.11 #bug-stm32cubemx
Posted on October 17, 2016 at 21:38 Hi ! I'm using freeRTOS with STM32CubeMX. While playing with signals for inter-thread communication I came across the different return value of function osSignalSet() The CMSIS standard states: int32_t osSignalSet(osThreadId thread_id, int32_t signals) Parameters [in] thread_id thread ID obtained by osThreadCreate or osThreadGetId. [in] signals specifies the signal flags of the thread that should be set. Returns previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters. But STM32CubeMX creates: /** * @brief Set the specified Signal Flags of an active thread. * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. * @param signals specifies the signal flags of the thread that should be set. * @retval osOK if successful, osErrorOS if failed . * @note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS. */ int32_t osSignalSet (osThrea
Posted on July 26, 2016 at 20:38Hi, I tried to install CubeMX 4.16.0 on Linux Mint 18.0 running OpenJDK 9 but I get the attached error log. Any suggestions what am I doing wrong? Regards, Markus #linux #cubemx
Posted on August 02, 2016 at 18:01Hi,If in NVIC Configuration -> Code Generation, none of the IRQ handlers are selected, the generated stm32f4xx_it.c file is not generated, but reads a java backtrace:/* Includes ------------------------------------------------------------------*/&sharpinclude ''stm32f4xx_hal.h''&sharpinclude ''stm32f4xx.h''&sharpinclude ''stm32f4xx_it.h''Expression requireSystemClockConfig is undefined on line 51, column 8 in stm32xx_it_c.ftl.The problematic instruction:----------==> if requireSystemClockConfig [on line 51, column 3 in stm32xx_it_c.ftl]----------Java backtrace for programmers:----------freemarker.core.InvalidReferenceException: Expression requireSystemClockConfig is undefined on line 51, column 8 in stm32xx_it_c.ftl.at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)at freemarker.core.Expression.isTrue(Expression.java:145)at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)at freemarker.core.
Posted on January 04, 2017 at 07:53I'd like to migrate a project from using the internal RC on the STM32F091RC to the 8MHz HSE clock that comes down from the on-board ST-LINKV2's MCO signal. I use STM32CubeMX to generate SystemClock_Config(). On the panel to the left in the Pinout window, I expand RCC and change 'High Speed Clock (HSE)' from 'Disable' to 'BYPASS Clock Source'.When I do that, everything looks like it's good. The PF0 pin goes green, the Clock Configuration screen lights up the 8MHz Input Frequency at HSE in blue. If I generate a report, the RCC section says 'High Speed Clock (HSE): BYPASS Clock Source', but when I generate the code, I get the exact same SystemClock_Config(void) I got before the change. In fact the freshly generated main.c doesn't change at all as result of the different clock selection in the gui. Any ideas?#stm32f0 #stm32cubemx
Posted on January 03, 2017 at 15:24Under Project > Settings Advanced Settings in the Drive Selector section for IP Name I see SPI, USART, etc. Under Driver the choice is HAL and cannot be changed. How does one change that selection to another choice or none?Thanks,JH#stm32cubemx
Posted on October 05, 2016 at 17:48Hello,i am using a custom made bootloader on an stm32f107. So i need to change VECT_TAB_OFFSET in the application code to offset the vector table. But every time when i`m generating code with Cube Mx the file system_stm32f1xx.c gets overwritten. Is it possible to add a user code section to change the defiene?Thanks for your help #cube-mx-bootloader-vect_tab_offs
Posted on December 22, 2016 at 13:14 I'm trying to blink a LED on a Nucleo-L476 with CubeMX and ST's HAL. It worked perfectly on Windows (System Workbench). Now, I'm trying to do the same on Linux with CubeMX and Qt Createor (my favorite IDE) and OpenOCD. I am now able to compile and debug the target. However, the program crashes during HAL initialization. More precisely, when it tries to access the SystemCoreClock variable. The following code is called from HAL_Init(); in main() : __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) { /*Configure the SysTick to have interrupt in 1ms time basis*/ HAL_SYSTICK_Config(SystemCoreClock/1000); // *** crash here *** /*Configure the SysTick IRQ priority */ HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0); /* Return function status */ return HAL_OK; } I could replace SystemCoreClock by a constant, but the variable needs to be modified further down the line anyway. SystemCoreClock is declared in syst
Posted on December 23, 2016 at 03:36Hello everyone! I use CubeMX to generate projects for stm32f042f6 USB custom HID mode, when I configured parameters ,download to my circuit board,connect it to PC,but the USB HID Demonstrator do not display any message;Configuration is as follows:I wonder if the stm32f042 can realize this function of custom HID mode?Thank you for your answer to my question first?#cubemx-stm32f042-custom-hid
Posted on December 21, 2016 at 18:15STM32CubeMX version 4.17 in Ubuntu 16.10 generates projects, which SWSTM32 is compiling without any problems.STM32CubeMX version 4.18 in Ubuntu 16.10 generates projects, which SWSTM32 refuse to compile.The compilation of project was stoped with an error message:<p>09:25:29 **** Incremental Build of configuration Debug for project STM32VL_DDS ****make all Building file: ../Src/main.c/bin/sh: 1: Syntax error: '(' unexpectedInvoking: MCU GCC Compiler/home/wshurpa/workspace/STM32VL_DDS/Debugarm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32F100xB -I'/home/wshurpa/workspace/STM32VL_DDS/Inc' -I'/home/wshurpa/workspace/STM32VL_DDS/Drivers/STM32F1xx_HAL_Driver/Inc' -I'/home/wshurpa/workspace/STM32VL_DDS/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy' -I'/home/wshurpa/workspace/STM32VL_DDS/Drivers/CMSIS/Device/ST/STM32F1xx/Include' -I'/home/wshurpa/workspace
Posted on December 20, 2016 at 05:24I was working with STM32L476RGT6. The IDE used for programming was Keil and initialization was done by stm32cubemx. I was using stm32L4 discovery kit to externally program the MCU and STLINK was connector was removed. Everything was working fine until I had to reinstall Windows in my computer. After that, I installed Keil again, stm32cubemx again. But when I download program to flash, keil shows successful download and application running. Nothing changes in my MCU, I even tried led blinking to one of my output pins. When I debug, I found I see nothing working on the CPU. Even when I press the reset cpu, I attached the ST-Link Debugger Setting. I am clueless now. Please help? I will provide more info if you need. I resoldered the mcu with a new because I thought my first mcu might be dead.#debug #stm32l4 #stm32cubemx #stm32-keil
Posted on December 21, 2016 at 16:35When I generate a project with USB CDC Device Class and FreeRTOS, enumeration fails because the clock to the USB peripheral is not enabled before calling MX_USB_DEVICE_Init(). If I insert the code as followsvoid StartDefaultTask(void const * argument){ /* init code for LWIP */ MX_LWIP_Init(); __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); <----- INSERT THIS LINE /* init code for USB_DEVICE */ MX_USB_DEVICE_Init(); /* USER CODE BEGIN 5 */ /* Infinite loop */ for(;;) { osDelay(1); } /* USER CODE END 5 */ }in the Default Task it works like a charm. Please consider fixing that as it took me quite some time to figure out what was wrong.#stm32cube-bug #stm32-usb-cdc-cubemx #stm32f407 #freertos-stm32cube
Posted on December 11, 2016 at 22:05Hello,I wanted to use TIM10 in STM32F401RCTx as periodic interrupt source using CubeMX.I have enabled that timer, under 'Configuration' of TIM10 I have enabled 'TIM1 update interrupt and TIM10 global interrupt',generated the code and loaded it into SW4STM32.Then I enable that timer, and set breakpoint in 'void TIM1_UP_TIM10_IRQHandler(void)'.Program never stops there. I have cheked if TIM10 registers are set - they are, if counter register is counting up - it is.Then I checked if TIM10_DIER register is set properly. It is not. I have to enable it by hand ' TIM10->DIER |= TIM_DIER_CC1IE_Msk;'Only then the interrupt works and I can use callback: 'void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim)'Please, tell me if that is a bug or a feature.CubeMX is up to date. Frimware package for F4 series is 1.14.0 (latest)#interrupt #sw4stm32 #cubemx #interrupts
Posted on December 14, 2016 at 00:57I see that SystemClock_Config(void) is generated, and shows the PLL divisions but it doesn't show anything about the actual clock speeds. Ultimately I'm trying to determine the speed of my ADC sampling but I'm having to work backward as I inherited code from somebody else where all the clocks were set already.Thanks! #clocks #discovery #cubemx #stm32l476vg
Posted on December 13, 2016 at 09:44Hello,How can I set up the Input Capture peripheral to be triggered by the Comparator event?I've set COMP1[+] on PA1 and [-] from Vref. Without being sure I've configured the COMP1 trigger mode to event mode on both edges. In the comparator's HAL file the comments mention that 'Comparators output to timers is set in timers instances', but I haven't been able to find a relevant option.My goal is to measure the time between each voltage threshold edge on PA1 vs Vref.Thanks in advance for any advice!#stm32l011 #comparator #input-capture #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.