cancel
Showing results for 
Search instead for 
Did you mean: 

HCI_DISCONNECTION_COMPLETE_EVT_CODE not generated

BH.1
Associate II

I am running into some trouble with a STM32WB while using a custom GATT server and attempting to disconnect from an Android device. The core issue is that the CPU2 has turned on the HSE. This is known because the HSERDY bit is set while the HSEON bit is off. This is causing ~0.5mA of extra current draw.

 

Below is what I have investigated:

Scenario 1:

I am attempting to disconnect from an Android device by calling aci_gap_terminate(connectionHandle, 0x13) which returns 0x00. After terminating the connection I expect to see a HCI_DISCONNECTION_COMPLETE_EVT_CODE event generated in SVCCTL_App_Notification() as stated in an5270. The Android device observes and reacts to the disconnection. I believe this leaves CPU2 in a bad state as calling aci_hal_get_link_status(status, link_handle) returns 0x02 and the corresponding link handle. In an5270 a return status of 0x02 says that the STM32WB is connected in the peripheral role.

 

Is my understanding correct that I should see a HCI_DISCONNECTION_COMPLETE_EVT_CODE after calling aci_gap_terminate() with the correct handle?

Why am I seeing that the STM32WB is connected in the peripheral role when the connection to the Android device has been broken?

 

Scenario 2:

When I disconnect from the STM32WB55 through the Android ST BLE Toolbox app I do see the HCI_DISCONNECTION_COMPLETE_EVT_CODE event generated in the SVCCTL_App_Notification() function.

 

Why does one form of disconnection generate the HCI_DISCONNECTION_COMPLETE_EVT_CODE event but the other does not?

1 REPLY 1
STTwo-32
ST Employee

Hello @BH.1 

>Is my understanding correct that I should see an HCI_DISCONNECTION_COMPLETE_EVT_CODE after calling aci_gap_terminate() with the correct handle?

Yes, Your understanding is correct, After Calling ACI_GAP_TERMINATE, An HCI_DISCONNECTION_COMPLETE_EVENT is generated when the link is disconnected. 

 

>Why am I seeing that the STM32WB is connected in the peripheral role when the connection to the Android device has been broken?

Regarding the second part of your question, if aci_hal_get_link_status() returns 0x02 and indicates that the STM32WB is still connected in the peripheral role, this could be an unexpected behavior if the connection to the Android device has indeed been broken. There could be several reasons for this, such as a delay in the update of the link status or an issue with the BLE stack not properly updating the connection state. Are you using the last STM32CubeWB (V 1.19.0). If so, can you give more details on your use case and issues.

 

>Why does one form of disconnection generate the HCI_DISCONNECTION_COMPLETE_EVT_CODE event but the other does not?

The HCI_DISCONNECTION_COMPLETE_EVENT is generated after the end of execution of HCI_DISCONNECT, ACI_GAP_TERMINATE or HCI_LE_TRANSMITTER_TEST. 

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.