cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Peripheral Preferred Connection Parameters characteristic in STM32WB55 ?

Vyacheslav
Senior II

HI.

In description of aci_gap_init() function writed:

Initialize the GAP layer. Register the GAP service with the GATT.

All the standard GAP characteristics will also be added:

- Device Name

- Appearance

- Peripheral Preferred Connection Parameters (peripheral role only)

but this function does not return ppcp handle.

In AN5270 writed the same.

Question: how to set ppcp characteristic (min-max interval, conn_sup_timeout, slave latency) ?

Thanks.

6 REPLIES 6
Vyacheslav
Senior II

Hi !

Due to the fact that STM employees do not want to answer this question, I will answer myself.

According to the specification, the ppcp characteristic must be present, but, for some reason, the function aci_gap_init () does not return a handle of this characteristic, which means we cannot set the parameters of ppcp.

But there is a workaround that I will tell you about:

When the EVT_LE_CONN_COMPLETE event came, we need call aci_l2cap_connection_parameter_update_req(...) function  with the necessary parameters (conn interval min-max, slave lat, sup timeout).

In case EVT_VENDOR: use this code:

        case EVT_VENDOR:
        {
            blue_evt = (evt_blue_aci*) event_pckt->data;
            switch (blue_evt->ecode)
            {
                case EVT_BLUE_L2CAP_CONNECTION_UPDATE_RESP:
                {
                    aci_l2cap_connection_update_resp_event_rp0* resp = (aci_l2cap_connection_update_resp_event_rp0*)blue_evt->data;
                    resp->Result; //mus be = 0;
                    break;
                }
...
            }
      }

And in case EVT_LE_META_EVENT: we receive updated connection parameters, which can be seen for example like this:

        case EVT_LE_META_EVENT:
        {
            meta_evt = (evt_le_meta_event*) event_pckt->data;
            switch (meta_evt->subevent)
            {
                case EVT_LE_CONN_UPDATE_COMPLETE: 
                {
                    if (OUR_connectionHandle == ((hci_le_connection_update_complete_event_rp0*)meta_evt->data)->Connection_Handle)
                    {
                        ((hci_le_connection_update_complete_event_rp0*)meta_evt->data)->Conn_Interval; 
                        ((hci_le_connection_update_complete_event_rp0*)meta_evt->data)->Conn_Latency;
                        ((hci_le_connection_update_complete_event_rp0*)meta_evt->data)->Supervision_Timeout;
                        ((hci_le_connection_update_complete_event_rp0*)meta_evt->data)->Status;
                    }
                    break;
                }
         }
}

Enjoy !

MCalz.2
Associate

According to STM32WB BLE stack programming guidelines - Programming manual (https://www.st.com/resource/en/programming_manual/dm00716581-stm32wb-ble-stack-programming-guidelines-stmicroelectronics.pdf) the handle for ppcp is (Appearance_handle + 2), so you can update the char with this info.

I hope that helps.

Hi !

Thanks for this news.

It is very important but in this way STM would be possible to return only one handle to the GAP service, and let the user read lot of documents himself to find offsets for other characteristics. =)

They had to explicitly specify the handle of the PPCP characteristic.

Hi!

Ok, but where i can find structure of 8 bytes len to fill them and get to gatt?

Hi,

I defined it myself:

 struct{

  uint16_t min_int;

  uint16_t max_int;

  uint16_t slave_lat;

  uint16_t timeout;

 }ppcp;

Hope that helps.

Wonderful !