adafruit / Adafruit_nRF52_Bootloader

USB-enabled bootloaders for the nRF52 BLE SoC chips
MIT License
447 stars 404 forks source link

[Bug]Cannot OTA when paired using Android device #104

Closed se7ensong closed 3 years ago

se7ensong commented 4 years ago

I am using feather_nrf52832 board running the latest bootloader and the BLE UART example from here https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide?view=all It works fine with Android without paring, but with pairing, the board will reboot. But it will go into the application other than doing the update. I am updating using nRFtoolbox and nRF connect app. The error message from both is (0x85) GATT Error.

Is this a feature not implemented?

KK1423 commented 4 years ago

I am experiencing the same issue. Here is an RTT log. It seems that the device disconnects after the BLE_GAP_EVT_CONN_SEC_UPDATE.

BSP Library : 0.20.5

[BLE   ] BLE_GAP_EVT_ADV_SET_TERMINATED : Conn Handle = 65535 Battery Measured: 1023, %100 [BLE   ] BLE_GAP_EVT_CONNECTED : Conn Handle = 0 [GAP   ] Conn Interval= 45.00 ms, Latency = 0, Supervisor Timeout = 5000 ms [BLE   ] BLE_GAP_EVT_SEC_PARAMS_REQUEST : Conn Handle = 0 [BLE   ] BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST : Conn Handle = 0 [GAP   ] Data Length Request is (tx, rx) octets = (27, 251), (tx, rx) time = (328, 2120) us [BLE   ] BLE_GAP_EVT_DATA_LENGTH_UPDATE : Conn Handle = 0 [GAP   ] Data Length is (tx, rx) octets = (27, 27), (tx, rx) time = (1364, 328) us [BLE   ] BLE_GAP_EVT_CONN_PARAM_UPDATE : Conn Handle = 0 [GAP   ] Conn Interval= 30.00 ms, Latency = 0, Supervisor Timeout = 2000 ms [BLE   ] BLE_GAP_EVT_CONN_SEC_UPDATE : Conn Handle = 0 [BOND  ] CCCD setting not found [BLE   ] BLE_GAP_EVT_AUTH_STATUS : Conn Handle = 0 [BLE   ] BLE_GAP_EVT_CONN_PARAM_UPDATE : Conn Handle = 0 [GAP   ] Conn Interval= 7.50 ms, Latency = 0, Supervisor Timeout = 5000 ms [SOC   ] NRF_EVT_FLASH_OPERATION_SUCCESS [SOC   ] NRF_EVT_FLASH_OPERATION_SUCCESS [BLE   ] BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP : Conn Handle = 0 [BOND  ] Saved keys for "OnePlus 6T" to file /adafruit/bond_prph/22ac ( 93 bytes ) [SOC   ] NRF_EVT_FLASH_OPERATION_SUCCESS [SOC   ] NRF_EVT_FLASH_OPERATION_SUCCESS [BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0 [BLE   ] BLE_GAP_EVT_CONN_PARAM_UPDATE : Conn Handle = 0 [GAP   ] Conn Interval= 30.00 ms, Latency = 0, Supervisor Timeout = 2000 ms Battery Measured: 1023, %100 [BLE   ] BLE_GATTS_EVT_WRITE : Conn Handle = 0 [GATTS ] attr's cccd = 0x0001 [BOND  ] Saved CCCD setting to file /adafruit/bond_prph/22ac ( offset = 93, len = 20 bytes ) [SOC   ] NRF_EVT_FLASH_OPERATION_SUCCESS [SOC   ] NRF_EVT_FLASH_OPERATION_SUCCESS [BLE   ] BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST : Conn Handle = 0 [BOND  ] Loaded keys from file /adafruit/bond_prph/22ac Resetting to Bootloader Bootlaoder Start BLE BLE_GAP_EVT_CONNECTED BLE BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST BLE BLE_GAP_EVT_DATA_LENGTH_UPDATE BLE BLE_GAP_EVT_SEC_INFO_REQUEST BLE BLE_GAP_EVT_CONN_SEC_UPDATE

And the corresponding nrf Connect log:

nRF Connect, 2020-08-17 Rave Mask (E8:48:F9:A3:72:63) V 14:37:36.693 Removing bond information... D 14:37:36.693 device.removeBond() (hidden) D 14:37:36.745 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10) I 14:37:36.745 Bond information deleted V 14:38:13.014 Starting pairing... D 14:38:13.014 device.createBond() D 14:38:13.036 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11) D 14:38:13.122 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED D 14:38:13.122 gatt.close() D 14:38:13.141 wait(200) V 14:38:13.344 Connecting to E8:48:F9:A3:72:63... D 14:38:13.344 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 14:38:13.361 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 14:38:13.361 Connected to E8:48:F9:A3:72:63 D 14:38:13.371 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 14:38:13.811 Connection parameters updated (interval: 30.0ms, latency: 0, timeout: 2000ms) D 14:38:14.209 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDED (12) I 14:38:14.209 Device bonded D 14:38:14.225 wait(1600ms) I 14:38:14.350 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) I 14:38:15.580 Connection parameters updated (interval: 30.0ms, latency: 0, timeout: 2000ms) V 14:38:15.826 Discovering services... D 14:38:15.826 gatt.discoverServices() D 14:38:15.840 [Callback] Services discovered with status: 0 I 14:38:15.840 Services discovered V 14:38:15.856 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) Device Firmware Update Service (00001530-1212-efde-1523-785feabcd123) DFU Packet [WNR] (00001532-1212-efde-1523-785feabcd123) DFU Control Point [N W] (00001531-1212-efde-1523-785feabcd123) Client Characteristic Configuration (0x2902) DFU Version [R] (00001534-1212-efde-1523-785feabcd123) Battery Service (0x180F) Battery Level [N R] (0x2A19) Client Characteristic Configuration (0x2902) D 14:38:15.857 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true) D 14:38:15.859 gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true) V 14:38:33.198 [DFU] DFU service started V 14:38:33.198 [DFU] Opening file... I 14:38:33.533 [DFU] Firmware file opened successfully V 14:38:33.533 [DFU] Connecting to DFU target... D 14:38:33.535 [DFU] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferredPhy = LE_1M | LE_2M) I 14:38:33.539 [DFU] Connected to E8:48:F9:A3:72:63 D 14:38:33.540 [DFU] wait(1600) V 14:38:35.141 [DFU] Discovering services... D 14:38:35.142 [DFU] gatt.discoverServices() I 14:38:35.153 [DFU] Services discovered D 14:38:35.175 [DFU] wait(1000) V 14:38:36.164 [DFU] Reading DFU version number... D 14:38:36.164 [DFU] gatt.readCharacteristic(00001534-1212-efde-1523-785feabcd123) I 14:38:36.251 [DFU] Read Response received from 00001534-1212-efde-1523-785feabcd123, value (0x): 01-00 A 14:38:36.252 [DFU] Version number read: 0.1 V 14:38:36.253 [DFU] Reading Service Changed CCCD value... D 14:38:36.253 [DFU] gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb) I 14:38:36.310 [DFU] Read Response received from descr.00002a05-0000-1000-8000-00805f9b34fb, value (0x): 02-00 A 14:38:36.311 [DFU] Service Changed indications enabled W 14:38:36.311 [DFU] Application with buttonless update found V 14:38:36.311 [DFU] Jumping to the DFU Bootloader... V 14:38:36.311 [DFU] Enabling notifications for 00001531-1212-efde-1523-785feabcd123 D 14:38:36.311 [DFU] gatt.setCharacteristicNotification(00001531-1212-efde-1523-785feabcd123, true) D 14:38:36.314 [DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00) I 14:38:36.372 [DFU] Data written to descr.00001531-1212-efde-1523-785feabcd123, value (0x): 01-00 V 14:38:36.372 [DFU] Notifications enabled for 00001531-1212-efde-1523-785feabcd123 A 14:38:36.373 [DFU] Notifications enabled D 14:38:36.373 [DFU] wait(1000) V 14:38:37.398 [DFU] Writing to characteristic 00001531-1212-efde-1523-785feabcd123 D 14:38:37.398 [DFU] gatt.writeCharacteristic(00001531-1212-efde-1523-785feabcd123) D 14:38:39.438 [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0) E 14:38:39.438 Error 8 (0x8): GATT CONN TIMEOUT I 14:38:39.438 Disconnected A 14:38:39.439 [DFU] Jump to bootloader sent (Op Code = 1, Upload Mode = 4) I 14:38:39.439 [DFU] Disconnected by the remote device D 14:38:39.441 [DFU] gatt.disconnect() D 14:38:39.494 [DFU] gatt.close() D 14:38:39.494 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED D 14:38:39.507 [DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED V 14:38:39.509 [DFU] DFU service started I 14:38:39.509 [DFU] Firmware file opened successfully D 14:38:39.509 [DFU] wait(1000) D 14:38:40.524 [DFU] wait(1000) V 14:38:41.512 [DFU] Connecting to DFU target... D 14:38:41.542 [DFU] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferredPhy = LE_1M | LE_2M) D 14:38:42.075 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED I 14:38:42.093 [DFU] Connected to E8:48:F9:A3:72:63 D 14:38:42.093 [DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED D 14:38:42.093 [DFU] wait(1600) V 14:38:43.682 [DFU] Discovering services... D 14:38:43.683 [DFU] gatt.discoverServices() I 14:38:43.692 [DFU] Services discovered D 14:38:43.708 [DFU] wait(1000) V 14:38:44.698 [DFU] Reading DFU version number... D 14:38:44.698 [DFU] gatt.readCharacteristic(00001534-1212-efde-1523-785feabcd123) E 14:38:47.346 [DFU] Error (0x85): GATT ERROR D 14:38:47.348 [DFU] gatt.disconnect() D 14:38:47.349 [DFU] gatt.close() D 14:38:47.350 [DFU] wait(600) D 14:38:47.357 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED D 14:38:47.374 [DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED D 14:38:47.957 gatt.close() D 14:38:47.961 wait(200) V 14:38:48.162 Connecting to E8:48:F9:A3:72:63... D 14:38:48.162 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 14:39:18.169 [Callback] Connection state changed with status: 133 and new state: DISCONNECTED (0) E 14:39:18.169 Error 133 (0x85): GATT ERROR I 14:39:18.169 Disconnected

It does seem like this should be supported though.