Skip to main content
RStep.15
Associate
September 15, 2018
Question

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

  • September 15, 2018
  • 19 replies
  • 5698 views

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?

    This topic has been closed for replies.

    19 replies

    SalvoP
    ST Employee
    September 24, 2018

    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
    RStep.15Author
    Associate
    September 28, 2018

    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.
    Super User
    October 1, 2018

    Then there' should be real eeprom instead of flash.

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

    -- pa

    SalvoP
    ST Employee
    October 5, 2018

    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
    RStep.15Author
    Associate
    October 9, 2018

    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
    October 12, 2018

    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
    RStep.15Author
    Associate
    October 12, 2018

    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
    October 16, 2018

    There is an API for this: ACI_GATT_SET_DESC_VALUE.

    Senior
    September 2, 2023

    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.

     

    Senior
    September 2, 2023

    it is ok, i resolved the problem with : aci_gatt_set_desc_value