AnsweredAssumed Answered

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

Question asked by dziengeleski.seth on Jan 28, 2016
Latest reply on Jan 29, 2016 by Nesrine M
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 */
  /* 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.