stm8s003 timer1 channel2 capture doesn't work

49 views Asked by At

this doesn't work:

    TIM1_CCMR2 = 0b01; //its default input channel
    TIM1_IER = 0b100; //channel 2 capture interrupt
    TIM1_CCER2 = 0b1; //channel 2 capture
    TIM1_CR1 = 0b1; //start counter

and yet this works with no problem (on channel 1)

    TIM1_CCMR1 = 0b10; //remap channel 1 on input 2 where ch2 is supposed to be by default
    TIM1_IER = 0b10; //capture channel 1 interrupt
    TIM1_CCER1 = 0b1; //enable channel 1 capture
    TIM1_CR1 = 0b1; //start counter

also, if I remap channel one on ti 1 (pin 16) it still works (on channel one pin) but if I remap channel 2 on ti 1 it won't.

0

There are 0 answers