KitKat Descriptor write error (133)
See original GitHub issueI am testing an app which performs buttonless bonded DFU with a KitKat phone (Nexus 5). I get the following error when attempting an update:
I/DfuBaseService: Services discovered
I/DfuImpl: Reading Service Changed CCCD value...
D/BluetoothGatt: readDescriptor() - uuid: 00002902-0000-1000-8000-00805f9b34fb
D/BluetoothGatt: onDescriptorRead() - Device=C1:B7:36:18:E3:44 UUID=00002a05-0000-1000-8000-00805f9b34fb
I/DfuImpl: Buttonless service with bond sharing found -> SDK 14 or newer
I/DfuImpl: Enabling indications...
D/BluetoothGatt: setCharacteristicNotification() - uuid: 8ec90004-f315-4f60-9fb8-838830daea50 enable: true
D/BluetoothGatt: writeDescriptor() - uuid: 00002902-0000-1000-8000-00805f9b34fb
D/BluetoothGatt: onDescriptorWrite() - Device=C1:B7:36:18:E3:44 UUID=8ec90004-f315-4f60-9fb8-838830daea50
E/DfuImpl: Descriptor write error: 133
The device correctly enters the bootloader and the issue seems to occur after connecting for the second time and attempting to write a descriptor. I’m using v1.9.0 of the DFU library and SDK 14.2 on the device.
The issue only occurs on KitKat. I’ve tested with multiple Android phones running different versions and they seem to work fine with the same update package. I’ve tested the same package with nRF connect and the update is applied successfully. I’ve also tested with nRF toolbox and the same issue is present.
Any ideas on what the issue could be? Any help would be appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Error on writing characteristic (133) - Nordic Q&A
Hi. I'm testing the nRF Toolbox for Android. But I get this error when I try to connect using the proximity feature: image...
Read more >BluetoothGatt - Android Developers
Write the value of a given descriptor to the associated remote device. ... Returns. List<BluetoothDevice>, List of devices. The list will be empty...
Read more >Android 4.3: Bluetooth LE pretty instable [36976711]
I was receiving Error 133 when attempting to perform a writeCharacteristic. The write would be successful, but then connection would be lost shortly...
Read more >Issue with Android BLE data Write- Getting error 133
error code: 133 is indicate GATT__ERROR, device is not in range. May be there is bug in during read event. I suggest please...
Read more >Bluetooth LE for Mobile - 4. Android Peripheral
I hope that you, dear reader, don't need to support KitKat. ... thread and attempting to gracefully work around the notorious error 133....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The SC wait seems like the best way to go.
It’s very frustrating that the Android BLE stack is so finicky, requiring the use of hidden methods to get basic functionality working. It makes it a bit of a nightmare to work with it, especially on the lower Android versions. Thanks for all your help though. You’ve made it all a lot easier 😃
If you’re using Buttonless service with bond, the dfu library relies on Service Changed indication when switching to bootloader mode and after dfu is complete. That means, that it doesn’t call
refresh. However, as I wrote above, SC indication is sent a moment after you receiveonConnectionStateChange. That means, that after the dfu is complete, in your app, when you connect again to the device, you should wait a bit (dfu lib waits for 1600ms), before callinggatt.discoverServices(), otherwise you’ll get cached services that moment later will get invalidated, but your app won’t be aware of it. At least that’s what happens when SC is received and handled correctly by the system. The API is very bad in regard of cache refreshing. If the delay doesn’t help, just refresh on your own.