CCCD change not written to flash after BLE Write (Server)

Hello,

I am currently developing a firmware where I am acting as a server with nRF52840.

The protocol of my use case is:

  1. Client is connecting to my device (server with bonding)
  2. Client sets notification enabled (is written to flash by the server as PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event indicates)
  3. Client is writing to a custom characteristic
  4. Client wants to set notification disabled (I receive the event that it is written to CCCD but I don't get the PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event and nothing is written to the flash, since I want to store the information for reconnecting with the bonded device)

Do I have to handle the write to the CCCD on my own or could there be a problem with writing to my characteristic?

Note: When no write is executed, just notification enabling and disabling, everything works fine and is stored to flash.

best regards 

  • I changed the location of the characteristic to BLE_GATTS_VLOC_STACK and can add the 9 characteristics with size 510 bytes each with sd_ble_gatts_characteristic_add and I can successfully read and notify from the characteristics. But as soon as I am writing to them, there is again the issue with bonding. When the size of each characteristic is 201 bytes, everythin works well. Are there any other limitations which I should take care of. Or am I fine with memory when sd_ble_gatts_characteristic_add  returns NRF_SUCCESS for each characteristic. Or should I take care of something else, even tho sd_ble_gatts_characteristic_add returns NRF_SUCCESS? Thanks for the support

  • UPDATE: I could solve my issue, I did something wrong with my ram management (start address and size). As well as a mistake with sd_ble_gatts_value_set(). Thanks for your help and I am going to close this thread :)

Related