cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to start a timer on external input to produce a timer interrupt?

Jaws
Associate II

Using only timer peripherals would it be possible to configure an input to start a timer - let the timer run for a set amount of time, and then create a timer interrupt?

1 REPLY 1

Yes Set TIMx_SMCR.TS to one of the inputs (TI1FP1 or TI2FP2, coming from CH1 or CH2) and TIMx_SMCR.SMS to Trigger Mode. Set some other channel to output compare, set its compare register to required delay, clear the respective pending interrupt flag in TIMx_SR and enable its respective interrupt in TIMx_DIER (and then of course enable the interrupt in NVIC). Set TIMx_CNT to 0 and don't enable the timer - the trigger will enable.

JW