Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Value CCCD field of custom characteristic cannot be read

Hello, 

I use the nrf51 with SDK 12.3.0.

I followed the tutorial for custom services and added characteristics as described here: https://devzone.nordicsemi.com/tutorials/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial

Now, if I compile the finished example application from the tutorial an execute it on the nrf51822 I can connect to the device using nrf connect.

Reading/writing the characteristic value works fine. However trying to read the value of the corresponding CCCD field (by tapping the small arrow beside it) will cause a timeout and a disconnect. The log looks like this:

nRF Connect, 2018-03-23
OurCharacteristic (E4:E6:7D:57:1C:6E)
V	17:45:12.297	Connecting to E4:E6:7D:57:1C:6E...
D	17:45:12.297	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
D	17:45:15.795	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D	17:45:15.798	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I	17:45:15.798	Connected to E4:E6:7D:57:1C:6E
V	17:45:15.815	Discovering services...
D	17:45:15.815	gatt.discoverServices()
D	17:45:16.308	[Callback] Services discovered with status: 0
I	17:45:16.312	Services discovered
V	17:45:16.332	Generic Access (0x1800)
- Device Name [R W] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
   Client Characteristic Configuration (0x2902)
Unknown Service (0000f00d-1212-efde-1523-785fef13d123)
- Unknown Characteristic [N R W] (0000beef-1212-efde-1523-785fef13d123)
   Client Characteristic Configuration (0x2902)
V	17:45:22.100	Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D	17:45:22.100	gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
E	17:45:52.113	Error 133 (0x85): GATT ERROR
D	17:45:52.114	[Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
I	17:45:52.114	Disconnected
D	17:45:52.254	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED

If I write to the CCCD first (tapping the 3 arrows of the characteristic) then reading afterwards works fine.

I also checked  the HRS example app and there this behaviour does not occur. Reading the CCCD works perfectly there, but I couldn't find a difference in the setup of the characteristic compared to the tutorial above.

The problem for me is that my central application (written in Qt) times out during service discovery because of this behaviour.

Has someone encountered this problem before and has a solution?

Related