When BLE is paired, advertising cannot be restarted

Hi,

After updating to NCS 2.9.0, I found that if the device is already paired, advertising cannot be started. I have configured CONFIG_BT_MAX_CONN=3.

E: Failed to start advertiser
E: Failed to start BLE advertising: -12
E: Could not start BLE advertising

Parents
  • Hello,

    It is difficult to say without more context. What function returned the value -12? Are you doing normal BLE advertising, or do you have some other radio protocol as well?

    Does your build log say anything that would suggest that the CONFIG_BT_MAX_CONN is not set to 3?

    Do you support scanning/central? CONFIG_BT_CENTRAL=y?

    If so, you also need to specify:

    CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=2

    or whatever value you want it to be. It will default to 1 if CONFIG_BT_CENTRAL is set to y.

    Best regards,

    Edvin

  • Hi,

    Basically, my BLE service is built based on NUS. So it's just normal advertising. What other information do you need to diagnose the issue? By the way, I don't need the CENTRAL role.

    bool BleService::StartAdvertising() {
      if (madvStarted) {    
        LOG_INF("BLE advertising is already started");
        return false;
      }
    
      CHIP_ERROR ret = BLEAdvertisingArbiter::InsertRequest(mAdvertisingRequest);
            
      if (CHIP_NO_ERROR != ret) {
        LOG_ERR("Could not start BLE advertising");
        return false;
      }
      madvStarted = true;
    
      LOG_INF("BLE advertising has started");
      return true;
    }

  • Edvin said:

    Are you doing normal BLE advertising, or do you have some other radio protocol as well?

    So you are using Matter, right? Is that intentional, or did you choose this application because it was using C++?

  • Hi,

    Yes, the example I used is NCS 2.9.0 Matter Lock. The expected state is Matter + BLE + multiple-to-one connection.

  • At this point, is the device provisioned into your Matter network, or is it not?

    Best regards,

    Edvin

  • Hi,

    No, I did not use any features related to Matter. Please focus on the BLE advertising issue. I believe that when CONFIG_BT_MAX_CONN is greater than 1, the device should automatically restart advertising after a successful pairing.

    The error message "Failed to start BLE advertising: -12" is the result of my intentional call to BleService::StartAdvertising. In reality, BLE advertising should restart automatically, but it is clear that this version of the SDK does not handle it correctly.

    If I want to allow multiple pairings, besides CONFIG_BT_MAX_CONN, what other configurations are required?

Reply
  • Hi,

    No, I did not use any features related to Matter. Please focus on the BLE advertising issue. I believe that when CONFIG_BT_MAX_CONN is greater than 1, the device should automatically restart advertising after a successful pairing.

    The error message "Failed to start BLE advertising: -12" is the result of my intentional call to BleService::StartAdvertising. In reality, BLE advertising should restart automatically, but it is clear that this version of the SDK does not handle it correctly.

    If I want to allow multiple pairings, besides CONFIG_BT_MAX_CONN, what other configurations are required?

Children
Related