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
    

  • The GATT_WRITE issue was because Android_8.0 app doesn't refresh the service discovery when switching to DFU mode and this can be resolved by clicking on refresh item.

  • Hello,

    Sorry. I was out of office the previous week. I see that you have been working a bit on this. I assume from your last reply that it is working now. Is that correct?

     

    Best regards,

    Edvin

  • Hi Edvin,

    The GATT_WRITE issue is resloved but I still see the INVALID_OBJECT. please see the above digest for more details.

    Regards

    Suresh

  • Hello,

    I understand.

    Yes. 0x9D is the correct sd-req. You can see the list of the different softdevices by typing the command:

    "nrfutil pkg generate --help".

     

    In the project that I sent you I used your project, and the bootloader found in SDK14.2.0\examples\dfu\bootloader_secure_ble\pca10040\arm5_no_packse.

    The only changes are:

    in sdk_config.h: #define NRF_DFU_BLE_REQUIRES_BONDS 1

    and the gap_params_init() function, as described above, to change the address when the bootloader starts.

    INVALID_OBJECT means that the DFU packet that you are sending is not accepted by the bootloader. The reasons for this is usually that it has used a wrong signing key (private.key), wrong hw-version, wrong sd-req or insufficient application-version.

     

    It seems like the hw-version, sd-req is correct. I assume that you use the same private.key as you use without bonding, so I assume that it is correct as well.

    This leaves the application-version.

     

    Do you use the same keyset with your bootloader with and without bonding? If not, are you sure you are not mixing them up?

     

    The difference when you require bonding and when you don't require bonding is that you need to store some bootloader settings that accepts the first application, which is required for bonding with the device that is going to perform the DFU transfer. This is not needed in DFU without bonding, because you can start directly in bootloader mode, without having any bonding information stored.

     

    I tested your files (my_bin.rar) with my bootloader(changed the private.key to the one you included). Then flashed the sd_bl_app_merged.hex file, and the bootloader_settings.hex-file (I also tried without. Didn't know whether it was merged in the other file).

    I also get the INVALID_OBJECT message. What application-version do you use in your bootloader_settings file? Have you changed anything else in the bootloader, other than what we have discussed? 

     

    BR,

    Edvin


  • >> In the project that I sent you I used your project, and the bootloader found in SDK14.2.0\examples\dfu\bootloader_secure_ble\pca10040\arm5_no_packse.
    Could you try with "nRF5_SDK_14.2.0_17b948a\examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc" with sdk_dfu_config.h file attached in my_dfu.zip please.

    >> It seems like the hw-version, sd-req is correct. I assume that you use the same private.key as you use without bonding, so I assume that it is correct as well.
    I generated the private.key, public_key.c, building micro-ecc library file afresh using below commands(all these runs in batch file)

       nrfutil.exe keys generate private.key
       nrfutil keys display --key pk --format code private.key --out_file public_key.c

       cd C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\external\micro-ecc\nrf52hf_armgcc\armgcc
       rm -r _build
       make
       
       copy C:\Data\Project\Device\repository\device\nordic\tools\public_key.c C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\examples\dfu\dfu_req_handling\public_key.c

       cd C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc
       rm -r _build
       make

    >> Do you use the same keyset with your bootloader with and without bonding? If not, are you sure you are not mixing them up?
    I usually clean up the old keys to not confuse with stray files. So, it is always fresh set key-pairs.
     
    >> The difference when you require bonding and when you don't require bonding is that you need to store some bootloader settings that accepts the first application,
    What bootloader settings I might have missed?

    >> I also get the INVALID_OBJECT message. What application-version do you use in your bootloader_settings file?  
    When sd_bl_app_merged.hex is generated application-version = 1 and when generating dfu package it is 2. You can verify with nrfutil display command for confirmation.

    The way sd_bl_app_merged.hex file generated is as below (you can also generate using my app makefile command flash_sd_bl_app)

    nrfutil settings generate --family NRF52 --application C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\nrf52832_xxaa.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex
    Generated Bootloader DFU settings .hex file and stored it in: C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex

    Bootloader DFU Settings:
    * File:                 C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex
    * Family:               nRF52
    * Start Address:        0x0007F000
    * CRC:                  0x539861AA
    * Settings Version:     0x00000001 (1)
    * App Version:          0x00000001 (1)
    * Bootloader Version:   0x00000001 (1)
    * Bank Layout:          0x00000000
    * Current Bank:         0x00000000
    * Application Size:     0x00012D44 (77124 bytes)
    * Application CRC:      0xEEC9D449
    * Bank0 Bank Code:      0x00000001

    mergehex --merge C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc\_build\nrf52832_xxaa_s132.hex  --output C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_merged.hex
    Parsing input hex files.
    Merging files.
    Storing merged file.
    mergehex --merge C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\components\softdevice\s132\hex\s132_nrf52_5.0.0_softdevice.hex C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_merged.hex C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\nrf52832_xxaa.hex --output C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\sd_bl_app_merged.hex
    Parsing input hex files.
    Merging files.
    Storing merged file.

    DFU package is generated as below

    nrfutil pkg generate --hw-version 52 --sd-req 0x9d --application-version 1 --application C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\nrf52832_xxaa.hex  --key-file C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\private.key C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\app_dfu_package.zip
    Zip created at C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\app_dfu_package.zip

    I suggest you try with gcc version and please use my app makefile commands to generate sd_bl_app_merged.hex and app_dfu_package.zip so that we are in sync(ignore this line if you are already doing it)

    >> Have you changed anything else in the bootloader, other than what we have discussed?
    I have attached all the files which I changed in bootloader but I believe those should not cause this issue.

    Regards
    Suresh
    my_dfu.zip

Reply

  • >> In the project that I sent you I used your project, and the bootloader found in SDK14.2.0\examples\dfu\bootloader_secure_ble\pca10040\arm5_no_packse.
    Could you try with "nRF5_SDK_14.2.0_17b948a\examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc" with sdk_dfu_config.h file attached in my_dfu.zip please.

    >> It seems like the hw-version, sd-req is correct. I assume that you use the same private.key as you use without bonding, so I assume that it is correct as well.
    I generated the private.key, public_key.c, building micro-ecc library file afresh using below commands(all these runs in batch file)

       nrfutil.exe keys generate private.key
       nrfutil keys display --key pk --format code private.key --out_file public_key.c

       cd C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\external\micro-ecc\nrf52hf_armgcc\armgcc
       rm -r _build
       make
       
       copy C:\Data\Project\Device\repository\device\nordic\tools\public_key.c C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\examples\dfu\dfu_req_handling\public_key.c

       cd C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc
       rm -r _build
       make

    >> Do you use the same keyset with your bootloader with and without bonding? If not, are you sure you are not mixing them up?
    I usually clean up the old keys to not confuse with stray files. So, it is always fresh set key-pairs.
     
    >> The difference when you require bonding and when you don't require bonding is that you need to store some bootloader settings that accepts the first application,
    What bootloader settings I might have missed?

    >> I also get the INVALID_OBJECT message. What application-version do you use in your bootloader_settings file?  
    When sd_bl_app_merged.hex is generated application-version = 1 and when generating dfu package it is 2. You can verify with nrfutil display command for confirmation.

    The way sd_bl_app_merged.hex file generated is as below (you can also generate using my app makefile command flash_sd_bl_app)

    nrfutil settings generate --family NRF52 --application C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\nrf52832_xxaa.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex
    Generated Bootloader DFU settings .hex file and stored it in: C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex

    Bootloader DFU Settings:
    * File:                 C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex
    * Family:               nRF52
    * Start Address:        0x0007F000
    * CRC:                  0x539861AA
    * Settings Version:     0x00000001 (1)
    * App Version:          0x00000001 (1)
    * Bootloader Version:   0x00000001 (1)
    * Bank Layout:          0x00000000
    * Current Bank:         0x00000000
    * Application Size:     0x00012D44 (77124 bytes)
    * Application CRC:      0xEEC9D449
    * Bank0 Bank Code:      0x00000001

    mergehex --merge C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_setting.hex C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc\_build\nrf52832_xxaa_s132.hex  --output C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_merged.hex
    Parsing input hex files.
    Merging files.
    Storing merged file.
    mergehex --merge C:\Data\Project\Device\SDK\nordic\nRF5_SDK_14.2.0_17b948a\components\softdevice\s132\hex\s132_nrf52_5.0.0_softdevice.hex C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\bootloader_merged.hex C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\nrf52832_xxaa.hex --output C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\sd_bl_app_merged.hex
    Parsing input hex files.
    Merging files.
    Storing merged file.

    DFU package is generated as below

    nrfutil pkg generate --hw-version 52 --sd-req 0x9d --application-version 1 --application C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\nrf52832_xxaa.hex  --key-file C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\private.key C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\app_dfu_package.zip
    Zip created at C:\Data\Project\Device\repository\device\nordic\gcc\power_strip\_build\app_dfu_package.zip

    I suggest you try with gcc version and please use my app makefile commands to generate sd_bl_app_merged.hex and app_dfu_package.zip so that we are in sync(ignore this line if you are already doing it)

    >> Have you changed anything else in the bootloader, other than what we have discussed?
    I have attached all the files which I changed in bootloader but I believe those should not cause this issue.

    Regards
    Suresh
    my_dfu.zip

Children
No Data
Related