Hi,
I've done a lot of searching and Googling and could not find a proper answer for the life of me, so I'm posting again here to try to find answers. I must have looked into dozens of threads and pages by now, but here are some of the ones I've looked at:
https://devzone.nordicsemi.com/f/nordic-q-a/27120/changing-ble-connection-interval-time
https://devzone.nordicsemi.com/f/nordic-q-a/23802/more-trouble-with-changing-ble-connection-interval
https://devzone.nordicsemi.com/f/nordic-q-a/33644/nrf52-sdk13-connection-parameter-negotiation
I'm trying to change the advertising interval of my BLE application and I am testing it by using the Power Profiling Kit with nRF Connect for Desktop. It is built using the nRF5_SDK_14.2.0_17b948a. I also care about the connection interval, but I will take it one problem at a time starting with the advertising interval.
Here is the default chunk of code that I believe is relevant to changing advertising (and connection) intervals:
#define APP_ADV_INTERVAL 64 /**< The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */ #define APP_ADV_TIMEOUT_IN_SECONDS 180 /**< The advertising timeout (in units of seconds). */ #define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */ #define MAX_CONN_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */ #define SLAVE_LATENCY 0 /**< Slave latency. */ #define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
Here is a screen-capture from the Power Profiling Kit with these values. Keep in mind that this is without any kind of BLE connection -- this is purely in advertising mode:
As you can see, the 40ms advertising interval shows up as expected. There are 5 pulses and some approximation shows that there are about 40-45ms between each pulse which is fine. However, what happens when I change the parameters? What if I double everything?
#define APP_ADV_INTERVAL 128 /**< The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */ #define APP_ADV_TIMEOUT_IN_SECONDS 180 /**< The advertising timeout (in units of seconds). */ #define MIN_CONN_INTERVAL MSEC_TO_UNITS(40, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */ #define MAX_CONN_INTERVAL MSEC_TO_UNITS(150, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */ #define SLAVE_LATENCY 0 /**< Slave latency. */ #define CONN_SUP_TIMEOUT MSEC_TO_UNITS(8000, UNIT_10_MS) /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
Here's the result:
There's basically no difference at all. I'm trying to save power on my application by reducing advertising and connection interval, but I just can't get it to work... PLEASE someone shed some light on this issue for me. Those defined macros in the beginning like MIN_CONN_INTERVAL, MAX_CONN_INTERVAL, and APP_ADV_INTERVAL seem to be 100% worthless. Where in the code am I actually supposed to go to change the intervals?