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

Multilink Central Example does not work with high connection intervals

If I set the centrals connection intervals values higher as a specific value it won't any longer find/connect/enable notifications on my peripheral.

0x00A0/0x0050/400/700/0/8100 working

0x00A0/0x0050/400/800/0/8100 not working.

0x00A0/0x0050/500/800/0/8100 not working.

0x00A0/0x0050/4000/4000/0/8100 not working. (preferred one)

This leaves me really clueless :( Of course I tried a lot more combinations.. I want to use the maximum interval of 4seconds. What else could cause this problem?

Central: (SD2.0.0 SDK8.0)(nRF51-DK)

#define SCAN_INTERVAL                    0x00A0                                         /**< Determines scan interval in units of 0.625 millisecond. */
#define SCAN_WINDOW                      0x0050                                         /**< Determines scan window in units of 0.625 millisecond. */

#define MIN_CONNECTION_INTERVAL          MSEC_TO_UNITS(2000, UNIT_1_25_MS)                /**< Determines minimum connection interval in millisecond. */
#define MAX_CONNECTION_INTERVAL          MSEC_TO_UNITS(4000, UNIT_1_25_MS)                /**< Determines maximum connection interval in millisecond. */
#define SLAVE_LATENCY                    0                                              /**< Determines slave latency in counts of connection events. */
#define SUPERVISION_TIMEOUT              MSEC_TO_UNITS(8100, UNIT_10_MS)                /**< Determines supervision time-out in units of 10 millisecond. */

Peripheral: (SD 7.1.0 SDK 6.1)(Custom Board: Seeed BLE Micro)

#define APP_ADV_INTERVAL                   MSEC_TO_UNITS(500, UNIT_0_625_MS)           /**< The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */
#define APP_ADV_TIMEOUT_IN_SECONDS         0                                        /**< The advertising timeout (in units of seconds). */

#define MIN_CONN_INTERVAL                  MSEC_TO_UNITS(2000, UNIT_1_25_MS)           /**< Minimum acceptable connection interval (0.5 seconds). */
#define MAX_CONN_INTERVAL                  MSEC_TO_UNITS(4000, UNIT_1_25_MS)          /**< Maximum acceptable connection interval (1 second). */
#define SLAVE_LATENCY                      0                                          /**< Slave latency. */
#define CONN_SUP_TIMEOUT                   MSEC_TO_UNITS(8100, UNIT_10_MS)            /**< Connection supervisory timeout (4 seconds). */

It works with smaller intervals.. But these should be in range and fulfill all requirements.. don't they?(MCP@Android can still connect to the peripheral - so probably a central setting is out of bonds? but which and why?)(also tried Scan_interval=Scan_window)

Rule from ble_gap.h

 * @note If both conn_sup_timeout and max_conn_interval are specified, then the following constraint applies:
 *       conn_sup_timeout * 4 > (1 + slave_latency) * max_conn_interval

central main.c

peripheral main.c

I tested it now with unchanged example. And then only changed settings on central and then on central+peripheral. Only unchanged worked. Changed min/max/timeout to 2000/4000/8100 and changed nothing else.

default settings.txt

central_changed.txt

both_changed.txt

Disconnect Reason 0x0008.. so it timed out?

I thought the connection interval would only affect everything AFTER service discovery..

I do measurements on the periphal and send them with sd_ble_gatts_hvx. I just want to use as less power as possible. So only have the central and espeically the peripheral only wake up every x seconds to do the measurement and send them to the central.

The measurement and hvx is done by an timer. And works from 500ms-4s as far as I have tested. But shouldn't it be ok to use the same connection interval?

How much is the power use of an connection event where they do like nothing anyway?

Parents
  • Hi,

    Error 0x0008 corresponds to BLE_HCI_CONNECTION_TIMEOUT. A common source for this error is timing issues caused by poor accuracy on the low frequency 32,768Hz crystal. According to the Seeed BLE Micro schematic there is an external crystal, but it doesn't say anything about the accuracy. Try to increase the ppm value in SOFTDEVICE_HANDLER_INIT() called in main.c. Try the largest value first: NRF_CLOCK_LFCLKSRC_XTAL_500_PPM.

    Here is a great thread explaining a bit about various low frequency clock sources.

    The reasons why I suspect a timing issue is that your values work fine on my own development kits from Nordic (with known clock accuracies). It just takes a long time for the devices to connect (a few seconds to a couple of minutes). On the peripheral side I have a PCA10001 kit with S110 V7.1 and SDK V6.1. On the central side I have a nRF51 Dongle (also tried DK) with S120 V2.0.0 and SDK V8.1 (also tried V8.0).

    To understand why it takes so long for your two devices to connect you can have a look at this thread. Your advertise interval is pretty high and your scan interval/window pretty low. Hence it will take a while before the peripheral is advertising and the central is listening at the same time (To make absolutely sure that the windows and intervals eventually overlap a small random delay is added to the advertisement interval).

    Here is a little more info about intervals etc.

    To speed up the connection time you can experiment with decreasing the adv interval or maybe also increase the scan interval and/or window. However this will draw power, as you know. In the end you will have to compromise. If you plan to stay most of the time advertising then maybe a long adv interval is best. If you, on the other hand, stay connected most of the time you can have short adv intervals and long connection intervals.

  • I see. Great post! Thank you! But you also just mention advertising interval and scan interval/window. But also if I only change min/max connection interval from 500/500 to 4000/4000 the time it takes for the first measurement to show up increases from ~15seconds to slightly over 2 minutes. And this is what I can't explain by myself. I just went home now and left my setup at the university. I will play around with the values again tomorrow to see what I can achieve.

    Advertising intervall 20ms and 
    #define SCAN_INTERVAL                    0x0029
    #define SCAN_WINDOW                      0x0028 
    

    shouldn*t this connect in no time? still takesmore than 20seconds after the central starts scanning

Reply
  • I see. Great post! Thank you! But you also just mention advertising interval and scan interval/window. But also if I only change min/max connection interval from 500/500 to 4000/4000 the time it takes for the first measurement to show up increases from ~15seconds to slightly over 2 minutes. And this is what I can't explain by myself. I just went home now and left my setup at the university. I will play around with the values again tomorrow to see what I can achieve.

    Advertising intervall 20ms and 
    #define SCAN_INTERVAL                    0x0029
    #define SCAN_WINDOW                      0x0028 
    

    shouldn*t this connect in no time? still takesmore than 20seconds after the central starts scanning

Children
No Data
Related