cancel
Showing results for 
Search instead for 
Did you mean: 

Again: Timer initialization bug with pointless constant LL_TIM_IC_FILTER_FDIV1_N2

etik
Associate

As alread reported a while ago, strange things happen when entering an expression in CubeMX for Prescaler and/or Autoreload. If, for example, 72-1 is entered for Prescaler and 6667-1 for Autoreload, the following code will be generated:

STM32CubeMX: TIM Prescaler, Period bug  

 

TIM_InitStruct.Prescaler = 72-LL_TIM_IC_FILTER_FDIV1_N2;
...
TIM_InitStruct.Autoreload = 6667-LL_TIM_IC_FILTER_FDIV1_N2;

 

LL_TIM_IC_FILTER_FDIV1_N2 does not make any sense here.

Depending on the exact values, the Timer will be initialized with some different settings than desired.

With simple constants (without calculations) the generated code will be correct.

In contrast to the previous post, in my case the MCU was a STM32F303.

CubeMX is Version: 6.15.0-RC7, Build: 20250701-1659 (UTC)

1 REPLY 1
Imen.D
ST Employee

Hello @etik 

This is a known issue, and our team are working to resolve this in the coming releases of STM32CubeMX.

Thank you for your understanding while we work on this for you.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen