cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in CubeMX code generation for TIMx encoder mode with remap

MScho.1
Associate III

Hi,

I'd like to report a bug in code generation of CubeMX when using encoder mode with remapping of CH1 and CH2 and LL drivers. I use STM32CubeIDE v1.4.1 and STM32G474.

The problem is that the commands to configure the remapping of TI1 and TI2 are split into two calls to "LL_TIM_SetRemap" (example for TIM3):

...
LL_TIM_SetRemap(TIM3, LL_TIM_TIM3_TI1_RMP_COMP2);
LL_TIM_SetRemap(TIM3, LL_TIM_TIM3_TI2_RMP_COMP3);
...

The second call to "LL_TIM_SetRemap" erases the setting in the first command (since it uses "MODIFY_REG" under the hood, clearing all remap bits by default).

The correct code would be combining the settings in a single command like so:

...
LL_TIM_SetRemap(TIM3, LL_TIM_TIM3_TI1_RMP_COMP2 | LL_TIM_TIM3_TI2_RMP_COMP3);
...

A screenshot of CubeMX configuration example is attached.

5 REPLIES 5
Amel NASRI
ST Employee

Hi @MScho.1​ ,

It would be more helpful if you can share your .ioc file.

Are you using STM32CubeMX 6.0.1?

Thanks,

Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Sometimes you folks are really lazy ;) Just set the settings in the screenshot and you're done. For your convenience I attached an .ioc .

My CubeMX version is 6.0.0.202007160824

Regards,

Matthias

Thanks @MScho.1​ ,

Not a matter of being lazy :), but I didn't got same view as yours:

0693W000003RJOIQA4.png

First what I will do is to align to latest CubeMX version (6.0.1).

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Just migrated to CubeMX 6.0.1, problem is still present.

Hi @MScho.1​ ,

Using STM32CubeMX 6.0.1, I was able to reproduce the issue and confirm it for both LL and HAL generated code.

This is reported to our development team who will take care to integrate relevant fixes.

Thanks for bringing this to our attention.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.