Extended Advertising on Coded PHY Questions

Hi,

I'm trying to understand the periphral_hr_coded sample (Bluetooth: Peripheral Heart Rate Monitor with Coded PHY — nRF Connect SDK 2.4.99 documentation (nordicsemi.com)) and had a couple of questions.

Firstly, in this function's block comment: bt_le_ext_adv_set_data

"If the advertising set has been configured to send advertising data on the primary advertising channels then the maximum data length is BT_GAP_ADV_MAX_ADV_DATA_LEN bytes. If the advertising set has been configured for extended advertising, then the maximum data length is defined by the controller with the maximum possible of BT_GAP_ADV_MAX_EXT_ADV_DATA_LEN bytes."

Could you explain how to "configure the advertising set" to send advertising data on either the primary or extended channels?

In addition, my goal is to place all of the advertising data in the extended advertisement, leaving the data payload of the primary advertisement empty. Could you check if my current code does this correctly?

static struct bt_le_ext_adv *adv;  // create struct instance

int err;


uint8_t manufDataBuff[]={0xFA, 0xF1, 0x02, 0x77, 0x02, 0x10, 0x31, 0x38,
							0x32, 0x31, 0x36, 0x33, 0x35, 0x30, 0x34, 0x35,
							0x37, 0x37, 0x39, 0x31, 0x31, 0x35, 0x31, 0x35,
							0x32, 0x33, 0x00, 0x00, 0x00};
struct bt_data dt_bt_conn_ad[] = {
	{
		.type = 0x16,  // Service Data
		.data_len = sizeof(manufDataBuff),  // 30 bytes
		.data = manufDataBuff,
	}
};

// both primary and extended packets should be LE Coded PHY
// advertise at 1 second interval
struct bt_le_adv_param param = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_NONE |
													BT_LE_ADV_OPT_EXT_ADV |
													BT_LE_ADV_OPT_CODED,
													1000,
													1000,
													NULL);

err = bt_le_ext_adv_create(&param, NULL, &adv);  // set parameters for adv
if (err) {
	printk("Failed to create advertiser set (err %d)\n", err);
	return err;
}

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

err = bt_le_ext_adv_set_data(adv, dt_bt_conn_ad, ARRAY_SIZE(dt_bt_conn_ad), NULL, 0);  // set data in adv
if (err) {
	printk("Failed to set advertising data (err %d)\n", err);
	return err;
}

Thanks,

Michael

Parents
  • Hi Michael, 

    When you configure this in your advertising param, the advertising set will use extended advertising: 

    When you do extended advertising, the payload is always transmitted in the auxiliary packet (AUX_ADV_IND) on the data channel(s). The primary advertising packets (ADV_EXT_IND) will only contain the Aux Ptr to point to the auxiliary packet. Please find the detail in the Bluetooth spec.


Reply
  • Hi Michael, 

    When you configure this in your advertising param, the advertising set will use extended advertising: 

    When you do extended advertising, the payload is always transmitted in the auxiliary packet (AUX_ADV_IND) on the data channel(s). The primary advertising packets (ADV_EXT_IND) will only contain the Aux Ptr to point to the auxiliary packet. Please find the detail in the Bluetooth spec.


Children
Related