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

Dynamically updating advertisement data results in BLE_ERROR_GAP_UUID_LIST_MISMATCH error 0x3200

We are trying to update the BLE Advertisement using ble_advertising_advdata_update, the function seems to always return 0x3200 and ble_gap.h:178 tells me its a BLE_ERROR_GAP_UUID_LIST_MISMATCH.

We are using two static allocated buffers, mentioned in https://devzone.nordicsemi.com/f/nordic-q-a/32824/dynamically-updating-advertising-data-in-sdk-15

We initialized the advertisement with ble_advertising_init and started with ble_advertising_start and the advertisement works perfectly except for updating the advertisement.

void on_update_advertisment(void)
{
	ble_gap_adv_data_t * p_adv_data = NULL;
	
	// check which buffer is used
	if (m_advertising.adv_data.adv_data.p_data == m_beacon)
	{
		p_adv_data = &adv_data1;
	}
	else 
	{
		p_adv_data = &adv_data2;
	}
		

    /** change some data in advertisment buffers **/
	
	ret_code_t ret = ble_advertising_advdata_update(&m_advertising, p_adv_data, true);
	APP_ERROR_CHECK(ret); // 0x3200 
}

We are using SDK 15.3.0, Softdevice S340 v6.1.1, Developing with Visual Studio VisualGDB

Hope someone has a suggestion on how to do this properly, for now we will stop/start-ing the advertisement, which works perfectly.

  • Hi,

    The error indicates that sd_ble_gap_adv_set_configure() detected an invalid UUID field in your encoded payload. So I think it's more relevant to look at how the buffers are updated. Maybe the payload is not encoded correctly. Do you use the APIs in ble_advdata for encoding?

    The buffer swapping looks good. A test to confirm this could be to do a "memcpy" of the original buffer making  adv_data1 and adv_data2 contain the same data, then see if you still get the error.

    As a side note, the ble_advertising_advdata_update() implementation in SDK 16.0.0 now includes an internal swap buffer to make dynamic updates easier.

  • So if the advertisement also contains a UUID for a service it needs to be encoded correctly. For now stopping and starting the advertisement re-encodes our advertisement, for now we will keep it this way.

Related