Not possible to re-start advertising

With the latest SDK 2.6.0, I am developing from the existing NRF5340 audio application for a receiver, to allow an ACL connection from a mobile app. Advertising starts fine, connection gets established from the central app without issues. 

The problem I am having is that when the app manually disconnects itself from the receiver, advertising tries to start again, but can not with the following issue : 

<err> bt_mgmt_adv: Failed to start advertising set. Err: -12

This means not enough core. 

I have tried to resolve this by calling bt_le_ext_adv_stop() and even bt_le_ext_adv_delete() in bt_mgmt_adv_start() before bt_le_ext_adv_create() gets called. This didn't solve it.

I have also tried to solve it by calling bt_le_ext_adv_stop() right before bt_le_ext_adv_start() inside advertising_process().

The same -12 error occurs no matter what. Everything else inside advertising_process() executes without an error , and only bt_le_ext_adv_start() fails. 

At this stage i'm not sure if it's an issue with the SDK or I am doing something wrong. Thanks in advance for any support. 

Parents
  • void disconnected(struct bt_conn* disconn, uint8_t reason) {
      if (conn) {
        bt_conn_unref(conn);
        conn = NULL;
      }
    
      printErr("Disconnected (reason %u)", reason);
    
      struct bt_data device_name_data = {
        .type     = BT_DATA_NAME_SHORTENED,
        .data_len = strlen(device_name),
        .data     = (const uint8_t*)device_name
      };
    
      ad[1] = device_name_data;
    
      // Start advertising again
      // int err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
      int err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));
      if (err)
        report_and_halt("Advertising failed to start (Error %d)", err);
      else
        printLargeInfo("Advertising started");
    }

    Try this

  • Hi  

    I can't use the function bt_le_adv_start() in my case due to previous issues. 

    Advertising must start by calling bt_mgmt_adv_start() which calls bt_le_ext_adv_create()

Reply Children
No Data
Related