RAK11720 Watchdog

Implemented Watchdog time on the RAK11720.

Started it with : api.system.wdt.enable(8000);

Create a timer to kick the Watchdog: .
api.system.timer.create(RAK_TIMER_0, wdt_kicker, RAK_TIMER_PERIODIC);
api.system.timer.start(RAK_TIMER_0, 5000, NULL);

Inside the timer event WDT gets cleared:
api.system.wdt.reset();

This works as expected…but I have multiple instances where the module still freeze…then only a power cycle will recover it.

Question : How reliable is this WatchDog implementation? Should I rather opt for an external watchdog?

Using RUI4.1.1 together with RAK19007+RAK11722

The watchdog is implemented as a timer that is running in the background. A serious firmware crash can disable the WDT. If your code has instabilities and you have to rely on a hardware WDT, it is better to use an external watchdog.

You may be interested of using hardware WDT provided by MCU itself. It is quite easy to set up, and it is pretty much reliable.

The only “drawback” I can see, is the dependency injection of Ambiq SDK to your code, but if It is ok for you, this is an example:

WDT Example with Apollo 3 SDK

As a summary, you only need to call am_hal_wdt_init(&g_sWatchdogConfig); and am_hal_wdt_start(); to make it run. Also, don’t forget the headers and feed the WDT.

#include "am_mcu_apollo.h"
#include "am_bsp.h"
#include "am_util.h"

// some where in the code, feed WDT. 
am_hal_wdt_restart();

As RUI implementation for RAK11720 uses Ambiq SDK under the hood, you don’t need to install anything else.

Cheers.

In my case, I was facing the same issue of not being able to rely on RUI timers (as WDT API or Timer API), because they are software implemented and they were sporadically stopping without a clear reason (probably memory corruption). I’m still looking why.

Thank you for this! Absolute gold!

This works as expected and in the couple of days of testing it has never failed.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.