Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Fix for issue with updating advertising data in SDK 15

Hi,

I just wanted to report that there is an issue with the solution suggested in this thread. Even when you manually manage double buffers outside the ble_advertising module, the module reconfigures the advertising data using an internal data buffer every time the advertising mode changes (i.e. from idle to fast, from fast to slow, etc).

Since the ble_advertising_advdata_update() function has problems, I solved this issue by creating a new function that copies the external data buffer into the internal data buffer. In this way, the internal data buffer used to configure the advertising data when changing modes has the same data as the one you're managing externally.

The function is very simple and it looks as follows:

void ble_advertising_advdata_copy(ble_advertising_t  * const p_advertising,
                                  ble_gap_adv_data_t * const p_new_advdata_buf)
{
	memcpy(&p_advertising->adv_data, p_new_advdata_buf, sizeof(p_advertising->adv_data));
}

Calling this function when reconfiguring the adv data externally solved my issues with the advertising data being set to initialization values when the advertising mode changes.

Related