This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE_HCI_CONNECTION_TIMEOUT issue

Hello guys,

Something strange is happening here and I need your opinion about that... I have a custom board with nRF52840-based BL654 module on it. I am using SDK15.3.0 and SoftDevice S140 v6.1.1.

Some of you already helped me to properly configure the clock for SoftDevice (link). Here is how I configured it (RC clock with 500ppm accuracy because BL654 is using on-chip 32768 RC oscillator - page 34 of this datasheet):

#ifndef NRF_SDH_CLOCK_LF_SRC
#define NRF_SDH_CLOCK_LF_SRC 0
#endif

// <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. 
#ifndef NRF_SDH_CLOCK_LF_RC_CTIV
#define NRF_SDH_CLOCK_LF_RC_CTIV 16
#endif

// <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. 
// <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
// <i>  if the temperature has not changed.

#ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
#define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
#endif

// <o> NRF_SDH_CLOCK_LF_ACCURACY  - External clock accuracy used in the LL to compute timing.
 
// <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
// <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
// <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
// <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
// <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
// <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
// <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
// <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
// <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
// <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
// <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
// <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 

#ifndef NRF_SDH_CLOCK_LF_ACCURACY
#define NRF_SDH_CLOCK_LF_ACCURACY 1
#endif

// </h> 

Everything worked great and I was able to debug my code with Bluetooth Low Energy tool of nRF Connect app through nRF52840 dongle. I did not work on the development during the last few weeks. This morning, I started my development again and I experience random and strange BLE disconnect events between my custom board and Bluetooth Low Energy tool. The reason for disconnection is BLE_HCI_CONNECTION_TIMEOUT. I was able to understand the reason of this  disconnect event from here.

However, I am quite confused what could happen during the last few weeks that is causing BLE_HCI_CONNECTION_TIMEOUT events!? Do you guys have any idea?

Did I properly configured my SoftDevice clock? Could it be that something strange happened with the on-chip RC oscillator of my BL654 module (I have two custom boards and they both behave the same)? Finally, is there somethnig wrong with the  Bluetooth Low Energy tool of nRF Connect app? I am using latest Version 2.3.1 of Bluetooth Low Energy tool and version v3.1.0 of nRF Connect app.

Thank you, guys, for your time and effort! It is really appreciated.

Sincerely,

Bojan.

  • Hi,

    Where specially are you seeing the BLE_HCI_CONNECTION_TIMEOUT ? 

    Is both the central(nRFConnect with nRF52840 dongle) and the peripheral(your custom  board) reporting this error ?

    Do you have any debug logs from your custom board? Maybe it's entering the error-handler, and being reset ?

  • Hello ,

    Thanks for your reply.

    I see this BLE_HCI_CONNECTION_TIMEOUT error inside my Bluetooth Low Energy tool:

                                                       

    While communicating with Bluetooth Low Energy tool my custom board is in Debug mode through Segger Embedded Studio. Custom board does not report any error, it just freezes ! Is there any handler function on SDK side for handling BLE_HCI_CONNECTION_TIMEOUT events?

    Sincerely,

    Bojan.

  • Hello ,

    It seems that the problem comes from my board. It's like nRF52840 freezes when I establish BLE connection with Bluetooth Low Energy tool and start sending data from my PC. Sometimes I can read err_code = 0x002af7ed, sometimes, err_code = 0xd8f8abee, sometimes err_code = 0x00000000

    I tried to implement the same code inside nRF5284 DK board and the code seems to behave the same way (CPU freezes after some time). The strange thing is the fact that I did not experience such an issue with freeze only three weeks ago and I did not touch my firmware in the meantime!

    Where can I find about the meaning of err_code? How can I chase where the issue is based on the err_code?

    Thanks in advance,

    Bojan.

  • Where can I find about the meaning of err_code? How can I chase where the issue is based on the err_code?

    You need to look up the documentation of the function that returned that error-code.

    Do you know which function returned 0x002af7ed and 0xd8f8abee ?

    If you are debugging this with SES, you might find this video useful.

Related