AnsweredAssumed Answered

STM32F0 TIMx gate mode channel selection

Question asked by Daniel Correia on May 2, 2018
Latest reply on May 4, 2018 by Daniel Correia

I'm using the gate mode TIM scheme as detailed in the reference manual:

TIM3->CCMR1 |= TIM_CCMR1_CC1S_0; /* (1)*/
TIM3->CCER |= TIM_CCER_CC1P; /* (2) */
TIM3->SMCR |= TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0 | TIM_SMCR_TS_2 | TIM_SMCR_TS_0; /* (3) */
TIM3->PSC = 0; /* (4) */
TIM3->ARR = 65000;
TIM3->CR1 |= TIM_CR1_CEN; /* (5) */

This works perfectly for channel 1.

 

Now I'm trying to dynamically change channels, and I can't seem to wrap my head around the masks.

 

I've tried a number of register masks, like

TIM3->CCMR1 |= TIM_CCMR1_CC2S_0 | TIM_CCMR1_CC1S_1; /* (1)*/

and 

TIM3->CCMR1 |= TIM_CCMR1_CC2S_0; /* (1)*/

But I haven't been able to get the input to switch..sorry for such a stupid question, I'm sure there's something in the reference manual that I'm missing.

Outcomes