Advertising packets before payload sending

Hi @brandon.shannon,

I’d tried what you advice to me. I am having some troubles with it:

Firstly, I am finding (sometimes, not always) that there are more than once uuid values that are 0x2902. So I don’t know which handle I have to take for cccd write. What am I doing wrong?

Then one question to understand properly how it works: The CCCD write (by CustomSrvice_SendWrite()) you said me that has to be after Service Discovery is completed.
I am calling this function inside GATTC_DiscSvcInd() function. Is that correct? If not where am I supposed to call it?

About UART interaction I did what you asked to me and I am getting this:

  • param->handle = 0xC
    *cs_env.disc_att[CS_IDX_TX_CHAR].pointer_hdl = 0x0

Thank you very much,

Enric Puigvert

1 Like

Hi @brandon.shannon,

I finally succeed on sending with CCCD control and also in printing by UART!
With your suggestions and also after a lot of failed tries, I could find the descriptor handle which controls CCCD bit for Custom Service Tx notifications.

I solved the issue calling CustomSrvice_SendWrite(ble_env.conidx, &cs_env.tx_cccd_value, 0x11, 0x00, 0x02, GATTC_WRITE) function like this inside GATTC_CmpEvt() function after Service Enables.
The way I found the handle was:

  • take the USB Explorer with RSL10 USB BLE DONGLE
    *Connect my peripheral server to it and read the debug messages it shows
  • When it discovers the services I annotated all handles related with 0x2902 UUID
  • By trying all this handle (there were 4 of them) I finally found that handle 0x11 was the key.

This fix solved the problem of CCCD and also the UART issues.

Again, thank you very much for your patience and your answers!

Enric Puigvert

1 Like

Hi @epuigvert,

Glad to hear that you found a solution and that we got this sorted out.

As for finding the CCCD handle, you are correct that you should see multiple 0x2902 UUID values. This is because the CCCD for each of the Characteristics has the same UUID.

To get around this, you would need to use the Start Handle for your Characteristics to calculate the handle range when executing the ‘ GATTC_DISC_CMD ’ command with the ‘ GATTC_DISC_DESC_CHAR ’ operation. I’ll do a quick example below:

Custom Service - Start Handle = 0x00 ; End Handle = 0x09 ;
Characteristic #1 - Start Handle = 0x00
Characteristic #2 - Start Handle = 0x05

To find the CCCD for Characteristic #1, execute the ‘ GATTC_DISC_CMD ’ command with the ‘ GATTC_DISC_DESC_CHAR ’ operation on the handle range of 0x00 to 0x04 and search for the Descriptor with UUID of 0x2902. Save this handle as the CCCD of Characteristic #1.

To find the CCCD for Characteristic #2, execute the ‘ GATTC_DISC_CMD ’ command with the ‘ GATTC_DISC_DESC_CHAR ’ operation on the handle range of 0x05 to 0x09 and search for the Descriptor with UUID of 0x2902. Save this handle as the CCCD of Characteristic #2.

1 Like