Skip to main content
Jaws
Associate
September 24, 2018
Question

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

  • September 24, 2018
  • 1 reply
  • 676 views

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?

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
September 24, 2018

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