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

Advertisement interval Vs Connection interval

Is it possible to have a fast advertisement interval (for connecting and bonding/pairing) for example: 40msec; at the same time, have a slow connection interval (after connection has established) - for example 1 second? This is because in my project, I have 13 characteristics and for the connection to be successful every single time, the advertisement interval needs to be faster. Once connected, I need the number of CPU blocks to be as minimal as possible (because of highly sensitive algorithm). Hence, after connection has established, I need the connection interval to be 1 second or more. Please help.

Parents
  • As anweil pointed out, Advertising Interval and Connection Interval are independent from each other.

    If you want to force a connection to have a certain Connection Interval (CI), you should set MIN_CONN_INTERVAL and MAX_CONN_INTERVAL to the same value. But beware that not all devices support every CI. Some more information here.

    As to your other question (re-connect), yes, you may choose a different Advertising Interval for each situation. In your code, there should something like:

    ble_gap_adv_params_t advertising_parameters;
    ....
    advertising_parameters.interval = APP_ADV_INTERVAL;
    ....
    sd_ble_gap_adv_start(&advertising_parameters);
    

    In that piece of code ADVERTISING_INTERVAL is a #define, which makes it constant. This is similar to what is provided on the Nordic examples. However, you may instead use a variable, and set it for the value that you wish, depending on the situation, using

    advertising_parameters.interval = my_adv_interval;
    
  • If I'm not mistaken, the device stops advertising once it connects. If the device becomes disconnected, you have to run the advertising start procedure. If you use a variable as said above, you can change the interval at will, and the change will become effective wonce you start advertising again. I'm not 100% sure on this matter, so please correct me if I'm wrong.

Reply Children
No Data
Related