This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Buttonless DFU with bond not working

Hi,

I'm struggling to get Buttonless DFU with bond enabled working.

Setup details:

1) SDK 14.2

2) DK board - nrf52832

3) nrfconnect app on Android phone (8.0) :

DFU settings = Pkts receipt notification procedure : ON

Number of packets : 10

MBR : 4096

Keep bond information: ON

External MCU DFU : OFF

4) Custom app with bond enabled, BLE_GAP_ADDR_TYPE_RANDOM_STATIC(C1:C1:C1:C1:C1:C1), MITM enabled,

Followed the steps to generate bootloader keys and everything seems to be fine. Flashed SD, BL, APP onto DK board and I can see the app running.

Connected nrfconnect to my custom app, paired succesfully. I can see secure DFU service with Secure buttonless DFU.

After enabling the indication, I write value "0x01" and send to switch to DFU mode. I see device moved to DFU mode but with BD addr = EA:F8:73:D2:B8:CC.

Connected nrfconnect to DfuTarg and if I try to DFU, I think device switches to my custom app and I don't see DFU happening any more.

I'm wondering what would be wrong and I believe encryption fails due to different BD address used in DFU and app mode. What am I missing?

Tried looking into Nordic blogs, dev support but could not move forward. Also, I tried to see the DFU NRF log but I don't see any log messages

All I see on power ON is

<info> µ˜°: Setting vector table to bootloader: 0x00066000
<info> µ˜°: Setting vector table to main app: 0x00023000
<info> µ˜°: Record ID:    0x0001
<info> µ˜°: File ID:    0xF020
<info> µ˜°: Record key:    0x7010

I did used \nRF5_SDK_14.2.0_17b948a\examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc\Makefile with logger enabled and optimization is -O0 in makefile. I'm not sure DFU logger does not show up in RTT viewer.

Attached are the config,make files for reference.

Your help is highly appreciated.

dfu.rarapp.rar

Parents
  • Hi,

    By default, the SoftDevice will use DEVICEADDR[0] and (half of) DEVICEADDR[1] as the MAC address. This will be used by both the bootloader and application unless you explicitly set some other address. If you set another address in your application (why?), then you must do so in the bootloader as well.

    The example without bond sharing however, does not rely on having the same address. In fact, it needs to have a different address and will therefore typically be the default mac address (from  DEVICEADDR) incremented by one.

  • Hi,

    >> If you set another address in your application (why?), 

    To have unique address for different products. After doing as per your suggestion, I could progress little bit but now I get dfu error "Remote DFU error: INVALID OBJECT". I believe it is for Execute Opcode i.e. dfu_decode_commmand() returning false. I see log message in the dfu code as "Handler: Invalid protocol buffer stream". Not sure what I'm missing.

    Attached log file captured.

    Appreciate your help

    nRF Connect, 2018-06-25
    Aquapark_N (C0:C0:C0:C0:C0:C0)
    V	20:24:34.320	Connecting to C0:C0:C0:C0:C0:C0...
    D	20:24:34.321	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	20:24:34.394	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	20:24:34.394	Connected to C0:C0:C0:C0:C0:C0
    D	20:24:34.398	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    V	20:24:34.431	Discovering services...
    D	20:24:34.431	gatt.discoverServices()
    I	20:24:35.204	PHY updated (TX: LE 2M, RX: LE 2M)
    I	20:24:35.657	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	20:24:35.909	[Callback] Services discovered with status: 0
    I	20:24:35.909	Services discovered
    V	20:24:35.943	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    Secure DFU Service (0xFE59)
    - Secure Buttonless DFU [I W] (8ec90004-f315-4f60-9fb8-838830daea50)
       Client Characteristic Configuration (0x2902)
    Unknown Service (003c1520-0000-1000-8000-00805f9b0141)
    - Unknown Characteristic [N R W] (003c1521-0000-1000-8000-00805f9b0141)
       Client Characteristic Configuration (0x2902)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [N R W] (003c1522-0000-1000-8000-00805f9b0141)
       Client Characteristic Configuration (0x2902)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [N R] (003c1523-0000-1000-8000-00805f9b0141)
       Client Characteristic Configuration (0x2902)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [R] (003c1524-0000-1000-8000-00805f9b0141)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [W] (003c1525-0000-1000-8000-00805f9b0141)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [R] (003c1526-0000-1000-8000-00805f9b0141)
    D	20:24:35.943	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	20:24:35.946	gatt.setCharacteristicNotification(8ec90004-f315-4f60-9fb8-838830daea50, true)
    D	20:24:35.949	gatt.setCharacteristicNotification(003c1521-0000-1000-8000-00805f9b0141, true)
    D	20:24:35.952	gatt.setCharacteristicNotification(003c1522-0000-1000-8000-00805f9b0141, true)
    D	20:24:35.956	gatt.setCharacteristicNotification(003c1523-0000-1000-8000-00805f9b0141, true)
    I	20:24:35.986	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	20:24:54.922	Connection parameters updated (interval: 195.0ms, latency: 0, timeout: 10000ms)
    V	20:29:19.059	Disconnecting...
    D	20:29:19.059	gatt.disconnect()
    D	20:29:19.064	[Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
    I	20:29:19.064	Disconnected
    D	20:29:19.861	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	20:29:20.173	gatt.close()
    D	20:29:20.175	wait(200)
    V	20:29:20.379	Connecting to C0:C0:C0:C0:C0:C0...
    D	20:29:20.379	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	20:29:22.217	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	20:29:22.219	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	20:29:22.219	Connected to C0:C0:C0:C0:C0:C0
    V	20:29:22.238	Discovering services...
    D	20:29:22.238	gatt.discoverServices()
    I	20:29:22.667	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	20:29:23.032	[Callback] Services discovered with status: 0
    I	20:29:23.032	Services discovered
    V	20:29:23.064	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    Secure DFU Service (0xFE59)
    - Secure Buttonless DFU [I W] (8ec90004-f315-4f60-9fb8-838830daea50)
       Client Characteristic Configuration (0x2902)
    Unknown Service (003c1520-0000-1000-8000-00805f9b0141)
    - Unknown Characteristic [N R W] (003c1521-0000-1000-8000-00805f9b0141)
       Client Characteristic Configuration (0x2902)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [N R W] (003c1522-0000-1000-8000-00805f9b0141)
       Client Characteristic Configuration (0x2902)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [N R] (003c1523-0000-1000-8000-00805f9b0141)
       Client Characteristic Configuration (0x2902)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [R] (003c1524-0000-1000-8000-00805f9b0141)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [W] (003c1525-0000-1000-8000-00805f9b0141)
       Characteristic User Description (0x2901)
    - Unknown Characteristic [R] (003c1526-0000-1000-8000-00805f9b0141)
    D	20:29:23.065	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	20:29:23.068	gatt.setCharacteristicNotification(8ec90004-f315-4f60-9fb8-838830daea50, true)
    D	20:29:23.071	gatt.setCharacteristicNotification(003c1521-0000-1000-8000-00805f9b0141, true)
    D	20:29:23.073	gatt.setCharacteristicNotification(003c1522-0000-1000-8000-00805f9b0141, true)
    D	20:29:23.075	gatt.setCharacteristicNotification(003c1523-0000-1000-8000-00805f9b0141, true)
    I	20:29:23.131	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    V	20:29:27.322	Enabling indications for 8ec90004-f315-4f60-9fb8-838830daea50
    D	20:29:27.322	gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0200)
    D	20:29:27.566	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    D	20:29:27.582	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_PIN (0)
    I	20:29:27.961	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    I	20:29:32.795	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:32.795	"(0x) C4-09" received
    I	20:29:32.819	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-1A-00-07
    A	20:29:32.819	"(0x) 30-00-00-00-05-06-1A-00-07" received
    D	20:29:33.228	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDED (12)
    I	20:29:33.228	Device bonded
    I	20:29:33.239	Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
    A	20:29:33.240	"Indications enabled" sent
    V	20:29:33.250	Indications enabled for 8ec90004-f315-4f60-9fb8-838830daea50
    I	20:29:33.779	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:33.779	"(0x) C4-09" received
    I	20:29:33.780	Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms)
    I	20:29:33.821	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-1B-00-07
    A	20:29:33.821	"(0x) 30-00-00-00-05-06-1B-00-07" received
    I	20:29:34.776	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:34.776	"(0x) C4-09" received
    I	20:29:34.777	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-1C-00-07
    A	20:29:34.777	"(0x) 30-00-00-00-05-06-1C-00-07" received
    I	20:29:35.805	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:35.806	"(0x) C4-09" received
    I	20:29:35.806	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-1D-00-07
    A	20:29:35.806	"(0x) 30-00-00-00-05-06-1D-00-07" received
    I	20:29:36.799	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:36.799	"(0x) C4-09" received
    I	20:29:36.799	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-1E-00-07
    A	20:29:36.800	"(0x) 30-00-00-00-05-06-1E-00-07" received
    I	20:29:37.789	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:37.789	"(0x) C4-09" received
    I	20:29:37.790	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-1F-00-07
    A	20:29:37.790	"(0x) 30-00-00-00-05-06-1F-00-07" received
    I	20:29:38.816	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:38.816	"(0x) C4-09" received
    I	20:29:38.816	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-20-00-07
    A	20:29:38.816	"(0x) 30-00-00-00-05-06-20-00-07" received
    I	20:29:39.769	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:39.769	"(0x) C4-09" received
    I	20:29:39.769	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-21-00-07
    A	20:29:39.769	"(0x) 30-00-00-00-05-06-21-00-07" received
    I	20:29:40.797	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:40.797	"(0x) C4-09" received
    I	20:29:40.797	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-22-00-07
    A	20:29:40.797	"(0x) 30-00-00-00-05-06-22-00-07" received
    I	20:29:41.823	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:41.823	"(0x) C4-09" received
    I	20:29:41.866	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-23-00-07
    A	20:29:41.866	"(0x) 30-00-00-00-05-06-23-00-07" received
    I	20:29:42.318	Connection parameters updated (interval: 195.0ms, latency: 0, timeout: 10000ms)
    I	20:29:42.903	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:42.903	"(0x) C4-09" received
    I	20:29:42.903	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-24-00-07
    A	20:29:42.903	"(0x) 30-00-00-00-05-06-24-00-07" received
    I	20:29:43.878	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:43.878	"(0x) C4-09" received
    I	20:29:43.878	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-25-00-07
    A	20:29:43.878	"(0x) 30-00-00-00-05-06-25-00-07" received
    I	20:29:44.852	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:44.852	"(0x) C4-09" received
    I	20:29:44.853	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-26-00-07
    A	20:29:44.853	"(0x) 30-00-00-00-05-06-26-00-07" received
    I	20:29:45.827	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:45.827	"(0x) C4-09" received
    I	20:29:45.828	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-27-00-07
    A	20:29:45.828	"(0x) 30-00-00-00-05-06-27-00-07" received
    V	20:29:46.413	[DFU] DFU service started
    V	20:29:46.413	[DFU] Opening file...
    I	20:29:46.420	[DFU] Firmware file opened successfully
    V	20:29:46.420	[DFU] Connecting to DFU target...
    D	20:29:46.422	[DFU] gatt = device.connectGatt(autoConnect = false)
    I	20:29:46.428	[DFU] Connected to C0:C0:C0:C0:C0:C0
    D	20:29:46.431	[DFU] wait(1600)
    I	20:29:46.805	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:46.805	"(0x) C4-09" received
    I	20:29:46.805	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-28-00-07
    A	20:29:46.805	"(0x) 30-00-00-00-05-06-28-00-07" received
    V	20:29:48.032	[DFU] Discovering services...
    D	20:29:48.032	[DFU] gatt.discoverServices()
    I	20:29:48.045	[DFU] Services discovered
    D	20:29:48.067	[DFU] wait(1000)
    I	20:29:48.173	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:48.173	"(0x) C4-09" received
    I	20:29:48.173	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-29-00-07
    A	20:29:48.173	"(0x) 30-00-00-00-05-06-29-00-07" received
    W	20:29:49.417	[DFU] Application with buttonless update found
    V	20:29:49.417	[DFU] Jumping to the DFU Bootloader...
    V	20:29:49.417	[DFU] Enabling indications for 8ec90004-f315-4f60-9fb8-838830daea50
    D	20:29:49.417	[DFU] gatt.setCharacteristicNotification(8ec90004-f315-4f60-9fb8-838830daea50, true)
    D	20:29:49.417	[DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
    I	20:29:49.657	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:49.657	"(0x) C4-09" received
    I	20:29:49.657	[DFU] Data written to descr.8ec90004-f315-4f60-9fb8-838830daea50, value (0x): 02-00
    V	20:29:49.657	[DFU] Notifications enabled for 8ec90004-f315-4f60-9fb8-838830daea50
    I	20:29:49.658	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-2A-00-07
    A	20:29:49.658	"(0x) 30-00-00-00-05-06-2A-00-07" received
    A	20:29:49.674	[DFU] Indications enabled
    D	20:29:49.674	[DFU] wait(1000)
    I	20:29:50.241	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:50.241	"(0x) C4-09" received
    I	20:29:50.242	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-2B-00-07
    A	20:29:50.242	"(0x) 30-00-00-00-05-06-2B-00-07" received
    V	20:29:50.691	[DFU] Writing to characteristic 8ec90004-f315-4f60-9fb8-838830daea50
    D	20:29:50.691	[DFU] gatt.writeCharacteristic(8ec90004-f315-4f60-9fb8-838830daea50)
    I	20:29:51.021	Indication received from 8ec90004-f315-4f60-9fb8-838830daea50, value: (0x) 20-01-01
    A	20:29:51.021	"(0x) 20-01-01" received
    I	20:29:51.030	[DFU] Notification received from 8ec90004-f315-4f60-9fb8-838830daea50, value (0x): 20-01-01
    A	20:29:51.030	[DFU] Enter bootloader sent (Op Code = 1)
    A	20:29:51.030	[DFU] Response received (Op Code = 1, Status = 1)
    I	20:29:51.217	Notification received from 003c1523-0000-1000-8000-00805f9b0141, value: (0x) C4-09
    A	20:29:51.217	"(0x) C4-09" received
    I	20:29:51.217	Notification received from 003c1521-0000-1000-8000-00805f9b0141, value: (0x) 30-00-00-00-05-06-2C-00-07
    A	20:29:51.217	"(0x) 30-00-00-00-05-06-2C-00-07" received
    D	20:29:51.609	[Callback] Connection state changed with status: 19 and new state: DISCONNECTED (0)
    W	20:29:51.609	Connection terminated by peer (status 19)
    I	20:29:51.609	Disconnected
    I	20:29:51.656	[DFU] Disconnected by the remote device
    D	20:29:51.656	[DFU] gatt.close()
    D	20:29:51.656	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	20:29:51.657	[DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    V	20:29:51.667	[DFU] DFU service started
    I	20:29:51.667	[DFU] Firmware file opened successfully
    D	20:29:51.667	[DFU] wait(1000)
    D	20:29:52.665	[DFU] wait(1000)
    V	20:29:53.667	[DFU] Connecting to DFU target...
    D	20:29:53.717	[DFU] gatt = device.connectGatt(autoConnect = false)
    D	20:29:54.815	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	20:29:54.816	[DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    I	20:29:54.818	[DFU] Connected to C0:C0:C0:C0:C0:C0
    D	20:29:54.825	[DFU] wait(1600)
    V	20:29:56.426	[DFU] Discovering services...
    D	20:29:56.427	[DFU] gatt.discoverServices()
    I	20:29:56.434	[DFU] Services discovered
    D	20:29:56.459	[DFU] wait(1000)
    V	20:29:57.494	[DFU] Requesting new MTU...
    D	20:29:57.494	[DFU] gatt.requestMtu(517)
    I	20:29:57.561	[DFU] MTU changed to: 23
    V	20:29:57.561	[DFU] Enabling notifications for 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:29:57.561	[DFU] gatt.setCharacteristicNotification(8ec90001-f315-4f60-9fb8-838830daea50, true)
    D	20:29:57.561	[DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	20:29:57.621	[DFU] Data written to descr.8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 01-00
    V	20:29:57.621	[DFU] Notifications enabled for 8ec90001-f315-4f60-9fb8-838830daea50
    A	20:29:57.621	[DFU] Notifications enabled
    D	20:29:57.621	[DFU] wait(1000)
    V	20:29:58.664	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:29:58.664	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:29:58.790	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-06-01-00-01-00-00-00-00-00-00-00-00-00-00
    I	20:29:58.790	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-06-01-00-01-00-00-00-00-00-00-00-00-00-00
    A	20:29:58.790	[DFU] Command object info received (Max size = 256, Offset = 0, CRC = 00000000)
    V	20:29:58.790	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:29:58.790	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:29:58.880	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-02-01
    I	20:29:58.881	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-02-01
    A	20:29:58.881	[DFU] Packet Receipt Notif disabled (Op Code = 2, Value = 0)
    V	20:29:58.882	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:29:58.882	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:29:58.968	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 01-01-87-00-00-00
    I	20:29:58.968	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-01-01
    A	20:29:58.968	[DFU] Command object created
    V	20:29:58.969	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:29:58.969	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:29:58.970	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): 12-84-01-0A-3E-08-01-12-3A-08-02-10-34-1A-02-9D-01-20-00-28
    V	20:29:58.970	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:29:58.970	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:29:58.971	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): 00-30-00-38-BC-EA-04-42-24-08-03-12-20-79-59-EA-80-6B-E0-33
    V	20:29:58.971	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:29:58.971	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:29:58.972	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): 2D-33-2F-3B-DD-60-92-A7-0F-52-B7-4B-D8-34-E5-31-CD-06-D2-D3
    V	20:29:58.972	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:29:58.972	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:29:58.974	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): C7-A5-54-70-B1-48-00-10-00-1A-40-A9-66-C0-27-A3-26-B7-5A-CB
    V	20:29:58.974	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:29:58.974	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:29:58.981	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): 55-78-E0-E7-69-5A-4A-5E-D8-54-DF-A6-23-11-56-40-88-A5-B9-92
    V	20:29:58.981	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:29:58.981	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:29:58.983	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): EA-43-E1-7A-8E-84-FB-7F-CF-50-B5-8C-E2-B9-A5-11-94-F4-CF-C9
    V	20:29:58.983	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:29:58.983	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:29:58.988	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): B5-79-4B-19-28-4D-9D-16-4B-D4-BF-72-EE-15-60
    A	20:29:58.989	[DFU] Command object sent (CRC = 2D2E7274)
    V	20:29:58.989	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:29:58.989	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:29:59.106	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-03-01-87-00-00-00-74-72-2E-2D
    I	20:29:59.106	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-03-01-87-00-00-00-74-72-2E-2D
    A	20:29:59.106	[DFU] Checksum received (Offset = 135, CRC = 2D2E7274)
    V	20:29:59.106	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:29:59.106	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:29:59.197	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 04
    I	20:29:59.418	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-04-05
    E	20:29:59.422	[DFU] Remote DFU error: INVALID OBJECT
    V	20:29:59.422	[DFU] Disconnecting...
    D	20:29:59.463	[DFU] gatt.disconnect()
    I	20:29:59.463	[DFU] Disconnected
    D	20:29:59.463	[DFU] gatt.close()
    D	20:29:59.463	[DFU] wait(600)
    D	20:30:00.040	gatt.close()
    D	20:30:00.044	wait(200)
    V	20:30:00.246	Connecting to C0:C0:C0:C0:C0:C0...
    D	20:30:00.246	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	20:30:00.258	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	20:30:00.258	Connected to C0:C0:C0:C0:C0:C0
    D	20:30:00.259	wait(1600ms)
    V	20:30:01.860	Discovering services...
    D	20:30:01.860	gatt.discoverServices()
    D	20:30:01.864	[Callback] Services discovered with status: 0
    I	20:30:01.864	Services discovered
    V	20:30:01.880	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    - Service Changed [I] (0x2A05)
       Client Characteristic Configuration (0x2902)
    Secure DFU Service (0xFE59)
    - DFU Packet [WNR] (8ec90002-f315-4f60-9fb8-838830daea50)
    - DFU Control Point [N W] (8ec90001-f315-4f60-9fb8-838830daea50)
       Client Characteristic Configuration (0x2902)
    D	20:30:01.880	gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
    D	20:30:01.883	gatt.setCharacteristicNotification(8ec90001-f315-4f60-9fb8-838830daea50, true)
    D	20:32:03.596	[Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
    E	20:32:03.596	Error 8 (0x8): GATT CONN TIMEOUT
    I	20:32:03.596	Disconnected
    D	20:32:03.610	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    

  • Hello,

    I managed to get the buttonless_dfu working the following way:

    • Generate bootloader with your own private and public key pair.
    • flash bootloader and softdevice
    • flash buttonless_dfu
    • generate bootloader settings (with --application-version 1)
    • flash bootloader settings
    • reset the device
    • connect to the buttonless_dfu device in nRF Connect
    • perform bonding in the app
    • perform the DFU procedure with --application-version 2

     

    I haven't seen your application.

    Have you set NRF_DFU_BLE_REQUIRES_BONDS to 1 in sdk_config.h for the bootloader_seure_ble project?

    Have you set NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS 1 in sdk_config for the ble_app_buttonless_dfu project?

     

    Best regards,

    Edvin

  • Hi Edvin,

    Please see the attached zip files which contains sdk_config.h/makefile for bootloader and application.

    Also, I think you have tried with default buttonless_dfu app. Could you try with static random address with MITM enabled please. I given these details in first thread.

    It would be great if you follow the steps I'm using in app makefile for flashing SD,BL,APP.

    Not sure if I'm missing something.

    Regards

    Suresh

  • But I don't have your application. Can you please upload the full project, then I may test it. I assume that you haven't changed anything in the bootloader? So I can combine the sdk_config for the bootloader with the bootloader project in the SDK.

     

    But please upload the application that you have modified.

    BR,

    Edvin

  • Hi Edvin,

    The application has IP in it but anyway I will try to remove the IP part and I can share it if you make this thread private please.

    In bootloader I have changed to take the static random address and I will share this part as well.

    Thank you

    Regards

    Suresh

  • Hello,

    You can send me a PM.

    I suspect that there is something wrong in the setup of the Buttonless_DFU service (After you changed the application-version to 1 higher than the currently running application).

     

    BR,

    Edvin

Reply Children
  • Hi,

    Attached is the APP. U need to run the batch file(part of .rar) to burn UICR before flashing program.

    Expecting your reply.

    Regards

    Suresh

    power_strip.rar

  • I will not have time to look at your application today. We are a bit short staffed these days. What you can do in the meantime is to start with a standard case of buttonless_dfu with bonding, as I described in a previous post, and try to change one thing at the time, and see where it fails. You have a better overview than me what changes you have done. I suspect that there are some issues in the way that the address is changed. Maybe the board performing the DFU doesn't look for the correct address? What happens if you don't change the address?

     

    BR,

    Edvin

  • All I did in bootloader and app is changed the BD address to static random instead of default one. If bootloader address is default i can't dfu because application is bonded with static random address.

    Mean time will try with default button less app as suggested.

    I will wait for your inputs.

    Thank you

    Regards

    Suresh

  • Hello,

    Have you changed the address in the bootloader like you did in the application in file ble_app.c on line 545-548?

    If you have, can you send the bootloader project as well, so I can replicate the error?

     

    Edit:

    I tried to change the address like you did in the bootloader project (hard coded), and now the DFU worked. Not an elegant fix, but you can do this for testing. In the file nrf_ble_dfu.c in the bootloader_secure_ble project, change the gap_params_init() function to the following:

    static uint32_t gap_params_init(void)
    {
        uint32_t                err_code;
        ble_gap_conn_params_t   gap_conn_params = {0};
        ble_gap_conn_sec_mode_t sec_mode;
        uint8_t const *         device_name;
        uint32_t                name_len;
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
    
    #if !defined(NRF_DFU_BLE_REQUIRES_BONDS) || (NRF_DFU_BLE_REQUIRES_BONDS == 0)
    
        err_code = gap_address_change();
        VERIFY_SUCCESS(err_code);
    
        if ((m_flags & DFU_BLE_FLAG_USE_ADV_NAME) != 0)
        {
            NRF_LOG_DEBUG("Setting adv name: %s, length: %d", (uint32_t)m_adv_name.name, m_adv_name.len);
            device_name = m_adv_name.name;
            name_len = m_adv_name.len;
        }
        else
    #endif
        {
            NRF_LOG_DEBUG("Regular adv name");
            device_name = (uint8_t const *)DEVICE_NAME;
            name_len = strlen(DEVICE_NAME);
        }
        ble_gap_addr_t addr;
        sd_ble_gap_addr_get(&addr);
        for (int i=0; i<6; i++)
        {
            addr.addr[i] = 0xC0;
        }
        err_code = sd_ble_gap_addr_set(&addr);
        VERIFY_SUCCESS(err_code);
    
        err_code = sd_ble_gap_device_name_set(&sec_mode, device_name, name_len);
        VERIFY_SUCCESS(err_code);
    
        gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
        gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
        gap_conn_params.slave_latency     = SLAVE_LATENCY;
        gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;
    
        err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
        return err_code;
    }

     

    If that works, read out the address from the register, as you do in the app that you sent me.

    The problem for me was that the bootloader didn't use the custom address, and started advertising as DfuTarg with a random address, so the kit that performed the DFU with nRF Connect couldn't find the bootloader board (because it doesn't expect it to change address if bonding is required).

     

    Best Regards,

    Edvin

  • ble_dfu.rar

    Hi,

    I did changes as per your suggestion but still I see GATT WRITE ERROR.

    V             06:03:45.817      [DFU] Enabling indications for 8ec90004-f315-4f60-9fb8-838830daea50

    D            06:03:45.817      [DFU] gatt.setCharacteristicNotification(8ec90004-f315-4f60-9fb8-838830daea50, true)

    D            06:03:45.819      [DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)

    E             06:03:45.891      [DFU] Error (0x03): GATT WRITE NOT PERMIT

    V             06:03:45.891      [DFU] Disconnecting...

    D            06:03:45.913      [DFU] gatt.disconnect()

    I              06:03:45.913      [DFU] Disconnected

    D            06:03:45.913      [DFU] gatt.close()

    My steps(used pca10040_debug of BL):

    After building app, bootloader I use "flash_sd_bl_app" command from makefile to flash a fresh chip i.e. SD + BL + APP at one go.

    I change the APP_VERSION to 2, re-build app and generate DFU package using "generate_dfu_pkg" command from makefile.

    I connect nrfconnect from Android phone to device, pair, click on DFU icon and choose the generted dfu package (from above). I see GATT WRITE ERROR as above(check attached dfu_bond.docx file for more info).

    Could you let me the detailed steps using Android phone if you succeed in getting DFU working.

    I'm wondering if I'm doing something stupid.

    Thank you

Related