Skip to main content
stst9180
Associate III
November 4, 2022
Question

Bug Report - Stm32CubeMx 6.6.1 - HAL Timebase Generation not correct in any case.

  • November 4, 2022
  • 0 replies
  • 743 views

The HAL Timebase Generation using another Timer as SYSTICK is buggy when clocks APBxCLKDivider is switched in runtime. The Timebase is then re-initialized without respect to an (re-) configured APBxClockDivider. The condition if a APBxCLKDivier is set is only evaluated at CubeMx-Code-Generation-Time. Instead of fixing this issue during code generation time (which then does not allow switching APBxClockDivider in runtime) this should be done by those Code-Lines during runtime as the clkconfig struct is already available in the code.:

 /* Compute TIMx clock */

 if(clkconfig.APBxCLKDivider) {

    uwTimclock = 2*HAL_RCC_GetPCLKxFreq();

 } else {

    uwTimclock = HAL_RCC_GetPCLKxFreq();

 }

This would work in any case without having a conditional code-generation dependent on the APBxCLKDivider.

Regards Pascal

This topic has been closed for replies.