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");