cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX 5.0.1 STM32L433RB Low Layer code generation bug for Timers

kurta999
Senior

Generated code is the following:

void MX_TIM6_Init(void)

{

 LL_TIM_InitTypeDef TIM_InitStruct = {0};

 /* Peripheral clock enable */

 LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM6);

 /* TIM6 interrupt Init */

 NVIC_SetPriority(TIM6_DAC_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));

 NVIC_EnableIRQ(TIM6_DAC_IRQn);

 TIM_InitStruct.Prescaler = 48000;

 TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;

 TIM_InitStruct.Autoreload = LL_TIM_IC_FILTER_F IVLL_TIM_IC_FILTER_FDIV1_N26_N5-LL_TIM_IC_FILTER_FDIV1_N2;

 LL_TIM_Init(TIM6, &TIM_InitStruct);

 LL_TIM_DisableARRPreload(TIM6);

 LL_TIM_SetTriggerOutput(TIM6, LL_TIM_TRGO_RESET);

 LL_TIM_DisableMasterSlaveMode(TIM6);

}

and the error is here:

TIM_InitStruct.Autoreload = LL_TIM_IC_FILTER_FDIVLL_TIM_IC_FILTER_FDIV1_N26_N5-LL_TIM_IC_FILTER_FDIV1_N2;

..\Core\Src\tim.c:135:31: error: 'LL_TIM_IC_FILTER_FDIVLL_TIM_IC_FILTER_FDIV1_N26_N5' undeclared (first use in this function)

  TIM_InitStruct.Autoreload = LL_TIM_IC_FILTER_FDIVLL_TIM_IC_FILTER_FDIV1_N26_N5-LL_TIM_IC_FILTER_FDIV1_N2;

4 REPLIES 4
Imen.D
ST Employee

Hello @kurta999​ ,

Thanks for highlighting this issue, I raised it internally to our CubeMX team for fix.

Kind Regards,

Imen

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

Hello @kurta999​ ,

Thanks for your feedback.

The value of counter period is 10-1 and this is incorrect value.

Period must have numeric value between 0 and 65 535.   

Feel free to contact me for further details.

Regards,

Houda

kurta999
Senior

Ahh.. Tomorrow I''ll try it with 9. But with HAL it worked correctly, then CubeMX should not allow entering complete expressions to period when using LL or create another workaround.

kurta999
Senior

I've tried it with 9, it's still bugged.