This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

WDT & Bootloader

My application uses the WDT. In my application, I use a soft reset to enter the bootloader. Because the soft reset does not reset the WDT the program will reset while in the bootloader because of a watchdog timeout.

What is the best way to handle this issue? I see too options. Instead of performing a soft reset to enter the bootloader I could let the WDT in my application expire in order to perform a reset using a WATCHDOG reset. Alternatively I could add the watchdog service into the bootloader. I don't like that the watchdog is running during the initialization routines at the beginning of my application.Why does the softreset not reset the watchdog? Seems a bit odd.

Parents
  • Hi Lucas,

    I think the philosophy behind is that WDT should work in the way that when it started it can not be turned off. So the WDT can only be reset by itself or by a complete system reset (brown out, pin reset, systemOFF). When entering system OFF, the WDT register is retained but WDT is stopped.

    In this case, softreset is lower level that a Watchdog reset and it shouldn't reset the WDT.

    You are correct about the 2 solutions. I would personally choose to trigger system reset using WDT to start bootloader. In case you don't plan to do a reset when switching between application and Bootloader then you would need to handle the WDT in the bootloader.

  • Thanks for the clarification, Hung. I figured as much after posting the comment. DFU sample code that Nordic provides by default uses GPREGRET to trigger the switch to OTA. If you could additionally clarify that we need to make use of application flash area to trigger the OTA switch if we want enter OTA mode via WDT reset, that would be great.

    What makes this complicated is that sf we already have a bootloader out there that uses GPREGRET to switch to OTA and doesn't already feed the WDT, then we can't release an application that starts using WDT now. Do you know if there is a way to achieve this?

Reply
  • Thanks for the clarification, Hung. I figured as much after posting the comment. DFU sample code that Nordic provides by default uses GPREGRET to trigger the switch to OTA. If you could additionally clarify that we need to make use of application flash area to trigger the OTA switch if we want enter OTA mode via WDT reset, that would be great.

    What makes this complicated is that sf we already have a bootloader out there that uses GPREGRET to switch to OTA and doesn't already feed the WDT, then we can't release an application that starts using WDT now. Do you know if there is a way to achieve this?

Children
No Data
Related