I would like to change the advertising interval based on data from a sensor connected to the DA14580. I plan to do this by changing lines 209 and 210 in app.c to a global variable that can be updated by another function.
So I would have something like this in app.c:
void app_adv_start(void)
{
...
cmd->intv_min = current_app_adv_int_min; // was APP_ADV_INT_MIN
cmd->intv_max = current_app_adv_int_max; // was APP_ADV_INT_MAX
....
}
这是工作吗?这是实现这一目标的最佳方式吗?
谢谢你提供的所有帮助。
Dear Motred,
You're right when saying that both lines 209 & 210 in app.c must be changed in case you need to change the advertising interval.
所以你menti的函数oned is fine.
请注意,current_app_adv_int_min&current_app_adv_int_max必须是相同的。
best regards,
Guillaume.
Hi Guillaume,
Do you know what happens if you set intv_min and intv_max to be different from each other?
From my tests, when intv_min < intv_max the advertising interval is intv_max.
Do you know if there are any side effects to do that? If intv_min is ignored, what is it good for?
(I am just interested out of curiosity).
Thanks,
oren.
#define app_adv_int_min.1100
#define APP_ADV_INT_MAX 1100
1100意思是?单元??
嗨HRG,我相信该单位是1/100秒。
BR
JE_Dialog
Hi,
您应该将数字1100乘以0.625以获取事件之间的线索数。所以1100 => 688ms。
嗨je_dialog
are yu sure ? because it is advertising interval so 1100*(1/100) = 11 seconds !! ?? or is it 1100 * 0.625 =687.s msec ? because while checking in power profiling the time between two advertising event is approx 680 msec !!
嗨HRG,
看到我上面的答案。
除了设置之外,堆栈将不得不为广告添加一个随机数,以避免两个单独的设备连续碰撞空中。所以广告将波动一些+/- 10ms
Hello hrg, yes, you are right : i was looking at our Beacon SW by mistake where we have a different calculation.
Main.c中的线81和83应用了0.625的多过,所以680ms是正确的值。
#define app_adv_int_min.0x20 // *0.625ms (+ pseudo random advDelay from 0 to 10ms)
BR JE_Dialog
Hi,
Just adding to this. You will have to stop, then restart advertising to actually change the intervals.
Hi JE,
In #8, you mentioned the (BLE) stack will add random number(0~10ms) above APP_ADV_INT_MAX, while in our tests, we did not see this random adding to the interval:
- when we power up 3 DA modules(with same firmware) simutaneously, we could hardly scan all 3 modules(sometimes we can only scan 1, sometimes 2).
- while if we power up 3 DA modules one by one, we can scan all 3 modules everytime.
- 如果我们为每个模块带来不同的app_adv_int_max值的固件,并同时向3个模块加电,我们也可以每次扫描所有3个模块。
请帮助检查和建议..
Thanks.
Alex
嗨,亚历克斯,
根据蓝牙规范,广告事件以规则的间隔发生,这些间隔略微修改,随机延迟以帮助干扰避免。即使没有这种机制,随着时间的推移,不同的广告间隔应该漂移并停止彼此重叠(无论您的广告如何开始,您的扫描仪无法发现其他设备的时间)。你使用不同的BD地址吗?你的软件版本是什么?
Thanks MT_dialog
谢谢mt ..
你使用不同的BD地址吗?
- Yes, we are having different BDA for each module.
你的软件版本是什么?
- The firmware developed based on SDK304.
Alex.
嗨,亚历克斯,
Can you please try to define the CFG_TRNG configuration, and check again if the advertising events overlaps ?
Thanks MT_dialog.
Hi Dialog
We have the same issue as #11, and we are using SDK 5.0.2.1
Info:
我们使用“app_easy_gap_nonnectable_advertise_start_create_msg”,它相同地设置cmd-> intv_max和cmd-> intv_min
cmd->intv_max = user_non_connectable_advertise_conf.intv;
cmd-> intv_min = user_non_connectable_advertise_conf.intv;
真正的随机数生成器在“da1458x_config_advance.h”中启用了
#define CFG_TRNG
Hope you have a solution, since this is a real issue for the application.
最好的祝福,
Ciano Frost
丹麦
嗨Ciano,
请确保在580中下载的图像具有所定义的CFG_TRNG,我将您的场景与SDK 5.0.2.1在未连接模式(不同的广告字符串,不同的BD_Addresses和相同的广告间隔不同)中使用SDK 5.0.2.1测试了您的场景并且通过连接两个重置引脚,我同时在两个板上发出复位。我可以用嗅探器和普通的Android BLE应用程序妥善看到电路板。我可以获得一个设备和损坏的广告数据的唯一方法是CFG_TRNG未定义。当TRNG定义时,请检查嗅探器附件。
Thanks MT_dialog
Hi Dialog
One thing I forgot to mention, is that I am using a timer to restart the advertisment every one second. I change the advertisment data every time. I set up the advertisement with user_non_connectable_advertise_conf.intv = 16000 which is 10seconds. So my effective interval is determined by my 1 second timer, where I stop and restart the advertisement.
现在我的问题是:当蓝牙堆栈有其广告时,仍然会增加一个随机的0-10 ms延迟到广告每秒重新启动它?
如果在这种情况下没有添加随机延迟,那么这可以解释我在空中遇到广告的碰撞。
Looking forward for your answer.
最好的祝福,
Ciano
嗨Ciano,
因此,您每1秒广告1广告数据包,这是由发布广告启动的经过时间的定时器定义。这解释了你是经验的,第一个广告消息没有应用于它的延迟。在APP_ADV_START发出之后,广告字符串在与随机延迟重新安排下一个广告事件之后与其他DUT同时传输,所以在您发送的第一个消息中,两个广告消息之间存在碰撞。周围的工作是为了减少广告间隔,使得第二广告串在1秒间隔内传输,随机延迟以插入广告间隔,使得两个广告字符串不会碰撞。
You can count the advertising string that you have emmited and stop the advertising in the second emmited advertising string (which will be received correctly), you can catch the completetion of the advertising and and start the timer, when tha timer elapses start advertising again.
这是一个小片段,你如何计算广告活动:
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();
}
}
return GOTO_SLEEP;
}
Thanks MT_dialog
Thank you for the answer.
还有一个问题:
As I understand, then the random delay which is added to the advertisement interval i in the range of 10 ms. Is it possible to increase this range to something like 500 or 1000ms?
Currently I have done this manually with an app timer setup from a fixed delay plus a random (TRNG) time from -500ms to 500ms ... This spreads the advertisement in time, and I do almost not see any collisions with many fobs.
最好的祝福,
Ciano Frost
丹麦
嗨Ciano,
The delay that is inserted in the advertising operation is located in the ROM code according to the BLE spec, you cant change that.
Thanks MT_dialog
Thank you very much for the info.
我现在没有更多的问题。
最好的祝福,
Ciano Frost
丹麦。