cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB BLE: How to accept a aci_l2cap_connection_update_req_event?

OliM
Senior

I am currently working with an STM32WB05N as a co processor to a STM32U5, but I think the basic flow should be the same for all WB products. But I didn't find an AN or example for it.

My device is acting as a central and connecting to a (WB55 based) peripheral which uses aci_l2cap_connection_parameter_update_req. My central receives this though aci_l2cap_connection_update_req_event. So far so good.
But now I want to accept the proposal with aci_l2cap_connection_parameter_update_resp using the same parameters received through the request and Min_CE_Length as well as Max_CE_Length using the same values I used for the original connection opening (and 0x01 for accept). But I get a 0x12 BLE_ERROR_INVALID_HCI_CMD_PARAMS.
What am I doing wrong? (and is there example code for connection update somewhere?)

uint8_t s_Identifier;
uint16_t s_Connection_Interval_Min;
uint16_t s_Connection_Interval_Max;
uint16_t s_Max_Latency;
uint16_t s_Timeout_Multiplier;

void vPendableConnectResp( void * pvParameter1, uint32_t ulParameter2 )
{
    tBleStatus State;
    //accept whatever the peripheral wants
    State = aci_l2cap_connection_parameter_update_resp(s_ConnectionHandle,
                                               s_Connection_Interval_Min,
                                               s_Connection_Interval_Max,
                                               s_Max_Latency,
                                               s_Timeout_Multiplier,
                                               BLE_MINIMUM_CE,
                                               BLE_MAXIMUM_CE,
                                               s_Identifier,
                                               1);
    while(State != BLE_STATUS_SUCCESS);
}
void aci_l2cap_connection_update_req_event(uint16_t Connection_Handle,
                                           uint8_t Identifier,
                                           uint16_t L2CAP_Length,
                                           uint16_t Connection_Interval_Min,
                                           uint16_t Connection_Interval_Max,
                                           uint16_t Max_Latency,
                                           uint16_t Timeout_Multiplier)
{
    if(Connection_Handle == s_ConnectionHandle)
    {
        s_Identifier = Identifier;
        s_Connection_Interval_Min = Connection_Interval_Min;
        s_Connection_Interval_Max = Connection_Interval_Max;
        s_Max_Latency = Max_Latency;
        s_Timeout_Multiplier = Timeout_Multiplier;
        //pend to timer function to prevent recursion in task handler
        xTimerPendFunctionCall(vPendableConnectResp, NULL, 0, 0);
    }

}
0 REPLIES 0