nRf52832 bluetooth extended advertisement using nrf connect for vscode

I am exploring the 'central_and_peripheral_hr' example in nRF Connect for VS code. By modifying the given example slightly, I am able to advertise 16 bytes of data in the 'ManufacturerSpecificData' field. I have read on DevZone that the limit for a standard packet is 31 bytes and up to 255 bytes in extended packet type. I also observed that when I change the number of bytes to 24 then no BT device is found. However, I could not find any helpful examples related to this. I have also checked the periodic advertising example, but I have not been able to find any devices using that example.
I am using the nRF52-52832dk as a scanner with the Bluetooth LE app in nRF Connect for Desktop, and another nRF52-52832dk as my main board to advertise data. Here is a part of my code:

int res;

res = bt_le_adv_stop();
if(res)
{
	printk("************ADV STOP failed!************\n");
	return;
}
printk("************ADV STOP successful!************\n");

struct bt_data dt_bt_ad[] = {
	BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE),
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
	BT_DATA(BT_DATA_MANUFACTURER_DATA, myDataBytes, sizeof(myDataBytes)),
};

res = bt_le_adv_start(BT_LE_ADV_CONN, dt_bt_ad, ARRAY_SIZE(dt_bt_ad), sd, ARRAY_SIZE(sd));
if (res) {
	printk("Advertising failed to start (err %d)\n", res);
	return;
}
printk("Advertising started\n");

Parents Reply
  • I tried the example you mentioned. In the code, I am adding some bytes in array.

    static uint8_t mfg_data[BT_MFG_DATA_LEN] = { 0xFF, 0xFF };  // original
    static uint8_t mfg_data[BT_MFG_DATA_LEN] = { 0xFF, 0xFF, 0x01, 0x02, 0x03, 0x04};   // bytes added

    And for scanning, I am using another nrf52dk with an observer example. On serial terminal, I can see various parameters but where can I see the data that I have added? Because I also want to update this data at runtime and on central side I want to extract this data after scanning and do some tasks depending on what the peripheral is advertising.

Children
Related