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

bootloader&wdt

FormerMember
FormerMember

hello everyone:

do you have try to add wdt into bootloader project?

i add it as follow: in the static void wait_for_events(void) function, i add two

if(NRF_WDT->RUNSTATUS&0x01){ NRF_WDT->RR[0]=WDT_RR_RR_Reload;}

static void wait_for_events(void)
{
    for (;;)
    {
        // Wait in low power state for any events.
        uint32_t err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
				
				if(NRF_WDT->RUNSTATUS&0x01)
				{
						NRF_WDT->RR[0]=WDT_RR_RR_Reload;
				}
        // Event received. Process it from the scheduler.
        app_sched_execute();

        if ((m_update_status == BOOTLOADER_COMPLETE) ||
            (m_update_status == BOOTLOADER_TIMEOUT)  ||
            (m_update_status == BOOTLOADER_RESET))
        {
						if(NRF_WDT->RUNSTATUS&0x01)
						{
								NRF_WDT->RR[0]=WDT_RR_RR_Reload;
						}
            // When update has completed or a timeout/reset occured we will return.
            return;
        }
    }
}

and then,i try to DFU,when i send dfu command.it's time to wdt,it reset.

and before i add wdt to application.there i can dfu it nornal

is there anybody know the reason? can you tell me ? thank you

Parents Reply
  • Hi Yichen,

    If you reset the chip (in the application) by the watchdog reset, the GPREGRET register will be erased.

    You have two options:

    1 - Keep the WDT running, reset using soft reset. Then inside the bootloader you need to feed the dog.

    2 - Let the WDT trigger the reset , but then you need to write the flag to enter bootloader mode in flash instead of GPREGRET. This way you don't need to handle the WDT in the bootloader.

Children
No Data
Related