Software Timers and suspended tasks

craigogawa wrote on Wednesday, May 10, 2017:

We’re using FreeRTOS v8.2.2 and have a problem where our product needs to suspend none critical tasks when a power outage has been detected and resume those tasks if power comes back before a configured amount of time, e.g., up to 2 minutes. The problem we have is that when the tasks are suspended any software timers are now off by amount of time the tasks were suspended. Is there a way to “adjust” these timers prior to or when the tasks are resumed?

rtel wrote on Wednesday, May 10, 2017:

Not automatically, but you could stop the timer before suspending and
re-start after resuming (the timer will restart though).

craigogawa wrote on Wednesday, May 10, 2017:

We use software timers in the critical (not suspended) tasks so we need the timer service running. We will look at using a hardware timer for timers that need a fixed period and will also need to detect and handle missed periods.

Thank you for your quick response.

rtel wrote on Wednesday, May 10, 2017:

I wasn’t suggesting stopping the timer service task, but the individual
timers used by the tasks that get suspended. If the same timers are
used by tasks that are not suspended then you won’t be able to stop them
though.

craigogawa wrote on Wednesday, May 10, 2017:

We have a few tasks that already do that so we’ll extend it to all of the tasks that get suspended.

Thanks again.