advertising data stops updating

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
6 posts / 0 new
Last post
Anonymous (not verified)
advertising data stops updating

I have set a manufacturer specific data string in the advertising data. I use a OS_timer to call a function repeatedly to update the advertising data. using the following code:

static void mnf_tim_cb(OS_TIMER timer)
{

// hw_gpio_toggle(HW_GPIO_PORT_1, HW_GPIO_PIN_5);//devkit use 0_7 for device

mnf_flag_1++;
ble_gap_adv_stop();

if(mnf_flag_1 == 0xFF)
mnf_flag_1 = 0x04;

adv_data[10] = mnf_flag_1;
ble_gap_adv_data_set(sizeof(adv_data), adv_data, name_len + 2, scan_rsp);

ble_gap_adv_start(GAP_CONN_MODE_UNDIRECTED);
}

The problem it updates before the extended sleep cycle starts. Once the sleep cycle starts it stops updating the advertising data. I have confirmed that the timer callback function is being executed as i toggle the LED to see it.
I have tried with stop and start advertising and without it also.
With stop and start it never updates the data; without those commands however it updates perfectly until the sleep cycle starts.
What can be the problem.

Warm Regards

Device:
mutahir (not verified)
also this is using prox

also this is using prox-reporter as base

MT_dialog
Offline
Last seen:1 month 1 week ago
Staff
Joined:2015-06-08 11:34
Hi mutahir,

Hi mutahir,

Try to stop the advertising in the timer that you have set and then catch the advertising completion message in your main task, BLE_EVT_GAP_ADV_COMPLETED, in that handler, change the advertising string and then start advertising.

Thanks MT_dialog

mutahir (not verified)
I have tried this, but it's

I have tried this, but it's not working. As soon as the sleep cycle starts it stops updating. With sleep disabled in debug mode it keeps updating.
Tried the same thing with ble_prepherial project and that works correctly.

Please Help.

MT_dialog
Offline
Last seen:1 month 1 week ago
Staff
Joined:2015-06-08 11:34
Hi mutahir,

Hi mutahir,

Follow the procedure i ve descibed and also make sure that the data that you ve placed in the advertising string belongs to the retain section of memory, have the the adv_data that you are using as INITIALISED_PRIVILEGED_DATA variable.

Thanks MT_dialog

mutahir (not verified)
Thanks! using it as

Thanks! using it as INITIALISED_PRIVILEGED_DATA fixed the problem.

Thanks for the help. Much appreciated.