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

  • Seems about right. From the latest migration notes: The SoftDevice now supports advertising up to 255 bytes of advertising data. The macro BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_MAX_SUPPORTED is added to indicate this. For connectable extended advertising, the maximum advertising data size is 238 bytes, as indicated by BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_CONNECTABLE_MAX_SUPPORTED.

    You can find the migration note in nRF5_SDK_15.2.0_9412b96\nRF5_SDK_15.2.0_9412b96\components\softdevice\s140\doc

Related