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

Weird disconnection issues with ble_app_hrs example from SDK 15

For some reason the ble_app_hrs example from SDK 15 disconnects after around 30-40 seconds (every time) and shows this error in the RTT logger: " 0> <info> app: Disconnected, reason 34."

However, it does not happen with the ble_app_hrs example from SDK 12.3.

The only changes I made to both examples is set the internal LF clock source to RC because my custom PCB does not have external 32 KHz clock.

In the ble_app_hrs from SDK 15 I did this:

#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

And in the ble_app_hrs from SDK 12.3 I added 3 lines to ble_stack_init():

static void ble_stack_init(void)
{
uint32_t err_code;

nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

clock_lf_cfg.source = 0;
clock_lf_cfg.rc_ctiv = 16;
clock_lf_cfg.rc_temp_ctiv = 2;
//clock_lf_cfg.xtal_accuracy = 1;

// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

I redownloaded both SDK 12.3 and SDK 15 to make sure I didn't change anything else, but this problem still happens.

  • Hello TomerAb,

    Does this also happen if you run it on the DK (with internal RC)?

    Who is the hrs central in this case? Have you tried running ble_app_hrs togehter with our own ble_app_hrs_c?

  • Hi, I just tried to run it on the DK (PCA10400) it the same exact thing happens, just faster! I also tried the without changing anything (using the external LF) it happens as well!

    (Both times Disconnected, reason 34.)

  • Comparing the example from SDK 12.3 to SDK 14.2 and SDK 15, I suspect the problem lies with

    NRF_SDH_BLE_GATT_MAX_MTU_SIZE
  • Ok, so it had nothing to do with the internal vs external clock.

    What device are you interfacing?

    Have you tried running ble_app_hrs together with our own ble_app_hrs_c?

    Could it be that 12.3 would only use the default MTU, while SDK 15 will request a higher MTU? And whatever device you are interfacing is not happy with that?

  • Yes, looks like that was the problem, I changed it to the default one in SDK 15 and now it works.

    The hosts were Nexus 6P with Android 8.1 and Win10 Laptop.

    I think the official examples should not ask for something other than the default if there are a lot of devices which does not support it, it can confuse newcomers to SDK 15 like me :)

1 2