Skip to main content
brian239955_stm1
Associate II
October 16, 2019
Solved

Error when trying to terminate BLE connection

  • October 16, 2019
  • 1 reply
  • 1453 views

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...

This topic has been closed for replies.
Best answer by

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.

1 reply

Answer
October 16, 2019

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.

brian239955_stm1
Associate II
October 16, 2019

Hi Vyacheslav,

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

Brian