This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

S140 bootloader,no timeout?

Hi,

I use the bootloader in the SDK V13.0, I found that no timeout as the SDK v12.x. However, I have added the WDT to the bootloader refer to the link link text it still stay at the bootloader and never switch to the application from bootloader when the WDT timeout.

image description

  • @alice: Does the device reset when the WDT timout occurs?

  • @Bjørn Spockeli No, it seems that the WDT doesn't occurs timeout. I do as follow: code snippet to nrf_dfu_init() after the if(enter_bootloader_mode != 0 || !nrf_dfu_app_is_valid()) statment

    			//Configure WDT.
        NRF_WDT->CONFIG         = (WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);       // Configure WDT to run when CPU is asleep
        NRF_WDT->CRV            = 1966079;                                              // Timeout set to 60 seconds, timeout[s] = (CRV+1)/32768
        NRF_WDT->RREN           = WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos;             // Enable the RR[0] reload register
        NRF_WDT->TASKS_START    = 1;                                                    // Start the WDT            
    

    Then add the snippet below to the nrf_dfu_req_handler_on_req() function in dfu_req_handling.c

    // Reload the WDTs RR[0] reload register
    

    NRF_WDT->RR[0] = WDT_RR_RR_Reload;

    Is there any problem for the WDT?

  • No, I am not aware of any issues with the WDT, it is identical to that of the nRF52832. Could you try to add the following line before you call the NRF_WDT->TASKS_START = 1;

    NRF_WDT->INTENSET = 1;
    

    If that does not solve the issue, then please you debug the bootloader and use the peripheral viewer to check the RUNSTATUS,INTENSET,CONFIG and RREN registers of the WDT to verify that the WDT is running, the TIMEOUT interrupt is enabled, it is configured and that the reload register is enabled.

  • I think there is no problem for the WDT setting. Because the device would reset when the WDT timout occurs after I do OTA successful.

    I merge the four files(applicaiton,bootloader,softdevice,bootloader setting) into one file then program to the chip, I found that it stays at the bootloader and broadcast as "DfuTarg", not the application.At this time, if I do OTA and then close bluetooth function or close the APP to make a bad condition, bootloader wouldn't timeout even if I wait a long time. However, if I do OTA successfully, at this time it will run the application, not bootloader. Then I do OTA again and make a bad condition to test WDT, I found that the device reset when the WDT timout occurs.

    So it seems that I have found something. After I program merged file, it should run the application, not the bootloader. In fact, it runs the bootloader. So I think the main problem is how to make it run application when program it firstly. I use the same way for SDK V12.x, it wouldn't meet the problem and it would run the application first.

  • How are you generating the bootloader settings hex? Can you post the nrfutil command and the output in the terminal? Also can you debug your bootloader project after you have flashed the combined hex file and check if you reach the if (nrf_dfu_app_is_valid()) statement( line 197) in nrf_dfu.c in the function nrf_dfu_init(). If so what does nrf_dfu_app_is_valid() return?

Related