STMicroelectronics / STM32CubeU5

Full Firmware Package for the STM32U5 series: HAL+LL drivers, CMSIS, BSP, MW, plus a set of Projects (examples and demos) running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits).
Other
116 stars 61 forks source link

stm32u5xx_hal_timebase_tim_template.c: HAL_InitTick() initialization sequence error #6

Closed a-wilhelm closed 1 year ago

a-wilhelm commented 2 years ago

In HAL_InitTick() https://github.com/STMicroelectronics/STM32CubeU5/blob/0eedae3d2a7997a2b5fbfdb57f54c7201e0827c8/Drivers/STM32U5xx_HAL_Driver/Src/stm32u5xx_hal_timebase_tim_template.c#L114-L140

the initialization sequence is incorrect:

Suggested sequence:

  Status = HAL_TIM_Base_Init(&TimHandle);
  if (Status == HAL_OK)
  {
#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1U)
    HAL_TIM_RegisterCallback(&TimHandle, HAL_TIM_PERIOD_ELAPSED_CB_ID, TimeBase_TIM_PeriodElapsedCallback);
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */

    /* Start the TIM time Base generation in interrupt mode */
    Status = HAL_TIM_Base_Start_IT(&TimHandle);
    if (Status == HAL_OK)
    {
      if (TickPriority < (1UL << __NVIC_PRIO_BITS))
      {
        /* Enable the TIM6 global Interrupt */
        HAL_NVIC_SetPriority(TIM6_IRQn, TickPriority, 0);
        HAL_NVIC_EnableIRQ(TIM6_IRQn);
        uwTickPrio = TickPriority;
      }
      else
      {
        Status = HAL_ERROR;
      }
    }
  }

  /* Return function Status */
  return Status;
ASELSTM commented 2 years ago

ST Internal Reference: 122898

ASELSTM commented 1 year ago

Hi @a-wilhelm,

Thank you for your contribution. This issue has been fixed in the frame of version v1.2.0 of the STM32CubeU5. Please allow me then to close this thread.

With regards,