Ble advertising 52840 random pauses

Hi, 

I'm trying to setup a simple BLE Advertising beacon the broadcasts once per 3 seconds, th problem Im having is it will do this for about 10 broadcasts then stop and rest for 7ish seconds before starting again?

any suggestion for what I'm doing wrong?

I am prototyping using bluefruit library that uses softdevice S140 7.3.0

below is my code.

void startAdv(void)
{
  // Advertising packet
  Bluefruit.setName("DROID");
  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
  Bluefruit.Advertising.addTxPower();
  Bluefruit.Advertising.addName();
  Bluefruit.Advertising.setType(BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED);  // for XIAO BLE

  Bluefruit.Advertising.restartOnDisconnect(true);
  Bluefruit.autoConnLed(false);

  Bluefruit.Advertising.setInterval(500, 3000); // in unit of 0.625 ms
  Bluefruit.Advertising.setFastTimeout(1);     // number of seconds in fast mode
  Bluefruit.Advertising.start(0);             // 0 = Don't stop advertising after n seconds
}

void disconnectPin(uint32_t ulPin)
{
  if (ulPin >= PINS_COUNT)
  {
    return;
  }

  ulPin = g_ADigitalPinMap[ulPin];

  NRF_GPIO_Type *port = nrf_gpio_pin_port_decode(&ulPin);

  port->PIN_CNF[ulPin] =
      ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | ((uint32_t)GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) | ((uint32_t)GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | ((uint32_t)GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | ((uint32_t)GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
}

void setup()
{

  flash.begin();
  Bluefruit.begin();
  Bluefruit.setTxPower(+8); // Check bluefruit.h for supported values
  flashTransport.begin();
  if (flashTransport.runCommand(0xB9)== false)
  {
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, LOW);
    while (1)
    {
      yield();
    }
  }

  flashTransport.end();

  flash.end();

  for (int i = 0; i < 25; i++)
  {
    disconnectPin(i);
  }
  sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
  sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
    startAdv();
    suspendLoop();
  __WFE();
  __WFI();
  sd_app_evt_wait();
}
Related