cancel
Showing results for 
Search instead for 
Did you mean: 

BLE Disconnection with error code 0x3E

ABN
Associate III

Hey,

I'm working on custom BLE Central and Peripheral project to make connection and send some sensor data over BLE. For this I'm referring to BLE p2pServer and p2pClient along with p2pRouter example projects. I'm able to make a connection with the server, but immediately I get HCI_DISCONNECTION_COMPLETE_EVT_CODE with the error code for reason as 0x3E. Can anyone help me out with this.?

Attaching the snapshot of the debug messages.

ABN_1-1713784624841.png

 

ABN_0-1713784521635.png

 

10 REPLIES 10
STTwo-32
ST Employee

Hello @ABN 

The error code 0x3e means "The Connection Failed to be Established / Synchronization Timeout error code". It indicates that the LL initiated a connection or initiated synchronization to periodic advertising but the connection has failed to be established or the Link Layer failed to synchronize with the periodic advertising within 6 periodic advertising events of the first attempt. 

If you are experiencing this issue directly after connecting your STM32WB to a server, it could be due to interference or instability in the connection establishment process. It is recommended to check the environmental conditions and ensure that there are no sources of interference near the devices. Additionally, reviewing the configuration of the clock sources like LSE and HSE, as well as ensuring that there are no issues with GPIO toggling or flash access, might help in resolving the issue.

For more details, you can refer to the Core Specification 5.4

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.

Hello @STTwo-32 ,

1. There are no sources of interference. Only central and peripheral devices are present.

2. Snapshot of the clock config of Central device.

ABN_0-1713848863011.png

3. Snapshot of clock config of Peripheral device.

ABN_1-1713848980265.png

4. How can GPIO toggling and flash access help in resolving the issue?

1) You should ensure that there is no source of interference on the place that you are working on.

2+3) I suggest you to add the following line of code to your central and Perpheral.

int main(void)
{

  /* USER CODE BEGIN 1 */
	 HAL_PWR_EnableBkUpAccess();
	  while(HAL_IS_BIT_CLR(PWR->CR1, PWR_CR1_DBP));
	  __HAL_RCC_LSE_CONFIG(RCC_LSE_OFF);
	  __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_MEDIUMHIGH);
  /* USER CODE END 1 */

4) Not helping, But just to ensure that everything else works fine on the Code.

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.

I added the code snippet that you have suggested. After this change as well, the connection is not sustaining.

ABN_1-1713867791503.png

 

 

Are you working on one of our Nucleo/Disco boards or an MCU? If is an MCU, can you try using one of our boards and check if you have the same behavior?

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.

@STTwo-32,

The original project is being carried out on a custom WB55VGQ6 board. As per your suggestion, I ported my project changes to Nucleo board. The disconnection behavior was not observed.

Also , if I there is more than one primary service, then 'discover all primary service' is not detecting the other primary service. I can detect only one

So, for the original issue, I think is related to your HW design. Refer to this application note to check you HW. 

For the Second issue, I suggest you create a new post to describe it so we may can help you.

 

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.

Hey STTwo-32,

I'm the hardware engineer who's looking over this design. Can you suggest something specific related to this, if you want I can share you a snap of the schematic. 
We have already followed the design rules given in the app note (the above mentioned). 

Thanks,

Apoorv Rakshit

@STTwo-32, Can you suggest specific things to look out for from HW perspective?
@rapoorvcan help us here w.r.t HW