stability of changing adverting data

3 posts / 0 new
Last post
Alex Luo
Offline
Last seen:1 year 1 month ago
Expert
加入:2014-02-28 19:16
stability of changing adverting data

Hi Dialog team,

I changed the advertising data dynmically and it works on, but something very sensity and caused stability issue some times.

I changed the avertising data by usting globle variable, which updated by a timer with 1sec period, followed the app_adv_stop() and then app_adv_start. If app_adv_stop() directly followed by app_adv_start(), it doesn't work, no advertising out. If I put sometings in between, it doesn't work either. Only when I insert one thing such as i++ in between, it works well.

When I test its stability with changing the status frequently, sometimes advertising stopped or can't be connected. I used sample_128.

Look foreward to hearing your answer and help.

Thanks!
Alex

VesaN
Offline
Last seen:5 years 4 months ago
Guru Master
加入:2014-06-26 08:49
Hello Alex,

Hello Alex,

perhaps the problem is that there is stillGAPM_CANCEL_CMDmessage pending sent byapp_adv_stop. Perhaps one "right way" is to use GAP event handler. Openapp_task_handlers.hand search for listener forGAPM_CMP_EVT. Add if not yet added, though should be added by default. Find functiongapm_cmp_evt_handlerinapp_task.c. Find, e.g.,case GAPM_ADV_UNDIRECT. Hopefully this helps!

gl_dialog
Offline
Last seen:3 years 3 months ago
Staff
加入:2014-02-07 13:35
Hi Alex,

Hi Alex,

Pleaase have a look at the Beacon user manual which explains how to do it:

http://support.dialog-semiconductor.com/system/files/UM-B-019_DA14580_Be...

I suggest you to have a look at the beacon SW too:

http://support.dialog-semiconductor.com/da14580-reference-design-beacon

下面是答案:

How to dynamically change the advertising data?

1. Define CFG_DYNAMIC_BEACON_DATA in the da14580_config.h header file.

A process of counting transitions to BLE event end in the app_asynch_trm() function in advertising mode can be used. This process checks when the BLE event state moves to BLE_EVENT_END in order to count advertising events, while the current data are broadcast.

The BLE state is obtained by calling function app_last_rwble_evt_get(). When the maximum number of advertising iterations is reached, the advertising data will be automatically dynamically changed.

2. The number of advertising iterations in the Beacon reference software is determined by the value of definition MAX_BEACON_ADVERTISE_COUNTER in the app_sleep.h header file.

Once a timeout has occurred, a GAPM_CANCEL operation must be executed. This can be done by calling the app_adv_stop() function.

Upon completion of the GAPM_CANCEL operation, a timer is started for the advertising interval.

Advertising can then be restarted by calling the app_adv_start()function in the timer handler.

regards,

DIALOG_TEAM.