cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L433RB: COMP2_OUT has no impact on TIM1 PWM output

Kunliang_YAO
Associate

Hello,

I'm working with STM32L433RB.

I would like to, in TIMER1, use COMP2_OUT to as the ETR, to make time-shifting of a PWM output signal.

The setting of TIM1 registers are as the following:

   TIM1->CR1 = 0; // disable TIM1

   TIM1->PSC = 9 - 1;

   TIM1->SMCR = 0x00004; // Reset Mode

   TIM1->OR2 = 0x8000; // COMP2_OUT as ETR

   TIM1->CCR3 = 4; //

   TIM1->CCMR2 = 0x00060; // PWM mode 1

   TIM1->CCER = 0x0400; // CH3N output enable

   TIM1->BDTR = 0x8000; // MOE: main output enable

   TIM1->CR1 |= 1; // enable TIM1

I have the PWM signal output, and the COMP2_OUT can rise an interrupt correctly.

But the COMP2_OUT has no impact on the PWM signal.

Do I miss some settings ?

Best regards

2 REPLIES 2

If you want to use ETR as trigger to the slave mode controller, you have to set TIMx_SMCR.TS to 0b111.

JW

With TIMx_SMCR.TS set to 0b111, it works as expected !

Thank you JW!