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

  • 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
  • Hi Hung,

    You will have to forgive me; I have read the documentation a 1000 times; I don't understand it; it if full of buzz words which are not defined and I can't figure out what it is talking about.

    This is what I see:

    Images:
     image=0 slot=0
        version: 0.0.0
        bootable: true
        flags: active confirmed
        hash: ea9c889031e33c8c9c500e00e8ed94454f536368c499c186688f323a48f973b4
     image=0 slot=1
        version: 0.0.0
        bootable: true
        flags: pending
        hash: 582ef2530f15968c39513443f312418a0179dac2050b1146bd727467df042564
    Split status: N/A (0)

    As you can see I have two images. I presume one is my smp_svr application and one is my binky application; I don't know which is which.

    I don't know how this works; I have uploaded my blinky image, apparently, successfully.  From your comments above I need to do two additional steps in order to get my blinky application running.  In order to do that I need to specify the <hash>, of which I have two; which should I use?

    Let us suppose that I have my blinky application up and running and I want to update it; how do I do that if the smp_svr is no longer active?

    Regards,

    Jerry

Related