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?"

Parents
  • Hi Pipixia, 

    Are you testing on the nRF52840 DK or it's the dongle or your custom board ? 

    You may want to check the logging of the bootloader to see if the DFU update was successful or not. When you do DFU update did you manually switch the device to bootloader mode ? 

    When you update with USB powered, if you trigger a power reset does the app start ? I suspect that for some reason the device was not reset to swap the image yet. 

    Another thing you can do is to try reading the flash out in 2 cases, when powered by battery and when powered by USB, you can use a tool (Notepad++) for example to compare the flash dump. I would suggest to test using very simple application. 

    Have you modified the bootloader ? Do you see the same issue if you test the stock bootloader ? 

  • i test it by our board, i have not moidfiy the bootloader but public key file. 

     i read the hex and  compare it,there is no different.and i discover a new case ,i use the shell command programming the app and sd and bootloader,if i powered by usb before programming,it also in the boot after programming.and if i powered by battery,it can jump to the app .and when in the boot,i trigger  the reset pin,it also in the boot.                 

  • Hi Pipixia, 


    It's hard to tell what's wrong without any logging. Please try to add logging and find out why the bootloader doesn't jump to the application. 
    If you have SWD interface to the device you can just debug the bootloader and check the reason why it doesn't jump to the application. 

    You may need to compile the bootloader in debug mode. 

  • hi,bui

    i test the board,in the pca10059,the board can jump to the app.and the different between 10059 and our board is that the power supply .our power supply like this:

     

    and i short the vddh and the vbus ,the chip can jump to the app,so what should we do the design the power supply

  • Hi, 

    Please explain what exactly you meant by "and i short the vddh and the vbus ,the chip can jump to the app,so what should we do the design the power supply" ?
    Which change allows the bootloader jumps to the app ? 

Reply Children
  • 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