Hi guys,
I am using nrf52840 with sdk15.2 and have been experiencing some strange issue. After mobile phone connection to the device i lost 1 byte in advertisement or saying differently my device is advertising 1 byte less.
I am using sdk command ble_advdata_encode
. Have you ever experienced this kind of issue? Is there something that could trim the data?
Here is my wrapped adv function:
ret_code_t nordic_advertiser_adv_set(uint16_t companyId, uint8_t *data, uint16_t len) {
ret_code_t err_code;
ble_advdata_t advdata;
ble_advdata_service_data_t service_data;
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_NO_NAME;
advdata.include_appearance = false;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
service_data.service_uuid = companyId;
service_data.data.p_data = data;
service_data.data.size = len;
advdata.p_service_data_array = &service_data;
advdata.service_data_count = 1;
if (adv_params.primary_phy == BLE_GAP_PHY_CODED) {
err_code = ble_advdata_encode(&advdata, m_phy_data.adv_data.p_data, &m_enc_phy_len);
if (err_code != NRF_SUCCESS) {
return (err_code);
}
return (sd_ble_gap_adv_set_configure(&m_adv_handle, &m_phy_data, NULL));
}
err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
if (err_code != NRF_SUCCESS) {
return (err_code);
}
return (sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, NULL));
}
Thanks