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

USB DFU combined with Buttonless BLE DFU

Hi

I am working with nRF52840 DK  v2.0.1, in SDK 17.0.2., trying to implement combined BLE+USB DFU in my application.

First I tried combining bootloaders from SDK (secure_bootloader/pca10056_s140_ble and secure_bootloader/pca10056_usb), and I used pca10056_s140_ble  as starting point.

I imported all files that are in the pca10056_usb bootloader, along with all skd_config.h definitions and include paths. Also, I changed flash start and flash size, to fit new bootloader into the flash memory.

In my main application, I tried using USB DFU trigger library, to trigger USB DFU (BLE DFU was already implemented before but now it doesn't work)

I connected P0.05 to P.018, as required by the library, and I've enabled PINRESET entry mode in the bootloader sdk_config.h.

Can anyone tell me what am I missing here? The application works fine, I'm using BLE, UART and USB CLI, It's just won't go into DFU mode.

I would appreciate if someone could tell me steps required to combine two bootloaders, and including these bootloaders into the main application?

Thanks!

  • can you take acess of my pc and help it is much needed as i am struck

  • I'm sorry, I can't do that right now. Here are the key steps that you need to take:

    • Build your main application
    • Build the bootloader
    • Copy the bootloader hex and the main application hex and put them in the same folder
    • Use the nrfutil to create settings file (as shown in the example below)

    nrfutil settings generate --family NRF52840 --application ble_app_cli_pca10056_s140.hex --application-version 0 --bootloader-version 0 --bl-settings-version 2 bl_setting.hex
    

    • Use the mergehex to combine settings, bootloader, application and the softdevice (it must be done in 2 steps as shown in the example following)

    mergehex --merge bl_setting.hex secure_bootloader_usb_mbr_pca10056.hex s140_softdevice.hex --output bl_set_s140.hex
    mergehex --merge bl_set_s140.hex ble_app_cli_pca10056_s140.hex --output bl_set_s140_app.hex
    

    • Use the nRF Connect programmer to flash the device with bl_set_s140_app.hex file (your app should be working now on the device, and the next step is to perform DFU)
    • Make needed changes in your main app and perform build. Use the new resulting application hex file to create .zip package with the following command:

    nrfutil pkg generate --application ble_app_cli_pca10056_s140.hex --application-version-string "2.0.0" --hw-version 52 --sd-req 0xCA --key-file C:\Users\Em\Downloads\Milestone-1\DFU-test\private.key app_v2.zip

    • Use the .zip package to perform the DFU

    (Example commands that I have provided is used for applications that are based on s140 SD)

    This all I can help you with. If this doesn't work for you, you have failed to install required software and libraries, go through the installation process again.

  • and just to be clear the answer to this problem is to move your files around so USB related DFU files (nrf_dfu_serial.c and nrf_dfu_serial_usb.c) before the ble dfu files (nrf_dfu_ble.c)  Took me hours to track down what in the world was going on.  Since this is actual problem I would definitely recommend that Nordic update the transport init to be in the required order if more than one is present.

  • Your statement about the order in which USB and BLE are initialized is correct, I changed the order in which they are initialized and now both BLE and USB are working namally

    00> <info> app: Inside main
    00> 
    00> <debug> app: In nrf_bootloader_init
    00> 
    00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00> 
    00> <debug> nrf_dfu_settings: Using settings page.
    00> 
    00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <debug> app: Enter nrf_bootloader_fw_activate
    00> 
    00> <info> app: No firmware to activate.
    00> 
    00> <info> app: Boot validation failed. No valid app to boot.
    00> 
    00> <debug> app: DFU mode because app is not valid.
    00> 
    00> <info> nrf_bootloader_wdt: WDT is not enabled
    00> 
    00> <debug> app: in weak nrf_dfu_init_user
    00> 
    00> <debug> app: timer_stop (0x2000599C)
    00> 
    00> <debug> app: timer_activate (0x2000599C)
    00> 
    00> <info> app: Entering DFU mode.
    00> 
    00> <debug> app: Initializing transports (found: 2)
    00> 
    00> <debug> nrf_dfu_serial_usb: Initializing drivers.
    00> 
    00> <debug> nrf_dfu_serial_usb: Starting USB
    00> 
    00> <debug> nrf_dfu_serial_usb: USB Transport initialized
    00> 
    00> <debug> nrf_dfu_ble: Initializing BLE DFU transport
    00> 
    00> <debug> nrf_dfu_ble: Setting up vector table: 0x000E1000
    00> 
    00> <debug> nrf_dfu_ble: Enabling SoftDevice.
    00> 
    00> <debug> nrf_dfu_ble: Configuring BLE stack.
    00> 
    00> <debug> nrf_dfu_ble: Enabling the BLE stack.
    00> 
    00> <debug> nrf_dfu_ble: No advertising name found
    00> 
    00> <debug> nrf_dfu_ble: Using default advertising name
    00> 
    00> <debug> nrf_dfu_ble: Advertising...
    00> 
    00> <debug> nrf_dfu_ble: BLE DFU transport initialized.
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
    00> 
    00> <debug> app: Enter main loop
    00> 
    00> <info> nrf_dfu_serial_usb: USB power detected
    00> 
    00> <info> nrf_dfu_serial_usb: USB ready
    00> 

Related