This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Maximum Amount of Data That Can Be Sent Through Extended Advertisements nRF52840

Through doing some implementations of extended advertisements between two nRF52840 boards, I have found the maximum amount of data that I can put into an extended advertisement payload is 238 bytes, with the amount of custom data that I can send through the "manufacturer specific data" to be 218 bytes. Does this seem about correct?

Here is the code I am using to initialize the advertising (I am advertising with no name, no appearance, the device mac address, and manufacturer specific data where I am putting my custom data):

/**@brief Function for initializing the advertising functionality.
*/
static void advertising_init(void)
{

ret_code_t err_code;
ble_advertising_init_t init;

memset(&init, 0, sizeof(init));

init.advdata.include_ble_device_addr = true;
init.advdata.name_type = BLE_ADVDATA_NO_NAME;
init.advdata.include_appearance = false;
init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
init.advdata.uuids_complete.p_uuids = m_adv_uuids;

ble_advdata_manuf_data_t manuf_data; //Variable to hold manufacturer specific data
uint8_t data[] =
"blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahbla"
"asdlfkjalsdkjfalsdkjfalsdkjfalsdkjfalsdkjfalsdkjfalsdkjfalsdkjf"
"asdfashasdasdfasdgafadfgadfgafgasdfasfgadfgdsfgasdgafgdsfgasdfa"
"asdfashasdasdfaasdfghjklqwer";
manuf_data.company_identifier = 0xFFFF; //Nordics company ID
manuf_data.data.p_data = data;
manuf_data.data.size = sizeof(data);
init.advdata.p_manuf_specific_data = &manuf_data;

NRF_LOG_INFO("Size of manufacturer specific data: %d", manuf_data.data.size);

init.config.ble_adv_extended_enabled = true;
init.config.ble_adv_fast_enabled = true;
init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
init.config.ble_adv_fast_timeout = APP_ADV_DURATION;

init.evt_handler = on_adv_evt;

err_code = ble_advertising_init(&m_advertising, &init);
APP_ERROR_CHECK(err_code);

ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
}

Related