programatically change advertising rate

21个帖子/ 0新
最后一篇
马达
离线
最后一次露面:5 years 6 months ago
专家
加入:2014-01-20 21:48
programatically change advertising rate

我想根据连接到DA14580的传感器的数据更改广告间隔。我计划通过将App.c中的行209和210更改为App.c中的第209和210来完成此目的,该变量可以由另一个函数更新。

所以我会在app.c上有这样的东西:
void app_adv_start(void)
{
......
cmd-> intv_min = current_app_adv_int_min;//是app_adv_int_min.
cmd-> intv_max = current_app_adv_int_max;//是app_adv_int_max.
.......
}

Will this work? Is this the best way of accomplishing this?

Thanks for any help you can give.

gl_dialog(未经验证)
亲爱的马特拉德,

亲爱的马特拉德,

当您在需要更改广告间隔时,必须更改App.c中的209和210行。
所以你提到的功能很好。
Note that current_app_adv_int_min & current_app_adv_int_max must be the same.

此致,

guillaume。

oren
离线
最后一次露面:1年7个月前
专家
加入:2014-06-28 22:03
嗨guillaume,

嗨guillaume,
如果您设置INTV_MIN和INTV_MAX彼此不同,您是否知道会发生什么?
从我的测试中,当INTV_MIN

你知道是否有任何副作用?如果忽略INTV_MIN,它对什么是好的?
(我只是出于好奇心而感兴趣)。

谢谢,
Oren

HRG.
离线
最后一次露面:2 years 4 months ago
Guru
加入:2014-08-05 13:37
#define APP_ADV_INT_MIN

#define app_adv_int_min 1100.
#define app_adv_int_max 1100.
1100 means ?? unit??

je_dialog
离线
最后一次露面:3 weeks 2 days ago
职员
加入:2013-12-05 14:02
Hi hrg, I believe the units

Hi hrg, I believe the units are 1/100ths of seconds.

布尔

je_dialog

MHv_Dialog
离线
最后一次露面:1个月3周前
职员
加入:2013-12-06 15:10
你好,

你好,

You should multiply the number 1100 with 0.625 to get the number of miliseconds between events. So 1100 => 688ms.

HRG.
离线
最后一次露面:2 years 4 months ago
Guru
加入:2014-08-05 13:37
Hi JE_Dialog

Hi JE_Dialog

yu确定吗?因为它是广告间隔所以1100 *(1/100)= 11秒!!当或者是1100 * 0.625 = 687.S毫秒?因为在从电力分析中检查两个广告活动的时间约为680毫秒!!

MHv_Dialog
离线
最后一次露面:1个月3周前
职员
加入:2013-12-06 15:10
Hi Hrg,

Hi Hrg,

See my answer above.

Other than the setting, the stack will have to add a random number to the advertising to avoid that two separate devices collide in the air continuosly. So the advertising will fluctuate some +/-10ms

je_dialog
离线
最后一次露面:3 weeks 2 days ago
职员
加入:2013-12-05 14:02
Hello HRG,是的,你是对的

Hello HRG,是的,你是对的:我在我们有不同的计算时误认为我们的灯垒SW。

Line 81 and 83 in main.c apply a multiper of 0.625 so the 680mS is the correct value.

#define app_adv_int_min 0x20 // * 0.625ms(+伪随机advdelay从0到10ms)

BR JE_DIALOG.

MHv_Dialog
离线
最后一次露面:1个月3周前
职员
加入:2013-12-06 15:10
你好,

你好,

只是在添加这个。您将不得不停止,然后重新启动广告以实际更改间隔。

亚历克斯
离线
最后一次露面:2年5个月前
加入:2014-08-20 03:39
嗨je,

嗨je,

在#8中,您提到(BLE)堆栈将添加随机数(0〜10ms)App_adv_int_max,而在我们的测试中,我们没有看到此随机添加到间隔:
- 当我们同时启动3DA模块(使用相同的固件)时,我们几乎无法扫描所有3个模块(有时我们只能扫描1,有时候2)。
- 如果我们逐个启动3Da模块,我们每次可以扫描所有3个模块。
- if we burn firmware with different APP_ADV_INT_MAX value to each module, and power up the 3 modules simutaneously, we also can scan all 3 modules everytime.

Pls help to check and advise..

谢谢。
亚历克斯

mt_dialog.
离线
最后一次露面:1个月4周前
职员
加入:2015-06-08 11:34
Hi alex,

Hi alex,

According to the bluetooth spec the advertising events occurs at regular intervals which are slightly modified with a random delay to aid in interference avoidance. Even without this mechanism, over time the different advertising intervals should drift and stop overlapping eachother (no matter how simutaneously your advertising starts for how long the other devices aren't discoverable by your scanner). Do you use different bd-addresses ? What is your software version ?

谢谢mt_dialog.

亚历克斯
离线
最后一次露面:2年5个月前
加入:2014-08-20 03:39
Thank you MT..

Thank you MT..

Do you use different bd-addresses ?
- 是的,我们为每个模块具有不同的BDA。
What is your software version ?
- 基于SDK304开发的固件。

亚历克斯。

mt_dialog.
离线
最后一次露面:1个月4周前
职员
加入:2015-06-08 11:34
Hi alex,

Hi alex,

如果广告活动重叠,请尝试定义CFG_TRNG配置,然后再次检查吗?

谢谢mt_dialog。

ciano
离线
最后一次露面:4天9小时前
加入:2014-10-03 08:13
嗨对话框

嗨对话框
我们与#11有同样的问题,我们使用的是SDK 5.0.2.1

信息:
We are using "app_easy_gap_non_connectable_advertise_start_create_msg" which sets up cmd->intv_max and cmd->intv_min identically
cmd-> intv_max = user_non_connectable_advertise_conf.intv;
cmd->intv_min = user_non_connectable_advertise_conf.intv;

True Random number Generator is enabled in "da1458x_config_advanced.h"
#define cfg_trng.

希望你有一个解决方案,因为这是应用程序的真正问题。

Best Regards,
Ciano Frost.
Denmark

mt_dialog.
离线
最后一次露面:1个月4周前
职员
加入:2015-06-08 11:34
Hi ciano,

Hi ciano,

请确保下载的图片in the 580 has the CFG_TRNG defined, i tested your scenario with the SDK 5.0.2.1 in a modified template example advertising in non-connectable mode (different advertising strings, different bd_addresses and same advertising intervals ) and by connecting the two reset pins i issue a reset at the two boards at the same time. I can properly see the boards with a sniffer and with a normal android BLE app. The only way i could get one device and corrupted advertising data is when the CFG_TRNG is undefined. Please check the sniffer attachments when TRNG is defined and when its not.

谢谢mt_dialog.

附件:
ciano
离线
最后一次露面:4天9小时前
加入:2014-10-03 08:13
嗨对话框

嗨对话框

我忘了提到的一件事是我正在使用计时器每一秒重新启动广告。我每次都改变广告数据。我使用user_non_connectable_advertise_conf.intv = 16000设置广告,这是10秒。因此,我的有效间隔由我的1秒计时器确定,我停止并重新启动广告。

Now my question is: Will there still be added a random 0-10 ms delay to the advertisement, when the bluetooth stack has its advertisment restarted every second?
If the random delay is not added in this case, then this could explain the collisions I experience of the advertisements in the air.

期待您的回答。
Best Regards,
ciano

mt_dialog.
离线
最后一次露面:1个月4周前
职员
加入:2015-06-08 11:34
Hi ciano,

Hi ciano,

So you are advertising 1 advertising packet every 1 second and this is defined by an elapsed timer that issues an advertise start. That explains what you are experincing, the first advertising message hasn't a delay applied to it. After the app_adv_start is issued the advertising string is transmited in the same time as the other DUT after that the next advertising event is re-scheduled with a random delay, so in the first message you send there is a collision between the two advertising messages. A work around of what you are experiencing is to decrease the advertising interval so that the second advertising string is transmitted within the 1 second interval and the random delay to insert the advertising interval so that the two advertising string doesnt collide.

您可以计算您在第二个辅助广告字符串中的发布并停止广告(将被正确收到)的广告字符串,您可以捕获广告的完成,并启动计时器,当Tha计时器再次启动广告时。

Here is a small snippet on how you can count your advertising events:

enum arch_main_loop_callback_ret count_adv_events(void)
{
uint8_t temp_last_ble_event;
temp_last_ble_event = arch_last_rwble_evt_get();
if (app_last_ble_event != temp_last_ble_event)
{
app_last_ble_event = temp_last_ble_event;
if(app_last_ble_event == ble_evt_end)
adv_count++;
if (adv_count == 2)
{
adv_count = 0;
app_easy_gap_advertise_stop();
}
}
返回goto_sleep;
}

谢谢mt_dialog.

ciano
离线
最后一次露面:4天9小时前
加入:2014-10-03 08:13
谢谢你的答案。

谢谢你的答案。

One more question:
如我所理解的,然后将随机延迟添加到广告间隔I的范围为10毫秒。是否可以将此范围增加到500或1000ms(如1000ms)?

目前,我用App Timer Setup从固定延迟加上了从-500ms到500ms的随机(trng)时间手动完成了这一点......这会及时传播广告,我几乎没有看到与许多fobs的任何冲突。

Best Regards,
Ciano Frost.
Denmark

mt_dialog.
离线
最后一次露面:1个月4周前
职员
加入:2015-06-08 11:34
Hi ciano,

Hi ciano,

根据BLE规范,在广告操作中插入的延迟位于ROM代码中,您无法更改。

谢谢mt_dialog.

ciano
离线
最后一次露面:4天9小时前
加入:2014-10-03 08:13
非常感谢你

十分感谢你分享这些信息。

I have no more questions for now.

Best Regards,
Ciano Frost.
Denmark.

主题锁定