2020-07-31 03:32 PM
STM32Cube\Repository\STM32Cube_FW_G4_V1.2.0\Projects\NUCLEO-G431RB\Examples_LL\TIM\TIM_PWMOutput
This project runs fine. However, it uses TIM2. I tried to port to TIM1 so I could be interrupted every 10 periods, rather than have to count them in an isr. I did allthe obvious things. Any tricks? My project outputs nothing. I relocated to PA1 from PA5, and made the required changes. No go. What additional init is required for TIM1 that is missing from TIM2?
Solved! Go to Solution.
2020-07-31 05:57 PM
SET_BIT(TIM1->BDTR, TIM_BDTR_MOE);
2020-07-31 03:56 PM
> What additional init is required for TIM1 that is missing from TIM2?
For TIM1, the TIMx_BDTR_MOE bit needs set to have a PWM output. Only advanced timers (TIM1/TIM8/TIM20) have this bit.
2020-07-31 04:05 PM
+1
And TIM2 being 32-bit vs TIM1 16-bit on many STM32
2020-07-31 04:07 PM
If you need to see my version of attempting to port to TIM1, let me know please.
2020-07-31 04:44 PM
> If you need to see my version of attempting to port to TIM1, let me know please.
Well the MOE bit is the only gotcha. So if it's not that, you have something basic wrong.
2020-07-31 04:53 PM
Thanks guys. As a long time fan of the Three Stooges (Larry, Curly, and Moe), I should of known!
Once I validate that this is the only Gotcha, I'll update.
These short acronyms get me everytime.
2020-07-31 05:41 PM
I must be using the wrong include files. Same ones as for TIM2 probably don't work for TIM1? No signs of MOE or TIMx_BDTR
2020-07-31 05:57 PM
SET_BIT(TIM1->BDTR, TIM_BDTR_MOE);
2020-07-31 06:00 PM
Definitely defined in the CMSIS include file: