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

SDK 15.3 DFU with Bonds

need help on multiple things

All work is on the DK 840 board using sdk15.3

Started with this link

https://rigado.zendesk.com/hc/en-us/articles/360025376053-Add-Nordic-DFU-to-a-SDK-Example

I use this for the 15.3 problem and can get things working using the following in the make file

devzone.nordicsemi.com/.../178253

flash_bootloader: default
    @echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa_s140.hex
    nrfjprog -f nrf52 --recover
    nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s140/hex/s140_nrf52_6.1.1_softdevice.hex --chiperase
    nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52840_xxaa_s140.hex -r

I get DfuTarg to work with and without bonds

I can DFU the application only zip file to the DK and all works. After done start scan the the app is working

I move on to buttonless dfu using the rigardo URL above

I create the settings hex files using the rigardo URL above

The following commands do not work in that nothing is advertised.

nrfjprog --recover
nrfjprog --program bl_set_s140_app.hex

issues here:
I figure it is due to the SDK15.3 issue in the second URL used

So I go back to DfuTarg with or without bonds as both work the same.
I then DFU load the zip file that includes the app with the bond/lesc using the ble_app_hrs product.

It again comes up and I bond the device, I then start the DFU action.
The DK tries a couple of times but always disconnects
look at line 70: It shows the DFU starts the firmware file is opened:
line 83 it jumps to the bootloader
line 106 it connects to the dfu target

This is where it always seems to disconnect: This is both using bonded and unbonded BL and app

Question:
How can I get the RTT JLink to post info after the unit disconnects and reconnects when it enters the DFU service started from the app

Also I need to be able to get the settings.hex files to work under sdk15.3

Also I need to understand as to what can cause the DISCONNECTED state when entering the DFU service

Line 107 in the log shows false for autoconnect. I will try setting that to true.

Any help would be appreciated.

Thanks in advance

  • 
    nRF Connect, 2019-11-05 NMS:DFU_2 (F6:AA:31:97:8F:67) I 
    13:50:12.395 [Server] Server started V 
    13:50:12.396 [Server] No services V 
    13:50:12.573 Connecting to F6:AA:31:97:8F:67... D 
    13:50:12.573 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE
    1M) D 13:50:13.482 [Server callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 
    13:50:13.482 [Server] Device with address F6:AA:31:97:8F:67 connected I 
    13:50:13.483 [Server] MTU changed to 185 D
    13:50:13.516 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED D 
    13:50:13.530 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I
    13:50:13.530 Connected to F6:AA:31:97:8F:67 V 
    13:50:13.551 Discovering services... D 
    13:50:13.551 gatt.discoverServices() I 
    13:50:14.253 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 
    13:50:14.551 [Callback] Services discovered with status: 0 I
    13:50:14.551 Services discovered V 13:50:14.578 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) Bond Management (0x181E) - Bond
    Management Feature [R] (0x2AA5) - Bond Management Control Point [E W]
    (0x2AA4) Characteristic Extended Properties (0x2900) Device Information
    (0x180A) - Manufacturer Name String [R] (0x2A29) NMS_SVC
    (0000fe72-0000-1000-8000-00805f9b34fb) - Unknown Characteristic [N W]
    (0000fe73-0000-1000-8000-00805f9b34fb) Client Characteristic Configuration
    (0x2902) - Unknown Characteristic [N R]
    (0000fe74-0000-1000-8000-00805f9b34fb) Client Characteristic Configuration
    (0x2902) D 
    13:50:14.578 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true) D 
    13:50:14.580 gatt.setCharacteristicNotification(0000fe73-0000-1000-8000-00805f9b34fb, true) D 
    13:50:14.582 gatt.setCharacteristicNotification(0000fe74-0000-1000-8000-00805f9b34fb, true) 
    13:50:14.615 Connection parameters updated (interval: 48.75ms, latency: 0, timeout: 5000ms) I 
    13:50:19.890 Connection parameters updated (interval: 648.75ms, latency: 0, timeout: 4000ms) V 
    13:50:20.086 Starting pairing... D 
    13:50:20.086 device.createBond() D 
    13:50:20.114 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11) I 
    13:50:24.432 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 
    13:50:25.094 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDED (12) I 
    13:50:25.094 Device bonded I 
    13:50:25.607 Connection parameters updated (interval: 648.75ms, latency: 0, timeout: 4000ms) I
    13:50:34.112 Connection parameters updated (interval: 648.75ms, latency: 0, timeout: 4000ms) V 
    13:50:35.551 Enabling services... V 
    13:50:35.552 Enabling indications for 00002a05-0000-1000-8000-00805f9b34fb D
    13:50:35.552 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true) D 
    13:50:35.553 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0200) I
    13:50:36.708 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00 A 
    13:50:36.708 "Indications enabled" sent V 13:50:36.725
    Indications enabled for 00002a05-0000-1000-8000-00805f9b34fb V  13:50:36.727
    Enabling indications for 8ec90004-f315-4f60-9fb8-838830daea50 D 13:50:36.727
    gatt.setCharacteristicNotification(8ec90004-f315-4f60-9fb8-838830daea50, true) D 
    13:50:36.739 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0200) I
    13:50:38.004 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00 A 
    13:50:38.005 "Indications enabled" sent V 13:50:38.019 Indications enabled for 8ec90004-f315-4f60-9fb8-838830daea50 V 
    13:50:38.021 Enabling notifications for 0000fe73-0000-1000-8000-00805f9b34fb D
    13:50:38.032 gatt.setCharacteristicNotification(0000fe73-0000-1000-8000-00805f9b34fb, true) D 
    13:50:38.034 att.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100) I
    13:50:39.303 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, alue: (0x) 01-00 A 
    13:50:39.303 "Notifications enabled" sent V
    13:50:39.322 Notifications enabled for 0000fe73-0000-1000-8000-00805f9b34fb
    13:50:39.334 Enabling notifications for 0000fe74-0000-1000-8000-00805f9b34fb D 
    13:50:39.334 gatt.setCharacteristicNotification(0000fe74-0000-1000-8000-00805f9b34fb, true) D 
    13:50:39.336 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100) I
    13:50:40.601 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00 A 
    13:50:40.601 "Notifications enabled" sent V
    13:50:40.615 Notifications enabled for 0000fe74-0000-1000-8000-00805f9b34fb V 
    13:50:40.616 All services enabled V 
    13:50:44.503 [DFU] DFU service started V 13:50:44.503 [DFU] Opening file... I 
    13:50:44.503 [DFU] Firmware file opened successfully V 
    13:50:44.503 [DFU] Connecting to DFU target... D
    13:50:44.503 [DFU] gatt = device.connectGatt(autoConnect = false) I
    13:50:44.503 [DFU] Connected to F6:AA:31:97:8F:67 D 
    13:50:44.503 [DFU] wait(1600) V 13:50:46.103 [DFU] Discovering services... D 
    13:50:46.103 [DFU] gatt.discoverServices() I 
    13:50:46.115 [DFU] Services discovered V
    13:50:46.117 [DFU] Reading Service Changed CCCD value... D 
    13:50:46.118 [DFU] gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb) I
    13:50:47.090 [DFU] Read Response received from descr.00002a05-0000-1000-8000-00805f9b34fb, value (0x): 02-00 A
    13:50:47.090 [DFU] Service Changed indications enabled D 
    13:50:47.121 [DFU] wait(1000) W 13:50:48.113 [DFU] Application with buttonless update found V
    13:50:48.113 [DFU] Jumping to the DFU Bootloader... V 
    13:50:48.113 [DFU] Enabling indications for 8ec90004-f315-4f60-9fb8-838830daea50 D
    13:50:48.113 [DFU] gatt.setCharacteristicNotification(8ec90004-f315-4f60-9fb8-838830daea50, true) D 
    13:50:48.116 [DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00) I
    13:50:49.034 [DFU] Data written to descr.8ec90004-f315-4f60-9fb8-838830daea50, value (0x): 02-00 V
    13:50:49.034 [DFU] Notifications enabled for 8ec90004-f315-4f60-9fb8-838830daea50 A 
    13:50:49.034 [DFU] Indications enabled D 13:50:49.034 [DFU] wait(1000) V 
    13:50:50.056 [DFU] Writing to characteristic 8ec90004-f315-4f60-9fb8-838830daea50 D 
    13:50:50.056 [DFU] gatt.writeCharacteristic(8ec90004-f315-4f60-9fb8-838830daea50) D
    13:50:54.878 [Server callback] Connection state changed with status: 0 and new state: DISCONNECTED (0) I 
    13:50:54.878 [Server] Device disconnected D
    13:50:54.906 [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0) E 
    13:50:54.906 Error 8 (0x8): GATT CONN TIMEOUT I
    13:50:54.906 Disconnected A 
    13:50:54.928 [DFU] Enter bootloader sent (Op Code = 1) I 
    13:50:54.928 [DFU] Disconnected by the remote device D
    13:50:54.928 [DFU] gatt.close() D 
    13:50:54.929 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED D 
    13:50:54.945 [DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED V 
    13:50:54.945 [DFU] DFU service started I 
    13:50:54.945 [DFU] Firmware file opened successfully D
    13:50:54.945 [DFU] wait(1000) D 
    13:50:55.940 [DFU] wait(1000) V
    13:50:56.941 [DFU] Connecting to DFU target... D 
    13:50:56.991 [DFU] gatt = device.connectGatt(autoConnect = false) D 
    13:51:01.979 [Server callback] Connection state changed with status: 0 and new state: DISCONNECTED (0) I
    13:51:01.979 [Server] Device disconnected E 
    13:51:02.001 [DFU] Error 133: Connection timeout D 
    13:51:02.001 [DFU] gatt.close() D 
    13:51:02.011 [DFU] wait(600) D 
    13:51:02.607 gatt.close() D 
    13:51:02.614 wait(200) V
    13:51:02.818 Connecting to F6:AA:31:97:8F:67... D 
    13:51:02.818 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 
    13:51:07.844 [Server callback] Connection state changed with status: 0 and new state: DISCONNECTED (0) I 
    13:51:07.844 [Server] Device disconnected D 
    13:51:07.873 [Callback] Connection state changed with status: 133 and new state: DISCONNECTED (0) E 
    13:51:07.873 Error 133 (0x85): GATT ERROR I 
    13:51:07.874 Disconnected
    
    

  • Hi,

    Could you verify that the bootloader is compiled with the NRF_DFU_BLE_REQUIRES_BONDS option enabled in sdk_config.h? The bootloader will not support bond forwarding otherwise. 

    By the way, the issue mentioned in the thread you linked to is fixed in SDK 16.0.0

  • Please close this as I am too busy to get back to it.  It will be a few months before i need to try it again.  Thanks

  • No problem. Just let me know when you're ready to revisit this issue. 

  • Could you verify that the bootloader is compiled with the NRF_DFU_BLE_REQUIRES_BONDS option enabled in sdk_config.h?

    Hi, 

    Can i continue here with the issue? I am facing something similar and to your question, bootloader does compile but it does not advertise at all unless i disable the bond forwarding support in it. 

    Also, here is something i am having trouble with in SDK 15.3 --> https://devzone.nordicsemi.com/f/nordic-q-a/55705/application-service-uuid-gone-after-secure-ota-dfu

Related