Adding DFU MESH to existing application?

Hello,

Is there a tutorial to add DFU MESH to an existing application? 

Potentially integrating this DFU example into a project:

https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.meshsdk.v5.0.0/md_examples_dfu_README.html

Parents
  • Using - https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.meshsdk.v5.0.0/md_doc_user_guide_modules_dfu_configuring_performing.html

    Flashing Blinky works just fine, as I would like to add DFU to an existing application, I first decided to replace the Blinky binary with the DFU binary. So when I do a software update it'll reflash the DFU and I could test the reflashing. 

    I am able to recreate the zip using:

    nrfutil dfu genpkg --application dfu_nrf52832_xxAA_s132_7.2.0.hex --company-id 0x00000059 --application-id 1 --application-version 2 --key-file private_key.txt --sd-req 0x00CB --mesh dfu_test.zip
    
    

    and reflash it the regular way sending the zip over. However the response I get it this:

    Terminal:

    Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 205300
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    1: PC -> target: 0502aabbccdd
    target -> PC: 0582aabbccdd
    Got echo response
    Sending DFU init packet
    Sending ready packet
    1: PC -> target: 1378fdff040f6320bf4659000000010002000000
    target -> PC: 16a6045900000001000200000059000000010001000000
    target -> PC: 1378fdff04000000000059000000010002000000
    target -> PC: 03847800
    1: PC -> target: 1378fdff040f6320bf4659000000010002000000
    target -> PC: 1378fdff040f6320bf4659000000010002000000
    target -> PC: 03847800
    Sending start packet
    1: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 0ea30104590000000100020000000c
    target -> PC: 1178feff0101010159000000010001000000
    target -> PC: 1178feff0101010159000000010001000000
    target -> PC: 03847884
    2: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    3: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    4: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    5: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    6: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    7: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    8: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    9: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    10: PC -> target: 1478fcff00006320bf46ffffffff7dc8000040000c
    target -> PC: 03847887
    
    
    Failed to upgrade target. Error is: Device returned status code ERROR_INVALID_DATA (135) on a DFU data packet.
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
    - baud rate or flow control is not the same as in the target bootloader.
    - target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    Closing serial port...

    RTT:

    00> <t:          5>, main.c,  227, ----- Bluetooth Mesh DFU Example -----
    00> <t:       8857>, nrf_mesh_dfu.c,  753, Version info: BL(ver, id): 0x01 0x01 SD: 0x0101
    00> <t:       8864>, nrf_mesh_dfu.c,  755, Version info: APP company: 0x00000059 id: 0x0001 version: 0x00000001
    00> <t:       8888>, serial_handler_prov.c,  267, Generating encryption keypair...
    00> <t:      15059>, main.c,  233, Initialization complete!
    00> <t:      21130>, main.c,  254, Enabling serial interface...
    00> <t:      21136>, mesh_app_utils.c,   66, Device UUID (raw): 54A6E2A0FB5B4439B0587E2237798165
    00> <t:      21142>, mesh_app_utils.c,   67, Device UUID : 54A6E2A0-FB5B-4439-B058-7E2237798165
    00> <t:      21162>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 0, count 15, interval: periodic, handle: FFFE
    00> <t:      21171>, nrf_mesh_dfu.c,  593,   SERIAL TX (type: 65534)
    00> <t:      21185>, main.c,  262, DFU example started!
    00> <t:     286030>, nrf_mesh_dfu.c,  418,   New firmware!
    00> <t:     286035>, main.c,   79, DFU type Application
    00> <t:     286040>, main.c,  123, Requesting DFU transfer with bank at 0x00059000
    00> <t:     286046>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 0, count 3, interval: periodic, handle: FFFD
    00> <t:     286054>, nrf_mesh_dfu.c,  565, Killing a TX slot prematurely (repeats done: 1).
    00> <t:     286061>, nrf_mesh_dfu.c,  593,   SERIAL TX (type: 65533)
    00> <t:     352308>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 0, count 3, interval: periodic, handle: FFFD
    00> <t:     352316>, nrf_mesh_dfu.c,  593,   SERIAL TX (type: 65533)
    00> <t:     418519>, nrf_mesh_dfu.c,  411,   Abort event. Reason: 0xC
    00> <t:     418528>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 0, count 15, interval: periodic, handle: FFFE
    00> <t:     418537>, nrf_mesh_dfu.c,  593,   SERIAL TX (type: 65534)
    00> <t:     418544>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 0, count 15, interval: periodic, handle: FFFE
    00> <t:     418551>, nrf_mesh_dfu.c,  565, Killing a TX slot prematurely (repeats done: 0).
    00> <t:     418558>, nrf_mesh_dfu.c,  593,   SERIAL TX (type: 65534)

  • Hi Shahin97,

    I'm sorry but there are several things I am not clear in your description here.

    • What is the blinky binary?
    • What is the DFU binary? Is it the DFU example?
    • What have you flashed on the device prior to the DFU attempt?

    I would also like to know a few info to know how familiar you are with understanding the feature:

    • Have you read the DFU feature documentation thoroughly?

    • Have you successfully run basic DFU example and follow the guide in the feature documentation?
      I recommend you follow the basic example and guide without any modification first to have a good understanding of the feature, before attempting modiifcation and adaptations.

    • Have you examined the "Possible cause" hint given by the serial interface?
      From the two logs you have seen, I think it is likely that the SoftDevice version was not considered correctly in your steps.

    Finally, please be informed that the nRF5 SDK for Mesh is in maintenance mode, and development of new project for it is not recommended.
    Please consider the nRF Connect SDK (NCS). It is true that current version of NCS does not support DFU over Bluetooth Mesh. However, it currently supports DFU over BLE for Mesh device. While this solution is not over Mesh, it is also far faster.

    Hieu

  • Hello,

    Following the link - https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v5.0.0%2Fmd_doc_user_guide_modules_dfu_configuring_performing.html

    The Blinky binary is the binary file in bin/blinky folder as shown in the guide.
    The DFU binary, is the DFU example binary.

    Following this tutorial, I have successfully been able to perform DFU update. However, the the Blinky program does not contain any DFU and so the program cannot be flashed again.

    So my goal is to create an app that can be flashed multiple times. ie My Application + DFU.

    I assumed instead of flashing blinky. I could flash the DFU example again to see if I could reflash it multiple times instead of adding the routines to my application as a quick test (of course remaking the zip with updated application version)

  • Hello,

    I have understood your situation now. It is logical what you want to achieve and the direction you are going.

    Have you checked what I said about the "Possible cause" regarding the SoftDevice version in the commands?
    Another thing that could be wrong here is incorrect application ID or application version used when generating the DFU Package. Please also check that.

    Finally, please consider what I have said about the nRF Connect SDK.

Reply
  • Hello,

    I have understood your situation now. It is logical what you want to achieve and the direction you are going.

    Have you checked what I said about the "Possible cause" regarding the SoftDevice version in the commands?
    Another thing that could be wrong here is incorrect application ID or application version used when generating the DFU Package. Please also check that.

    Finally, please consider what I have said about the nRF Connect SDK.

Children
  • I have noticed that the possible causes are not reliable as it is a generic statement to cover all bases.

    The bootloader & soft devices + dfu are already flashed onto the MCU. the update only flashes the new application not the bootloader or soft devices, the existing bootloader & soft devices remain on the MCU unchanged.  

    The application ID's match and the version is incremented by 1 as stated in the tutorial. 

    Unfortunately BLE MESH DFU is a requirement. 

    My guess would be the size of the update, as the Blinky zip  is considerably smaller than the dfu.zip which could cause an issue, any other suggestions?

  • Sometime the notes are generic, but sometime they are derived from commonly seen problems. Did you also check the SoftDevice version?

    Your nrfutil command set --sd-req to 0x00CB, however, your device log SD version 0x101.

  • I will investigate this, the tutorial uses s132_nrf52_7.2.0_softdevice.hex which is 0x101, but the tutorial also uses sd-req 0x00CB which is 7.0.1. Is this potentially wrong in the tutorial and might need updating?

    I am assuming the blinky went through as it is such a basic example that does not use the softdevice. 

    I will update my parameters and try this. 

    Edit: The update is progressing further, given the slow mesh update, I will update you in 2h 

  • They probably left it unchanged from the nRF5 SDK for Mesh v4.0.0 docs. I will tell the publication team about this. I can't guarantee it will be fixed though, since they leave this note after the 0x00CB reference.

    Failing to match the SoftDevice version requirement parameters will make the device reject the transfer, as its own firmware ID will not match the one in the transfer.

    Did you get through the failure that you originally had though?

  • Unfortunately it has failed. 

    Console:

    DFU upgrade took 6800.59399986s
    Closing serial port...
    
    Closing serial port...
    Device programmed.
     

    RTT

    00> <t:    5588590>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 3, count 3, interval: exponential, handle: FFFC
    00> <t:    5605840>, nrf_mesh_dfu.c,  482,   DFU segment rx: 12834/12836
    00> <t:    5605847>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 4, count 3, interval: exponential, handle: FFFC
    00> <t:    5623075>, nrf_mesh_dfu.c,  482,   DFU segment rx: 12835/12836
    00> <t:    5623082>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 5, count 3, interval: exponential, handle: FFFC
    00> <t:    5640292>, nrf_mesh_dfu.c,  482,   DFU segment rx: 12836/12836
    00> <t:    5640299>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 6, count 3, interval: exponential, handle: FFFC
    00> <t:    8523883>, nrf_mesh_dfu.c,  325, ABORT Timeout fired @-1161806357
    00> <t:    8523889>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 0, count 15, interval: periodic, handle: FFFE
    00> <t:    8523898>, nrf_mesh_dfu.c,  593,   SERIAL TX (type: 65534)
    00> <t:    8523909>, nrf_mesh_dfu.c,  554,   RADIO TX! SLOT 0, count 15, interval: periodic, handle: FFFE
    00> <t:    8523917>, nrf_mesh_dfu.c,  565, Killing a TX slot prematurely (repeats done: 0).
    00> <t:    8523925>, nrf_mesh_dfu.c,  593,   SERIAL TX (type: 65534)

    Time-out occurred after console finished

Related