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

How to use the watchdog when DFU

Hi

I opened the Watchdog in the user application,and do nothing in the bootloader.Then when I use DFU,the CPU reset appears.How can I to deal with it?

And when I upgrade willful termination APP(nRF Toolbox),the CPU(nRF52832)is down,and can't work.Do you have any suggestions on how to solve this fault tolerance?

Thank you!

Parents Reply Children
  • How to actually do that? Where is the loop I can put that watchdog feeding call in your bootloader_secure? If I remember right, there is an event loop, yes. But might it be that BT events are coming so rarely that the watchdog bites before the it is feeded next time?

    Furthermore, can I check in the bootloader somehow, if the watchdog is running or not?

    And in the first place, I don't really understand why watchdog is not stopped when the system resets. There's no any clever reason for that kind of design.

  • @nikula (Jarmo): Are you using the nRF51 or nRF52? Are you using the legacy or the secure bootloader? How long is the WDT interval? If its the latter, then I would put it in the nrf_dfu_req_handler_on_req() function in dfu_req_handling.c, see this answer.

    You should be able to configure the WDT after a reset according to the documentation, see this link.

    When the device starts running again, after a reset, or waking up from OFF mode, the watchdog configuration registers will be available for configuration again.

  • In this case it is nRF51 and SDK8, so no secure bootloader. So, what would be the best way with it? Since all our applications do not use watchdog, but all are using the same bootloader, I would need a safe way to bypass watchdog in the bootloader if it is not running. In other words, if an application has not started watchdog, bootloader should not use it, neither. How to achieve that? We definitely do not want to have two different versions of DFU-OTA bootloader.

  • I think the best way to solve the problem in hand would be to stop the watchdog in the bootloader, or set the timeout into infinite (what does mean "the registers are available for configuration again"?), if that is possible. But if not, then I need a solution that I asked above.

  • The legacy bootloader from SDK 8 does not perform a reset when jumping from the application to the bootloader. Thus, if the WDT has been started in the application, then its not possible to stop or configure the WDT as the watchdog’s configuration registers, which comprises registers CRV, RREN, and CONFIG, will be blocked until the device has reset. It is possible to check whether the WDT is running or not by reading the RUNSTATUS register, but as I stated previously, you're not able to pause it if the application started it before branching to the bootloader. You could just feed the WDT regardless of the WDT state(i.e. running or not running). If its not running then you will just write to the WDS reload register which will have no effect.

Related