Skip to main content
MScho.1
Associate III
September 10, 2020
Question

Bug in CubeMX code generation for TIMx encoder mode with remap

  • September 10, 2020
  • 5 replies
  • 2122 views

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.

This topic has been closed for replies.

5 replies

Amel NASRI
ST Technical Moderator
September 10, 2020

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 "Best Answer" on the reply which solved your issue or answered your question.
MScho.1
MScho.1Author
Associate III
September 10, 2020

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

Amel NASRI
ST Technical Moderator
September 10, 2020

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 "Best Answer" on the reply which solved your issue or answered your question.