cancel
Showing results for 
Search instead for 
Did you mean: 

Are there any way I can set CCCD (0x2902) value on BLE server (BlueNRG-MS) 7.2c?

RStep.15
Associate II

It looks like BlueNRG-MS doesn't remember that BLE client asked it to change CCCD from 0 (default value) to 1 (subscribe to value change notifications) upon BLE server reboot. And I need to restore CCCD to 1 because BLE client doesn't do it on reconnect.

More details in this topic: https://social.msdn.microsoft.com/Forums/ru-RU/617c16ea-37d6-43c6-bab8-f925642ef1db/ble-hid-hid-over-gatt-device-status-reports-are-not-received-after-device-reconnected?forum=wdk&prof=required

btw: I am aware that this value must be set by BLE client, but what should I do if it doesn't do it?

20 REPLIES 20
RStep.15
Associate II

I am thinking of trying to look at the configuration area available via aci_hal_write_config_data() / aci_hal_read_config_data(), if I am lucky enough I can find something interesting...

SalvoP
ST Employee

Hi guys,

BlueNRG-MS does store the value of the CCCD in NVM. This is done when the device is disconnected, in order to reduce the number of writes in Flash.

Probably, the cause of the problems seen here is due to the fact that the BlueNRG is reset before terminating the connection. Hence, the content of the GATT database is not stored.

RStep.15
Associate II

Yes, this is the root cause of the problem. Device has physical power switch to cut down power when it's not needed anymore. That's why we have it. Keeping GATT database unsaved until BLE client is disconnected forces us to implement a complex device shutdown sequence or a user must turn off their computer before turning off the device (or at least turn off Bluetooth). All these options are not what we expected to get.

Pavel A.
Evangelist III

Then there' should be real eeprom instead of flash.

If Microsoft just did what Apple does everyone would be happy.

-- pa

SalvoP
ST Employee

There are two workarounds in this case, (when the application cannot gracefully disconnect from the peer)

1) Disconnecting from the peer after the CCCD has been written by the client the first time after bonding. Disconnection is initiating by the slave. In this case there will be a reconnection only after the two devices are paired (reconnection is immediately done without too much impact). After pairing is done, user experience is not impacted.

 or

2) Writing of the CCCD by the server itself upon reconnection if a bonded device has written into the CCCD. No impact on user experience even after pairing.

RStep.15
Associate II

1) As I said MS Windows and MacOS behave differently in this situation, disconnecting after CCCD is set by server will work fine with Windows but it will cause endless loop with MacOS because MacOS sets CCCD each time device is reconnected.

2) I cannot dictate Microsoft how they must implement their HID driver. Unfortunately.

SalvoP
ST Employee

1) You don't need to disconnect every time the CCD is set. You have to do this only after the pairing.

2) it is your device (the server) that sets the value of its descriptor. No change is required on the HID driver. This is in charge of your firmware.

RStep.15
Associate II

I didn't get how BLE server can set the value of CCCD, there is no way it could be done using provided API.

SalvoP
ST Employee

There is an API for this: ACI_GATT_SET_DESC_VALUE.

malarab
Senior II

Hello RStvep,

i hava he same problem,

i need to set notification on CCCD on the server to notify the client,

Do you found a solution ?

Thank you,

Sincerely.