Watchdog Timer


#1

Is there an internal watchdog timer that can be enabled for the user microprocessor? Or if not, how would you suggest interfacing an external WDT? I’m considering using the Dash in a commercial project where accessibility is difficult and asking the customer to reset the device is problematic. Faults due to buggy code or even soft errors could lead to lock-ups so I’d like to implement a watchdog timer to make sure my device has the best chance at always being operational.

The Dash.shutdown() function says the user micro performs a reset after receiving a wakeup interrupt. If there’s no internal WDT, and an external WDT can be implemented, would forcing a periodic reset be the closest thing I could implement that would ensure my system is operational following a software bug or soft error?


#2

There is a watchdog module included in the user MCU. We don’t have a driver for it, but it is documented in Chapter 24 of the Reference Manual.


#3

Thanks for pointing me to the reference manual. I’m usually oblivious to the underlying hardware. Just a few more questions:

  1. Does the Dash.shutdown() function perform a user micro reset following a wakeup interrupt? Is it true that the current drain in deep sleep is the same as shutdown but no reset occurs when the processor wakes-up following deep sleep?

  2. Can the registers be accessed directly from my sketch? If not, could you briefly explain what the build process looks like to access the Freescale registers and if there are any examples around.

Thanks.


#4
  1. The reset-on-wake is the only real difference between shutdown and deepSleep.The power state is a little bit different, but the drain is almost identical.
  2. You can access all the registers. In the MK22F51212.h file in the Arduino package there are definitions for most of the registers. One big caveat to using that file is that it was originally for a similar processor and was adapted to the one on the Dash (as the header for that processor hadn’t been available at the time). So there may be some inconsistencies for sections that haven’t been used. The WDOG is pretty common across parts, so it’s PROBABLY ok, but I know I haven’t done a full check of it to make sure.

You may want to take a look at the NXP (Freescale) KSDK, as it has drivers and example code for most peripherals. The Dash uses version 1.2 if you want to stay consistent. It is behind a registration wall on the NXP website though.


#5

Eric. Thanks. Your support on this forum is greatly appreciated!


#6

Check this out- https://playground.arduino.cc/Code/SimpleTimer#F_restartTimer

I just implemented it and it’s working well. Given the limitations of simultaneous execution on the Dash it won’t be THAT precise, but it’s the best solution I’ve found.


#7

If the SimpleTimer is working well enough for you, then great. A more accurate alternative would be the built-in hardware timer available in our Timer API. It’s for a different use case than the original question (a watchdog timer), but very useful.


#8

I checked it out. I don’t know if Ryan passed along the info to you or Reuben, but using it killed some of my sensors unexplainably so I’ve been staying away from it. Plus, it only has support for one active timer which isn’t enough in my case.