Watchdog on Bangle.js 2 ?

Posted on
  • Hi,
    Is the watchdog working on a Bangle.js 2 ?
    The code

    >process.version
    ="2v10.89"
    >E.enableWatchdog(5, false)
    =undefined
    > 
    

    should reset Espruino after 5 seconds ? Right ? It does not...

  • The watchdog is already enabled, and is poked by the peripheral poll timer.

    The reasoning is:

    • If that timer ever stops the bangle will reboot
    • That timer handles both the ~2 sec to reload and ~10 sec to reboot behaviour

    So you should be pretty safe as long as it's running - although granted it doesn't guarantee your code is. I guess it could be an option though? Are you encountering stability issues?

  • No stability issues so far, but I always tend to monitor all of my software modules for 'bad behaviour' and the only real solution, for e.g. an occasional unintended loop, often is a watchdog reboot. Just an experience that has proved worthwhile after years of firmware development....

    So, for my understanding : the 'isAuto' flag for 'E.enableWatchdog' has no effect for a Bangle.js 2 ?

  • So, for my understanding : the 'isAuto' flag for 'E.enableWatchdog' has no effect for a Bangle.js 2 ?

    That is correct. I can make a firmware change to ensure that the flag is honoured though?

    The only downside is you'd then be unable to reboot to the bootloader unless you handled it explicitly in your code (since the reboot is handled right now using the watchdog)

  • Rebooting to the bootloader has proven very useful on several occasions, so I'm not sure it's a good idea to compromise that functionality.
    I'm also not familiar enough with the bare metal code of Bangle.js 2 to make a meaningful suggestion for a watchdog functionality. (Previous experiences with an Espruino Pico gave me the watchdog functionality I'd expect, but in a Bangle.js 2 it is probably far more complex to ensure reboot and BLE accessibility at all times.)
    Conclusion : for now, I'll take the risk of running my firmware without a 'high level' watchdog. I will see how this turns out (the Bangle.js 2 is after all not completely headless, the user can press the button for 3 seconds and force a re-load himself.)

    Thanks.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Watchdog on Bangle.js 2 ?

Posted by Avatar for jgw @jgw

Actions