cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX 4.12 with STM32L4 1.2.0 generated infinite loop with HAL_Delay()

seth
Associate II
Posted on January 28, 2016 at 21:36

I generated a project for the STM32L476 Discovery board using CubeMX 4.12.0 and Firmware Package for STM32L4 release 1.2.0 that would never break out of HAL_Delay().

I selected FreeRTOS and USB Device CDC middleware and setup other pins and peripherals as per normal.  In the generated stm32l4xx_it.c file the following SysTick_Handler() was created.

void SysTick_Handler(void)

{

  /* USER CODE BEGIN SysTick_IRQn 0 */

  /* USER CODE END SysTick_IRQn 0 */

  osSystickHandler();

  /* USER CODE BEGIN SysTick_IRQn 1 */

  /* USER CODE END SysTick_IRQn 1 */

}

Note the lack of a call to HAL_IncTick();  By leaving out that call every instance of HAL_Delay became an infinite loop.  There happens to be a call to HAL_Delay in the usb init code so...

Easy find and fix, but seemed like something that should have been in the generated source output by CubeMX.  Maybe there is the expectation of the developer adding it in somewhere else?  All the included examples show it in the handler called before the osSysTickHandler().

Love the tools, keep up the good work.

1 REPLY 1
Nesrine M_O
Lead II
Posted on January 29, 2016 at 08:10

Hi dziengeleski.seth,

The issue is already reported.

You find the official response from our MX team in this [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/CubeMX%204.12.0%20Bug%20Report&FolderCTID&currentviews=68]post

-Syrine-