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

nrf52840 cant goto application after usb dfu

hi nordic team,

im update the app by usb dfu,my sd version is  s140_nrf52_7.0.1_softdevice,and shell like this:

program.bat

::generate settings page for current image: app.hex
nrfutil settings generate --family NRF52840 --application app.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 settings.hex

::merge bootloader and settings
mergehex --merge bootloader.hex settings.hex --output bl_temp.hex
::merge bootloader, app and softdevice
mergehex --merge bl_temp.hex app.hex s140_nrf52_7.0.1_softdevice.hex --output whole.hex

nrfjprog --eraseall -f NRF52
nrfjprog --program whole.hex --verify -f NRF52
nrfjprog --reset -f NRF52

pause

dfu.bat

nrfutil pkg generate --application app_new.hex --application-version 2 --hw-version 52 --sd-req 0xCA --key-file priv.pem SDK160_app_s140_usb.zip
nrfutil dfu usb-serial -pkg SDK160_app_s140_usb.zip -p COM28
pause

the device cant update and i can see the schedule of100%

but it cant go to the app by self ,and the strange thing is that:

1.after dfu,if power by usb ,the device cant go to the app

2.after dfu,if power by battery,the device can go to the app

so what should i do to slove this problem?"

  • hi 

    i modify the define NRF_BL_DFU_ENTER_METHOD_BUTTON to 0 in the project of bootloader.and the chip cant jump to app,but  it cant stay in the boot for 120000ms 

    when  i call the api like this:

    uint32_t enter_bootloader(void)
    {
            // Softdevice was disabled before going into reset. Inform bootloader to skip CRC on next boot.
            //nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);
    
            //Go to system off.
            //nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);	
    	
    	
    	  uint32_t err_code;
    
        NRF_LOG_DEBUG("In ble_dfu_buttonless_bootloader_start_finalize\r\n");
    
        err_code = sd_power_gpregret_clr(0, 0xffffffff);
        VERIFY_SUCCESS(err_code);
    
        err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
        VERIFY_SUCCESS(err_code);
    
        // Indicate that the Secure DFU bootloader will be entered
       // m_dfu.evt_handler(BLE_DFU_EVT_BOOTLOADER_ENTER);
    
        // Signal that DFU mode is to be enter to the power management module
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
    
        return NRF_SUCCESS;
    	
    	
    }
    

    i can see the usb port info like this:

    but i see nothing about NRF_LOG_INFO of project pca10056_usb_debug

    and after 2s it jump to app?so i dont know why it cant stay in boot?

  • Hi, 

    I guess when you set NRF_BL_DFU_ENTER_METHOD_BUTTON  = 1 the bootloader stayed in bootloader mode without jumping to the app because the button was held in the active level (can be low or high depends on your configuration) and keep the bootloader in DFU mode. Please check the 

    How long did it stay in bootloader after you switch from app to bootloader ? If you want to get the log from the bootloader, you would need to disable the log in the application.

    Please try putting a breakpoint in the bootloader (after the app running) then trigger a switch to the bootloader, then you can start stepping debug in the bootloader. 

  • Hi,

    i debug the project,and i discover the reason of the chip cant stay in the boot is i start the wdt(2s timeout) in the app.and if i comment the init of wdt,the chip can stay in the boot ,and i can dfu.if i enable the wdt,i cant see any log of project pca10056_usb_debug.i see the wdt in the boot project,and i comment

    nrf_bootloader_wdt_init();

    in

    nrf_bootloader_init(nrf_dfu_observer_t observer)

    and comment

    if (nrf_wdt_started())

    in

    nrf_bootloader_wdt_feed(void)

    but it also cant stay in the boot,so what should i do to slove this problem?

Related