Skip to main content
Jun 8, 2019 2:04 PM UTC
Question

How to set Peripheral Preferred Connection Parameters characteristic in STM32WB55 ?

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.

This topic has been closed for replies.

6 replies

Jun 11, 2019 8:31 PM UTC

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
Visitor II
Feb 19, 2021 11:18 PM UTC

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.

Feb 20, 2021 5:19 PM UTC

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.