cancel
Showing results for 
Search instead for 
Did you mean: 

Error when trying to terminate BLE connection

brian239955_stm1
Associate III

I'm using a WB55 Nucleo board and setting up a BLE connection with a 2nd WB55 Nucleo board using aci_gap_create_connection(). The connection succeeds and I am able to transfer data between the 2 boards. I would then like to terminate the connection. I call aci_gap_terminate_gap_proc(0x40) to do this, but I always get a return value of 0x46, which corresponds to BLE_STATUS_NOT_ALLOWED.

Any ideas why the call to aci_gap_terminate_gap_proc() fails? Or is there a different recommended way to terminate the BLE connection?

Thanks...

1 ACCEPTED SOLUTION

Accepted Solutions
Vyacheslav
Senior II

Hi.

"aci_gap_terminate_gap_proc" uses for terminate the specified GATT procedure, in your case, you want to terminate procedure "GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC".

Since the connection already exists, the procedure is not performed.

To terminate connection you need to call :

aci_gap_terminate(uint16_t Connection_Handle, uint8_t Reason).

In "Connection_Handle" parameter you need pass current connection handle and in "Reason" parameter pass one from list:

- 0x05: Authentication Failure

 - 0x13: Remote User Terminated Connection

 - 0x14: Remote Device Terminated Connection due to Low Resources

 - 0x15: Remote Device Terminated Connection due to Power Off

 - 0x1A: Unsupported Remote Feature

 - 0x3B: Unacceptable Connection Parameters

Best regards,

Vaycheslav.

View solution in original post

2 REPLIES 2
Vyacheslav
Senior II

Hi.

"aci_gap_terminate_gap_proc" uses for terminate the specified GATT procedure, in your case, you want to terminate procedure "GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC".

Since the connection already exists, the procedure is not performed.

To terminate connection you need to call :

aci_gap_terminate(uint16_t Connection_Handle, uint8_t Reason).

In "Connection_Handle" parameter you need pass current connection handle and in "Reason" parameter pass one from list:

- 0x05: Authentication Failure

 - 0x13: Remote User Terminated Connection

 - 0x14: Remote Device Terminated Connection due to Low Resources

 - 0x15: Remote Device Terminated Connection due to Power Off

 - 0x1A: Unsupported Remote Feature

 - 0x3B: Unacceptable Connection Parameters

Best regards,

Vaycheslav.

Hi Vyacheslav,

Thanks you for the quick response. Your solution works well!

Brian