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

Android NRFConnect doesn't discover bootloader services

Hi all,

I'm having trouble getting the buttonless DFU using the android version of NRF connect v 4.10.0 to work reliably. I have previously had it working reliably but with the previous version of the app. I am using an NRF52 and SDK 12.1.0 with s332.

Steps to produce:

  1. Program combined SD v BL and APP to board.
  2. Connect to device
  3. (Optional) enable services by pressing the menu button. This doesn't change my result
  4. Press the DFU icon and select an application zip to upload

The android app connects to the bootloader, and the Graph pops up but hangs on "Connecting..."

The debug log of the NRF52 application connection is

nRF Connect, 2017-03-31
RL (E1:C7:FD:12:E8:68)
V	14:56:23.222	Connecting to E1:C7:FD:12:E8:68...
D	14:56:23.222	gatt = device.connectGatt(autoConnect = false)
D	14:56:23.763	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D	14:56:23.766	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I	14:56:23.766	Connected to E1:C7:FD:12:E8:68
D	14:56:23.766	wait(600ms)
V	14:56:24.372	Discovering services...
D	14:56:24.372	gatt.discoverServices()
D	14:56:24.399	[Callback] Services discovered with status: 0
I	14:56:24.401	Services discovered
V	14:56:24.429	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)
Device Information (0x180A)
- Manufacturer Name String [R] (0x2A29)
- Model Number String [R] (0x2A24)
- Serial Number String [R] (0x2A25)
- Hardware Revision String [R] (0x2A27)
- Firmware Revision String [R] (0x2A26)
Experimental Buttonless DFU Service (8e400001-f315-4f60-9fb8-838830daea50)
- Experimental Buttonless DFU [N W] (8e400001-f315-4f60-9fb8-838830daea50)
   Client Characteristic Configuration (0x2902)
V	14:56:30.653	[DFU] DFU service started
V	14:56:30.653	[DFU] Opening file...
I	14:56:30.669	[DFU] Image file opened (51752 bytes in total)
D	14:56:30.671	[DFU] wait(1000)
D	14:56:31.670	[DFU] wait(1000)
V	14:56:32.680	[DFU] Connecting to DFU target...
D	14:56:32.680	[DFU] gatt = device.connectGatt(autoConnect = false)
I	14:56:32.747	[DFU] Connected to E1:C7:FD:12:E8:68
V	14:56:32.747	[DFU] Discovering services...
D	14:56:32.747	[DFU] gatt.discoverServices()
I	14:56:34.337	[DFU] Services discovered
D	14:56:34.388	[DFU] wait(1000)
W	14:56:35.399	[DFU] Application with buttonless update found
V	14:56:35.399	[DFU] Jumping to the DFU Bootloader...
V	14:56:35.399	[DFU] Enabling notifications for 8e400001-f315-4f60-9fb8-838830daea50
D	14:56:35.399	[DFU] gatt.setCharacteristicNotification(8e400001-f315-4f60-9fb8-838830daea50, true)
D	14:56:35.399	[DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
I	14:56:35.736	[DFU] Data written to descr.8e400001-f315-4f60-9fb8-838830daea50, value (0x): 01-00
V	14:56:35.736	[DFU] Notifications enabled for 8e400001-f315-4f60-9fb8-838830daea50
A	14:56:35.736	[DFU] Notifications enabled
D	14:56:35.736	[DFU] wait(1000)
V	14:56:36.748	[DFU] Writing to characteristic 8e400001-f315-4f60-9fb8-838830daea50
D	14:56:36.748	[DFU] gatt.writeCharacteristic(8e400001-f315-4f60-9fb8-838830daea50)
I	14:56:37.129	[DFU] Notification received from 8e400001-f315-4f60-9fb8-838830daea50, value (0x): 20-01-01
A	14:56:37.129	[DFU] Enter bootloader sent (Op Code = 1)
A	14:56:37.129	[DFU] Response received (Op Code = 1, Status = 1)
D	14:56:38.330	[Callback] Connection state changed with status: 19 and new state: DISCONNECTED (0)
W	14:56:38.330	Connection terminated by peer (status 19)
I	14:56:38.330	Disconnected
D	14:56:38.337	gatt.refresh() (hidden)
I	14:56:38.347	[DFU] Disconnected by the remote device
D	14:56:38.347	[DFU] gatt.refresh() (hidden)
D	14:56:38.349	[DFU] gatt.close()
V	14:56:38.349	[DFU] Scanning for the DFU Bootloader...
D	14:56:38.381	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
I	14:56:38.478	[DFU] DFU Bootloader found with address E1:C7:FD:12:E8:69
V	14:56:38.482	[DFU] DFU service started
V	14:56:38.482	[DFU] Opening file...
I	14:56:38.499	[DFU] Image file opened (51752 bytes in total)
D	14:56:38.499	[DFU] wait(1000)
D	14:56:39.499	[DFU] wait(1000)
V	14:56:40.505	[DFU] Connecting to DFU target...
D	14:56:40.562	[DFU] gatt = device.connectGatt(autoConnect = false)
I	14:56:40.973	[DFU] Connected to E1:C7:FD:12:E8:69
V	14:56:40.973	[DFU] Discovering services...
D	14:56:40.973	[DFU] gatt.discoverServices()

and of the DFU connection

nRF Connect, 2017-03-31
GM DFU (E1:C7:FD:12:E8:69)
D	14:56:40.972	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
V	14:56:41.102	Connecting to E1:C7:FD:12:E8:69...
D	14:56:41.102	gatt = device.connectGatt(autoConnect = false)
D	14:56:41.161	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I	14:56:41.161	Connected to E1:C7:FD:12:E8:69
D	14:56:41.161	wait(600ms)
V	14:56:41.769	Discovering services...
D	14:56:41.769	gatt.discoverServices()
D	14:56:41.845	[Callback] Services discovered with status: 0
I	14:56:41.845	Services discovered
V	14:56:41.857	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)
Secure DFU Service (0xFE59)
- DFU Packet [WNR] (8ec90002-f315-4f60-9fb8-838830daea50)
- DFU Control Point [N W] (8ec90001-f315-4f60-9fb8-838830daea50)
D	14:56:41.858	[Callback] Services discovered with status: 0
I	14:56:41.859	Services discovered
V	14:56:41.874	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)
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)

The output of the bootloader says that it is waiting for events.

The logs show that the android app is connecting to the Bootloader but it doesn't successfully discover the services.

Very occasionally, the services are dicovered and the update works.

If I manually start the bootloader and connect to it, I can update without issue.

Any idea what's going on?

Related