DFU for external BLE Sensor

Hi,

  I have a current project that is based on the nRf52840.  This project acts both as a peripheral and a central.  I have a need to update the firmware on a remote BLE sensor using DFU, i.e., I need to do exactly what the nRfConnect application does when it updates a peripheral firmware via DFU.  My thought was to use the nRf52840 dongle and develop this code on my PC and then port it to my embedded system.  I also thought the best starting point would be the source code for the nRfConnect application which I would port it but I see from user comments that nordic did not release the source code for this.  Is it possible to get this source code or is there another example that demonstrates what I need to accomplish?

Thanks!

  • Hi,

    I do not immediately see any issues with the code you have posted. Would you mind posting the rest so I can try to debug it here?

    Thanks,

    Vidar

  • Hi,

      I bought a nRF52840 development kit so I could put my code in a project that you can debug.  I have attached the code.  It came from this directory which shoulkd provide the exact sdk I am using: C:\nRF5_SDK_17.0.2_d674dde\examples\ble_central My_ble_app_blinky_c.zip

    The BT610 device I am connecting to uses coded PHY.  I added a #define SCAN_FOR_CODED_PHY_DEVICES 1

    to enable scanning coded PHY devices, you can set that #define to 0 if the SMP device you will be connecting to does not use coded PHY.  Here is the output I am getting while running under the debugger...

    <info> app: Soft Device Ver: 10, SubVer: 0x100
    <info> app: on_adv_report()
    <info> app: Found BT610 we are looking for
    <info> app: dev_name.size: 5
    <info> app: Device Name: BT610Ô
    <info> app: ble_evt_handler, p_ble_evt->header.evt_id: 16
    <info> app: Connected.
    <info> app: call to ble_lbs_on_db_disc_evt for instance 0 and link 0x0!
    <info> app: p_evt->evt_type: 2, p_evt->params.err_code: 141570
    <info> app: p_evt->params.discovered_db.srv_uuid.uuid: 0x2902
    <info> app: p_evt->params.discovered_db.srv_uuid.type: 0x2
    <info> app: p_evt->params.discovered_db.char_count: 0
    <info> app: call to ble_lbs_on_db_disc_evt for instance 0 and link 0x0!
    <info> app: p_evt->evt_type: 3, p_evt->params.err_code: 536878616
    <info> app: p_evt->params.discovered_db.srv_uuid.uuid: 0x1E18
    <info> app: p_evt->params.discovered_db.srv_uuid.type: 0x0
    <info> app: ble_evt_handler, p_ble_evt->header.evt_id: 31
    <info> app: ble_evt_handler, p_ble_evt->header.evt_id: 18

    My goal right now is to discover the SMP characteristic that I can then use to write to.

    Thanks...

  • Hi,

      Just a little more information.  The sensor I am connecting to is a BT610 by Laird.  The BT610 firmware is built upon the Zephyr RTOS. Zephyr incorporates a complete device management subsystem. This is based upon Apache’s MCU Manager. The transport protocol defined by MCU Manager, the Simple Management Protocol (SMP) is used as the underlying protocol for all transport layers.  I can do a firmware upgrade of the sensor DFU over SMP using the nrfConnect application on my android.  I am definitely missing something, I can connect to the sensor but the discovery isn't completing successfully, that is what I need help with.

  • Hello,

    Thank you for your patience. I could not find any references to your SMP Client implementation inside the project you uploaded so I started a new project instead, please see attached. This is based on the ble_app_hrs_c example and the Nordic UART client service for the SMP implementation. I chose this example as a starting point because it already includes the peer manager module (adds bonding support) in case the Laird module requires authentication for the SMP service.

    I quickly tested this app against Zephyr's SMP sample here: SMP Server Sample using the default configuration with no authentication requirement and 1M PHY and verified that the attribute handles were assigned correctly.

    Some additional notes:

     - I set the scan filter to filter on the SMP UUID in the advertisment packet. You may add a new filter if you wish to filter on the device name instead.

    - NRF_BLE_SCAN_SCAN_PHY must be set to '4' in sdk_config.h to scan on CODED_PHY

    - The device will issue a bonding/security request upon connection if you set the SECURE_CONNECTION flag at the beginning of main.c

    - There are still missing pieces in the implementation. I mostly focused on the service discovery part. I expect any notifications from the SMP server to arrive in the BLE_SMP_C_EVT_SMP_TX_EVT event.

    Attachment (Note: requires nRF5 SDK 17.1.0 to build)

    ble_app_smp_c.zip

  • Thanks!!!   You are AWESOME!!  Now I can send and receive data and can actually start on the real implementation!  I may have more questions but now I have a great starting point...

Related