Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Teensy 4.x timer behavior during software freeze

  1. #1
    Junior Member
    Join Date
    Apr 2021
    Posts
    10

    Teensy 4.x timer behavior during software freeze

    I've got a question about the hardware timer modules in the Teensy 4.x.

    I've learned a lot about the different timer modules from the TeensyTimerTool library, so I've got a pretty solid understanding of how each one works.

    However, one thing I can't seem to find an answer on: how do the hardware timer modules (PIT, GPT, QUAD) behave when the software hangs the processor? Will they stop?

    Specifically, I'm using a timer to reset a software watchdog. I know the software timers (TCK, TCK64) work well enough for this since they will definitely hang when the software crashes, but they're not very reliable when it comes to synchronous tasks; the software timers will stop, and when the blocking task completes, all of the backlogged callback executions run in immediate succession, then the timer resumes normally. If the watchdog is set to a reasonably high interval, say 60 seconds, then this slight hangup isn't a problem. But still, my OCD-ness doesn't like it.

    (By the way, I find it rather peculiar that a blocking task doesn't simply extend the delay between timer callback executions, but instead, they get stacked up in the meantime, so however many executions there should have been during the block, they all get fired once the block ends.)

    The hardware timers are very steady, regardless of what's going on in software, but if they somehow keep executing callbacks when the software crashes (an oxymoron), then they won't make much sense for use with a software watchdog. It seems to me that when the software crashes, even though the hardware timers might still be firing, there should be no effect, right?.

    Put another way: what type of timer is best for a periodic reset of a software watchdog?

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    4,078
    you should feed it in your regular code loop and not a timer, the watchdog has it's own callback should your software freeze up, the callback will be fired so you can do whatever you want there before the hardware actually resets

    you could even feed the watchdog in it's own callback, but thats kinda rediculous hehe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •