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

Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15

Hello!

I have a custom nRF52832 board with an FTDI usb/serial part running my app successfully.

I generally program the board with a JLINK and SWD, but I am working to add DFU over usb/serial using the secure bootloader serial example.

I can set GPREGET in my app and soft reset to enter DFU in the bootloader.

I am successfully able to use nrfutil to perform a DFU of my application over serial. Also, if I set GPREGET in my app and soft reset to enter the DFU, but do not initiate the DFU update using nrfutil, eventually, the bootloader times out for inactivity after 10 seconds or so and resets back into my application.

So far so good!

However, when I enable a WDT in my app, the trouble starts.

1. If I make my WDT very long (say 20 seconds), when soft resetting into the bootloader, the ~10s inactivity timer no longer works. If I simply disable the WDT, the ~10s inactivity timer works again. If I wait out the 20 second WDT timer when in the bootloader, the WDT does its thing and resets back to my app.

2. If I make my WDT short (say 4 seconds) while leaving the inactivity timer at ~10s, the WDT is clearly not being fed by the bootloader because a soft reset back to my app happens after 4 seconds.

3. If I leave my WDT short (say 4 seconds), and I add an nrf_delay_ms of 2 seconds at the start of the bootloader, followed by manually feeding the WDT with a nrf_wdt_reload_request_set(NRF_WDT_RR0), I can see that the feeding works, as the bootloader soft resets back to my app after 6 seconds. If I leave the nrf_delay_ms of 2 seconds without the manual feeding, the bootloader soft resets back to the app after 4 seconds.

So my questions are:

1. Why does the Nordic code in the SDKv15 secure bootloader not feed my WDT? Inspecting the code, it seems like it should be feeding the WDT in both the event scheduling loop and possibly by an app timer. I can't seem to get the bootloader code to feed my WDT either "out of the box" or by hacking in an application timer.

2. Why when I enable the WDT (for example 20 seconds), does my 10s inactivity timer stop working? The inactivity timer appears to just be a simple one shot app timer performing a system reset. I don't understand how the presence of the WDT would interfere with the 10s inactivity timer.

Thanks!

Jeremy

Related