cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4R5 PWM : Bare metal code| I am writing some basic PWM drivers using the TIM16 and TIM17. While initializing the TIMer register I came to a register TIMx_CCER. Can someone help me withOutput control bits for complementary OCx and OCxN channels.

POval.1
Associate II
 
2 REPLIES 2
TDK
Guru

The reference manual goes into detail on this.

For PWM output, you should set CCxE=1, and/or CCxNE=1 for complementary channel. The CCxP and CCxNP control the polarity of these channels, respectively. Note that on advanced timers (e.g. TIM1, TIM8), you also need to set MOE=1 in the TIMx->BDTR register.

If you feel a post has answered your question, please click "Accept as Solution".
POval.1
Associate II

Thank you.! I am just using the CCxE. So setting that Bit. & Reset the CCxNE pin.

Though I have also TIM_BDTR_MOE bit in the BDTR for timer 16/17 as well.