How do I add a DFU support for nRF Connect SDK in Linux

Hello, 

I'm using Linux (Ubuntu) and I would like to add a DFU support to my app.

Tried to follow Add DFU support to your application but it seems to me that some of the steps really focus on the sample they used in the article.

Additionally, I get an error when trying to add the includes described in the article, so I don't know how to proceed from here.

Advice and tips are welcome :)

Parents Reply Children
  • I will explain what I mean.

    For example, in the last two steps of the "DFU over bluetooth" section (shown below), it seems that these are things related to the sample "ble_dfu_peripheral_lbs" and I don't understand how to do it in any other sample (for example, I want to implement the DFU support it in the blinky sample).

    "

    • Remove the LBS Service UUID from the scan response packet, and replace it with the SMP service UUID:
      BT_DATA_BYTES(BT_DATA_UUID128_ALL,
      		      0x84, 0xaa, 0x60, 0x74, 0x52, 0x8a, 0x8b, 0x86,
      		      0xd3, 0x4c, 0xb7, 0x1d, 0x1d, 0xdc, 0x53, 0x8d),
    • Lastly, add these lines right before bt_conn_cb_register:
      printk("build time: " __DATE__ " " __TIME__ "\n");
      os_mgmt_register_group();
      img_mgmt_register_group();
      smp_bt_register();

    "

  • Hi Matan, 

    If you are getting started I would suggest to try testing on the lbs example (located at \nrf\samples\bluetooth\peripheral_lbs) . 
    After you have tested and managed to do DFU you can start implementing the same to your application. 

    You don't have to add the SMP service UUID to the advertising packet if you don't want to. By adding the SMP service UUID to the advertising packet, it's easier for the app on the phone to detect if it has the DFU support or not. It's optional.
    You can call 
    os_mgmt_register_group();
    img_mgmt_register_group();
    smp_bt_register();

    right after bt_enable() in your code. 

    The blinky example doesn't have BLE support by default so more work need to be done. Please try to base your application on a BLE example. 

  • Thanks, I changed to lbs example.

    For some reason there is a problem with the compilation of the #include "img_mgmt/img_mgmt.h" library.

    Do you know something about it?

  • Hi Matan, 
    How did you install Zephyr ? 
    Could you try to compile using VSCode ? 
    Could you try my example here to see if you have the same problem ? It built with NCS v2.2.0 and worked fine for me. 

    peripheral_lbs_smp.zip

  • First of all, thanks!

    I ran the program, the problem was that the order of the includes was incorrect.
    I changed it and now it works.

    By the way,

    1. Is there a specific guide through which I can understand how to implement BLE support in any program or just i should try and understand it from the peripheral_lbs example?

    2. Is it possible to also do a DFU OTA for the second stage bootloader?
    all the references I saw was old versions.

Related