cancel
Showing results for 
Search instead for 
Did you mean: 

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

stst9180
Associate III

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

0 REPLIES 0