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 Jerry, 

    Could you please let me know which NCS SDK version you are using ? The implementation of smp_svr has been changed lately especially in NCS v2.3.0 and NCS v2.4.0

    When you build smp_svr, did you use the overlay-bt.conf in addition to the prj.conf ? 

    Please be aware that when you build smp_svr it will automatically build MCUBoot as the child image so you don't have to flash anything else in addition. 

    My suggestion is to use a phone to check if the device advertise or not after you flash. You then can use nRF Connect app on the phone to do an DFU update. 
    After you can verify that it works with a phone, then you can continue the test with mcumgr on PC. 

  • Hi Hung,

    My SDK is 2.4.1; toolchain is 2.4.0.

    This is the command I used to build thee smp_svr.

    (.venv) jerry@Ubuntu:~/zephyrproject$ west build \
                -b nrf52840dk_nrf52840 \
                zephyr/samples/subsys/mgmt/mcumgr/smp_svr \
                -- \
                -DEXTRA_CONF_FILE=overlay-bt.conf


    :It sounds like you are assuming I'm building smp_svr under VSCODE; I am following the instructions, which use west command line tools to build mcuboot, and smp_svr in discrete steps.  I don't understand how to do this under VSCODE; the documentation is enigmatic and confusing.  In addition, including the necessary prj.conf statements for mcuboot causes build errors.  If you know how to do it under VSCODE I would prefer to do it that way.

    I did use my iPad to check for the advertisement; The scanner did not display the device.

    Regards,

    Jerry

  • A little update:

    I corrected the length parameter of:

    BT_DATA(BT_DATA_NAME_COMPLETE, "Zephyr_DFU", 8),

    it now reads

    BT_DATA(BT_DATA_NAME_COMPLETE, "Zephyr_DFU", 11),

    I added a little code to blink led0; I am now sure the smp_svr application is up and running.

    Regards,

    Jerry

  • Hi Jerry, 
    Just want to double check, now do you see the smp_svr advertising ? 
    Can you do DFU update via tablet or PC ? 

  • I do not see the device at all on the mobile app.

Related