Skip to main content
marek2399
Associate III
October 28, 2017
Question

Read output state of Timer

  • October 28, 2017
  • 6 replies
  • 1278 views
Posted on October 28, 2017 at 18:54

Hello engineers,

could someone help me with one issue? Iam finding way to read output state of timer but unsuccessfull. I have one timer triggered by Comparator. This timer is configured as one pulse and is master for another timer which is configured in gated mode. Any advice for reading state of one pulse timer?

Many thanks

    This topic has been closed for replies.

    6 replies

    Omar BOUZOURRAA
    Associate II
    October 28, 2017
    Posted on October 28, 2017 at 20:27

    Hello,

    Yo can simply enable CCR interrupt in one pulse Timer. In the corresponding CallBack you increment a variable. This variable will show you how much the Timer output state has changed.

    Tesla DeLorean
    Guru
    October 28, 2017
    Posted on October 28, 2017 at 20:54

    The physical pin is readable via GPIOx->IDR, I'd expect it would work as an EXTI input regardless of the peripheral assignment. The Internal status of the TIM can be seen via the SR, CNT, and CCRx registers.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    marek2399
    marek2399Author
    Associate III
    October 28, 2017
    Posted on October 28, 2017 at 21:38

    Hello,

    Arent those registers just for settings?

    Tesla DeLorean
    Guru
    October 28, 2017
    Posted on October 28, 2017 at 21:50

    No, not exactly. Status will reflect things, I'd expect CCx to signal in SR, I'd expect CNT to reflect current phase, and CCRx on the indirect channel to be usable to latch things. You'd likely need to experiment to get the info you're looking for, but I think the hardware should be able to report things you can use.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    waclawek.jan
    Super User
    October 29, 2017
    Posted on October 29, 2017 at 21:30

    I don't understand why do you need this, but if you trigger an interrupt upon compare and update, you can keep simulate the state of output in software - this is basically the same as Omar said above.

    JW