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.
