Thread+BLE,DFU through ble

Hi, nordic engineer:

         Our project has a function, that is, BLE+Thread coexists. We hope that the mobile phone can upgrade the device through BLE. Can this idea be realized?
       I tried to burn softdecvice+bootloader, then use the mobile phone to give the device DFU. After the upgrade is completed, let the device power off and restart, the device does not jump to the application, but enters DFU mode again.

Parents
  • Hi Noa-Ben,

    Please take a look at the BLE+Zigbee DFU Server example. It contains the functionality that you look for (the server side is upgradeable by a regular DFU over BLE, implemented as Application-level BLE DFU with background DFU bootloader).

    Porting this example to Thread requires some effort, but at least you can take a look at the sdk_config.h file to get a tip how to configure DFU modules. Additionally, it shows that such functionality should be possible to implement.

    If a device does not enter the new application, most likely the upgrade process has failed. Try to debug the bootloader code to see which firmware validation step has failed.

    Kind Regards,

    Tomchy

Reply
  • Hi Noa-Ben,

    Please take a look at the BLE+Zigbee DFU Server example. It contains the functionality that you look for (the server side is upgradeable by a regular DFU over BLE, implemented as Application-level BLE DFU with background DFU bootloader).

    Porting this example to Thread requires some effort, but at least you can take a look at the sdk_config.h file to get a tip how to configure DFU modules. Additionally, it shows that such functionality should be possible to implement.

    If a device does not enter the new application, most likely the upgrade process has failed. Try to debug the bootloader code to see which firmware validation step has failed.

    Kind Regards,

    Tomchy

Children
  • Hi tomchy:

    1.   I first burn ble bootloader+softdevice, DFU file is thread+ble, the prompt is as follows, I am not sure whether it has been successfully burned.After restart,it will into dfu mode again.
    • 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000765B8, src=0x2000964C, len=144 bytes), queue usage: 1
      0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000765B8, pending 1
      0> <debug> nrf_dfu_ble: Freeing buffer 0x2000964C
      0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
      0> <debug> nrf_dfu_req_handler: Offset:329288, CRC:0x3B4A5154
      0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
      0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (data
      0> <debug> nrf_dfu_req_handler: Whole firmware image received. Postvalidating.
      0> <debug> nrf_dfu_validation: Hash verification. start address: 0x26000, size: 0x50648
      0> <debug> nrf_dfu_validation: Invalidating old application in bank 0.
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 1
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, src=0x2000A318, len=896 bytes), queue usage: 2
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 3
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x2000A698, len=896 bytes), queue usage: 4
      0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
      0> <debug> app: timer_stop (0x20005944)
      0> <debug> app: timer_activate (0x20005944)
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 4
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 3
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 2
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 1
      0> <debug> nrf_dfu_req_handler: All flash operations have completed. DFU completed.
      0> <debug> app: Shutting down transports (found: 1)
      0> <debug> nrf_dfu_ble: Shutting down BLE transport.
      0> <debug> nrf_dfu_ble: Disconnecting.
      0> <debug> nrf_dfu_ble: BLE transport shut down.
      0> <debug> app: Resetting bootloader.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <info> app: Inside main
      0> <debug> app: In nrf_bootloader_init
      0> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
      0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
      0> <debug> nrf_dfu_settings: Using settings page.
      0> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <debug> app: Enter nrf_bootloader_fw_activate
      0> <debug> app: Valid App
      0> <debug> app: Enter nrf_dfu_app_continue
      0> <debug> app: No copy needed
      0> <debug> app: Setting app as valid
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 0
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 0
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, src=0x2000A318, len=896 bytes), queue usage: 1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 0
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 1
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 0
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x2000A698, len=896 bytes), queue usage: 1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 0
      0> <debug> app: Resetting bootloader.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <info> app: Inside main
      0> <debug> app: In nrf_bootloader_init
      0> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
      0> <debug> nrf_dfu_flash: Initializing nrf_fstor

    2.    This is the DFU file that burns the BLE_UART example. It will not enter DFU mode after restarting.

    • 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002D2DC, src=0x20009834, len=24 bytes), queue usage: 0
      0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x0002D2DC, pending 0
      0> <debug> nrf_dfu_ble: Freeing buffer 0x20009834
      0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
      0> <debug> nrf_dfu_req_handler: Offset:29428, CRC:0xB857F718
      0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
      0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (data)
      0> <debug> nrf_dfu_req_handler: Whole firmware image received. Postvalidating.
      0> <debug> nrf_dfu_validation: Hash verification. start address: 0x26000, size: 0x72F4
      0> <debug> nrf_dfu_validation: Invalidating old application in bank 0.
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 0
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, src=0x2000A318, len=896 bytes), queue usage: 1
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 2
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x2000A698, len=896 bytes), queue usage: 3
      0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
      0> <debug> app: timer_stop (0x20005944)
      0> <debug> app: timer_activate (0x20005944)
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 3
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 2
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 0
      0> <debug> nrf_dfu_req_handler: All flash operations have completed. DFU completed.
      0> <debug> app: Shutting down transports (found: 1)
      0> <debug> nrf_dfu_ble: Shutting down BLE transport.
      0> <debug> nrf_dfu_ble: Disconnecting.
      0> <debug> nrf_dfu_ble: BLE transport shut down.
      0> <debug> app: Resetting bootloader.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <info> app: Inside main
      0> <debug> app: In nrf_bootloader_init
      0> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
      0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
      0> <debug> nrf_dfu_settings: Using settings page.
      0> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <debug> app: Enter nrf_bootloader_fw_activate
      0> <debug> app: Valid App
      0> <debug> app: Enter nrf_dfu_app_continue
      0> <debug> app: No copy needed
      0> <debug> app: Setting app as valid
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 0
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 0
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, src=0x2000A318, len=896 bytes), queue usage: 1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 0
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 1
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 0
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x2000A698, len=896 bytes), queue usage: 1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 0
      0> <debug> app: Resetting bootloader.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <info> app: Inside main
      0> <debug> app: In nrf_bootloader_init
      0> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
      0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
      0> <debug> nrf_dfu_settings: Using settings page.
      0> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
      0> <debug> app: Enter nrf_bootloader_fw_activate
      0> <info> app: No firmware to activate.
      0> <debug> app: App is valid
      0> <debug> nrf_dfu_settings_svci: Erasing settings page additional data.
      0> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
      0> <debug> nrf_dfu_settings: Writing settings...
      0> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
      0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 0
      0> <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 0
      0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x2000A698, len=896 bytes), queue usage: 1
      0> <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 0
      0> <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
      0> <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0
  • Hi Noa-Ben!
    Which bootloader do you use? Am I correct that you are trying to have a device with Softdevice+BLE bootloader only and transfer the application via DFU?

    Could you paste all commands that you use, so anyone can follow your steps? (settings generation, package generation, starting DFU etc).

    Which version of nrfutil do you use? Which version of SDK do you use?

    Are you able to perform the DFU with blinky example (softdevice-enabled variant)?


    BR,

    Tomchy

  • Hi, tomchy:

            Bootloader's version that I used is secure_bootloader_ble_s140_pca10056. Also, I had tried to use the bootloader secure_bootloader_ble_s140_pca10056_debug.

           The same effect, DFU can be successful, but still enter DFU mode after restart

    1. nrfjprog --eraseall
    
    2. nrfjprog --program ./s140_nrf52_6.1.1_softdevice.hex
    
    3. nrfjprog --program secure_bootloader_ble_s140_pca10056.hex
    
    4. nrfutil pkg generate --hw-version 52 --sd-req 0xb6 --application-version 3 --application ble_thread_dyn_mtd_coap_cli_pca10056_s140.hex --key-file MIXIT.pem dyn_mtd_coap_cli.zip

Related