BLE Advertisement interval 10ms-20ms

I am using the nRF Connect SDK broadcaster example on the nRF52840. The default advertisement interval was set to "BT_GAP_ADV_FAST_INT_MIN_2 = 0x00a0" (100ms) to "BT_GAP_ADV_FAST_INT_MAX_2 = 0x00f0" (150ms), resulting in a 100ms interval. I then changed it to 30ms-60ms using "BT_GAP_ADV_FAST_INT_MIN_1 = 0x0030" and "BT_GAP_ADV_FAST_INT_MAX_1 = 0x0060," achieving a 30ms interval.

 bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad),
                              NULL, 0);

Now, I want to set the advertisement interval to 10ms-20ms. I attempted to use custom definitions such as "BT_GAP_ADV_FAST_INT_MIN_1_10ms = 0x0008" and "BT_GAP_ADV_FAST_INT_MIN_1_20ms = 0x0016," but it did not work; there was no advertisement occurring.

How can I achieve the desired advertisement interval of 10ms-20ms?

Note: I have also tried adjusting the definitions, but without success. I am using the nRF Power Profiler Kit to monitor the advertisement interval.

Parents
  • Hello,

    Now, I want to set the advertisement interval to 10ms-20ms. I attempted to use custom definitions such as "BT_GAP_ADV_FAST_INT_MIN_1_10ms = 0x0008" and "BT_GAP_ADV_FAST_INT_MIN_1_20ms = 0x0016," but it did not work; there was no advertisement occurring.

    Was this the only change you made to the project?

    What was the returned error code from the bt_le_adv_start call to start advertising?

    Best regards,
    Karl

Reply
  • Hello,

    Now, I want to set the advertisement interval to 10ms-20ms. I attempted to use custom definitions such as "BT_GAP_ADV_FAST_INT_MIN_1_10ms = 0x0008" and "BT_GAP_ADV_FAST_INT_MIN_1_20ms = 0x0016," but it did not work; there was no advertisement occurring.

    Was this the only change you made to the project?

    What was the returned error code from the bt_le_adv_start call to start advertising?

    Best regards,
    Karl

Children
  • CONFIG_GPIO=y
    CONFIG_BT=y
    CONFIG_BT_BROADCASTER=y
    CONFIG_BT_HCI_VS_EXT=y
    CONFIG_BT_HCI=y
    CONFIG_SERIAL=y

    Was this the only change you made to the project?

    Yes! this is my pro.conf

    What was the returned error code from the bt_le_adv_start call to start advertising?

    Currently, no error code is being returned. Additionally, I am unable to observe any advertisement packets on the NRF52840 dongle Bluetooth sniffer.

    #define BT_GAP_ADV_FAST_INT_MIN_1_10ms 0x0008
    #define BT_GAP_ADV_FAST_INT_MIN_1_20ms 0x0016
    
    
    #define BT_LE_ADV_NCONN_30 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_USE_IDENTITY, BT_GAP_ADV_FAST_INT_MIN_1_10ms, \
                                               BT_GAP_ADV_FAST_INT_MIN_1_20ms, NULL)
    
    void my_func(void)
    {
       int err;
    
       err = bt_enable(NULL);
    
       if (err)
       {
         printk("Bluetooth init failed (err %d)\n", err);
         return;
       }
       err = bt_le_adv_start(BT_LE_ADV_NCONN_30, ad, ARRAY_SIZE(ad),
                                  NULL, 0);
       if (err)
       {
         printk(" Advertisement failed (err %d)\n", err);
         return;
       }
       k_sleep(K_MSEC(100)); 
    
       err = bt_le_adv_stop();
       if (err)
       {
         printk("Advertising failed to stop (err %d)\n", err);
         return;
       }
    
       err = bt_disable();
       if (err)
       {
         printk("Bluetooth disable failed (err %d)\n", err);
         return;
       }  
    }
    
    
    
    int main(void)
    {
      /*other logics*/
      while (1)
      {
        my_func();
        k_sleep(K_MSEC(2000));
      }
    	return 0;
    }




    1.This is my observation from the power profiler, and I have attached an image from the power profiler for your reference.
    which is 

    "BT_GAP_ADV_FAST_INT_MIN_1 = 0x0030" and "BT_GAP_ADV_FAST_INT_MAX_1 = 0x0060,"


    2.After changing this value i get this 

    "BT_GAP_ADV_FAST_INT_MIN_1_10ms = 0x0008" and "BT_GAP_ADV_FAST_INT_MIN_1_20ms = 0x0016,"

  • Hello,

    Thank you for the clarifications.

    Please note that the advertising interval is defined as N*0.625 ms, which in your case places the min and max at 5-10ms, which is lower than the lower boundary for advertising intervals (except for high-duty directed advertising) which is 20 ms.
    There will also be added a random delay of 0-10 ms to your advertising interval, to avoid repeated collisions, which you can see in the power profiler trace.

    This slipped my mind earlier, apologies for any confusion this might have caused! :) 

    Still it is strange that you did not see any returned error codes, however - perhaps the logging is not set up correctly.

    Best regards,
    Karl

Related