DFU BLE bootloader doesn't seem to work

I am trying to implement the smp_svr example as described here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html.

I have successfully built and flashed the MCU bootloader. (to a nRF52840dk)

I have successfully built, the mcumgr.

I have successfully built, signed, and flashed the smp_svr.

At this point I looked at my nRF_CONNECT_FOR_MOBILE scanner but I do not see the device.

I modified the smp_svr bluetooth.c as follows:

/*
static const struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
BT_DATA_BYTES(BT_DATA_UUID128_ALL,
0x84, 0xaa, 0x60, 0x74, 0x52, 0x8a, 0x8b, 0x86,
0xd3, 0x4c, 0xb7, 0x1d, 0x1d, 0xdc, 0x53, 0x8d),
};
*/
static const struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
BT_DATA_BYTES(BT_DATA_UUID128_ALL,
0x84, 0xaa, 0x60, 0x74, 0x52, 0x8a, 0x8b, 0x86,
0xd3, 0x4c, 0xb7, 0x1d, 0x1d, 0xdc, 0x53, 0x8d),
BT_DATA(BT_DATA_NAME_COMPLETE, "Zephyr_DFU", 8),
};

This I did because I was unsure what the default advertising name was.

I then rebuilt, resigned, and re-flashed.

I still did not see the the device on my scanner.

When I attempt to flash with mcumgr It doesn't connect.

sudo ~/go/bin/mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name='Zephyr' echo hello
hello
Error: Failed to connect to peer after 10s

and

sudo ~/go/bin/mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name='ZephyrDFU' echo hello
Error: Failed to connect to peer after 10s

This suggests to me the smp_svr program isn't working correctly.

I'm not sure where to go with this, any suggestions?

Regards,

Jerry

Parents Reply Children
  • Hi Hung,

    I have (I think) gotten the smp_svr sample working correctly. I have established a serial connection under vscode and it will interact with me.  However, I have modified both the blinky and hello_world sample applications to upload to the smp_svr via ble.  I get the following message: "[00:02:31.535,949] <inf> smp_bt_sample: Disconnected (reason 0x13)" from the smp_svr.  I suspect that I have not correctly configured the apps I am trying to upload.

    This is my prj.conf for blinky:

    CONFIG_GPIO=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_MCUBOOT_SIGNATURE_KEY_FILE=""

    This is the serial log file at reset

    uart:~$ *** Booting Zephyr OS build v3.3.99-ncs1-1 ***
    [00:00:00.006,927] <inf> bt_hci_core: Identity: C7:28:33:33:F4:D5 (random)
    [00:00:00.006,958] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x1077, manufacturer 0x0059
    [00:00:00.006,988] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x1077
    [00:00:00.007,904] <inf> smp_bt_sample: Advertising successfully started

    In a terminal, I entered my upload command:

    (.venv) jerry@Ubuntu:~/zephyrproject$ sudo ~/go/bin/mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name='Zephyr' image upload ~/MyApps/blinky/build_dk/zephyr/app_update.bin
     23.03 KiB / 23.03 KiB [=====================================================================================================================] 100.00% 9.22 KiB/s 2s
    Done

    The serial log responded with:

    [00:00:00.007,965] <inf> smp_sample: build time: Aug 15 2023 05:04:51
    [00:01:52.927,215] <inf> smp_bt_sample: Connected
    [00:01:53.752,197] <inf> mcumgr_img_grp: Erased 0x6000 bytes of image slot
    [00:01:53.849,670] <inf> mcumgr_img_grp: Erased 0x1000 bytes of image slot trailer
    [00:01:55.670,562] <inf> smp_bt_sample: Disconnected (reason 0x13)
    [00:01:55.672,058] <inf> smp_bt_sample: Advertising successfully started

    The blinky application, apparently, was not started; (led0 not blinking).

    Do you have any ideas?

    Regards,

    Jerry

  • Hi Hung,

    Just a side note:

    I tried to build smp_svr with a board, nreff52840dongle_nrf52840, I get a build error:

    [74/140] Building C object modules/nrf/subsys/bluetooth/controller/CMakeFiles/..__nrf__subsys__bluetooth__controller.dir/hci_driver.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /home/jerry/ncs/toolchains/1f9b40e71a/usr/local/bin/cmake --build /home/jerry/MyApps/smp_svr/build_dongle

    There seems to be some kind of issue with dongles and bootloaders: do you know anything about it? 

    Regards,

    Jerry

  • Hi Jerry, 

    Please try to do FOTA update with your tablet before you try with the mcumgr. You can use nRF Connect or nRF Device Manager to do update. 

    For a FOTA process to complete you would need to either test or confirm the new image (confirm is done automatically in the app on the tablet)

    Please take a look at the documentation here: https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html

    For test (only run new image once then revert back to original application) you need to do: 

    mcumgr <connection-options> image test <hash> 

    + a reset

    For confirm (permanently switch the imag) you need to call: 

    mcumgr <connection-options> image confirm <hash> 

    + a reset.

     

  • What is the <hash> item and how do I obtain it?

    Jerry

  • Hi Jerry, 
    Please read the documentation.
     https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html
    You will see the hash when you call 

    mcumgr <connection-options> image list
Related