multiple connectable advertisement sets / Mixed mode advertising

Hi,

Im trying to advertise on coded PHY and 1M at the same time using 2 advertising sets, one for 1M and one for coded PHY, Im always getting error 12 on creating the second advertisement set and I dont know why?

here is all the code thats needed to reproduce, I just put that into the multiple advertiser example and added CONFIG_BT_CTLR_PHY_CODED.

static const struct bt_le_adv_param testparams = {
    .id = BT_ID_DEFAULT,
    .sid = 0,
    .options = BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_NAME | BT_LE_ADV_OPT_EXT_ADV |
           BT_LE_ADV_OPT_CODED,
    .interval_min = BT_GAP_ADV_FAST_INT_MIN_2,
    .interval_max = BT_GAP_ADV_FAST_INT_MAX_2,
};
static const struct bt_le_adv_param testparams2 = {
    .id = BT_ID_DEFAULT,
    .sid = 1,
    .options = BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_NAME | BT_LE_ADV_OPT_EXT_ADV,
    .interval_min = BT_GAP_ADV_FAST_INT_MIN_2,
    .interval_max = BT_GAP_ADV_FAST_INT_MAX_2,
};

static int advertising_set_create(struct bt_le_ext_adv **adv, const struct bt_le_adv_param *param,
                  const struct bt_data *ad, size_t ad_len)

{
    int err;
    struct bt_le_ext_adv *adv_set;

    err = bt_le_ext_adv_create(param, NULL, adv);
    if (err) {
        return err;
    }

    adv_set = *adv;

    printk("Created adv: %p\n", adv_set);

    err = bt_le_ext_adv_set_data(adv_set, ad, ad_len, NULL, 0);
    if (err) {
        printk("Failed to set advertising data (err %d)\n", err);
        return err;
    }

    return bt_le_ext_adv_start(adv_set, BT_LE_EXT_ADV_START_DEFAULT);
}

void start()
{
    int err = advertising_set_create(&ext_adv[CONNECTABLE_ADV_IDX], &testparams, NULL, 0);

    err = advertising_set_create(&ext_adv[NON_CONNECTABLE_ADV_IDX], &testparams2, NULL, 0);

    if (err) {
        printk("Failed to create a connectable advertising set (err %d)\n", err);
    }

}

the problem seems to only exist if im trying to use connectable advertisements. the example normally uses one connectable and one broadcasting advertisement.
Any Ideas on what the problem is?
kind regards,
Jonas
Related