Skip to main content
Associate
November 30, 2025
Question

Again: Timer initialization bug with pointless constant LL_TIM_IC_FILTER_FDIV1_N2

  • November 30, 2025
  • 1 reply
  • 129 views

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

ST Technical Moderator
December 1, 2025

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks