中央支持多个外围连接

7个帖子/ 0新
最后一篇
MSUN
离线
最后一次露面:7个月1周前
加入:2015-11-30 22:40
中央支持多个外围连接

我已成功修改DSPS 5.150.2以支持多个外围设备。

但我剩下一个小问题,我需要更好地了解。

当我连接到第1个外设时,一切都可以。成功的连接非常快(可能<100ms)

当我连接到第二个外设时,它通常需要多个连接尝试在成功连接之前。
我在随后的不成功的连接尝试之间看到user_on_connect_failed()中的连接失败回调
成功后,它通常在启动最后一个连接尝试后几秒钟。

我的问题涉及推荐在支持多个外围设备时的中央操作:

-在建立每个成功的连接后,我应该重新启用扫描(User_scan_start)吗?

当中央发送连接消息时,在它的user_central_conf数据结构中,它有2个设置...

///扫描间隔
.scan_interval = 0x180,//不确定时间单位在这里......?
///扫描窗口大小
.scan_window = 0x160,

-如何与user_scan_start()中引用的interval / window user_scan_conf设置相关的这些扫描设置?

///扫描间隔
.Interval = 10,
///扫描窗口大小
.window = 5,

- 我的间隔/窗口设置默认从原始DSPS客户端应用程序中默认。

-既然我支持多个同时的外设连接,有更多的最佳窗口/ interval / ...设置我应该使用?
当然,令人担忧,试图在尝试连接到第二个外设时修复我的错误连接问题。

- 我的应用程序需要每个外围连接维持高达3kb / s的外围通知吞吐量。最多2个外围连接。
- 目前我已经用2kb / s的速率测试了,并且可以做更多的测试来找到上边界。
- DSP默认连接间隔为12.5ms

谢谢,马丁

设备:
MSUN
离线
最后一次露面:7个月1周前
加入:2015-11-30 22:40
只是一只福..

只是A.FYI

如上所述,当第二连接尝试失败时。我看到user_on_connect_failed()上的回调

如果我有一个嗅探器活动,我从不看到我的中央设备发出connect_req消息。

因此,当之前建立一个连接时,它会出现在发送CONNECT_REQ时存在一些问题。

谢谢,马丁

MSUN
离线
最后一次露面:7个月1周前
加入:2015-11-30 22:40
任何对话专家

任何对话专家Central operation out there ?

谢谢,马丁

Gongyu_dialog.
离线
最后一次露面:5 days 8 hours ago
加入:2016-04-27 07:07
扫描间隔/窗口单位

扫描间隔/窗口的单位是625us,可以在核心4.2 //中引用
7.8.10 LE设置扫描参数命令//用于扫描过程,确定扫描间隔和窗口
7.8.12 LE创建Connection Command // for Connect过程,主服务器需要确定扫描间隔和窗口以捕获从站捕获Adv数据包

不确定为什么你有时会遇到第二个连接的失败。
我上传文件供您参考。

依恋:
MSUN
离线
最后一次露面:7个月1周前
加入:2015-11-30 22:40
嗨gongyu_dialog,

嗨gongyu_dialog,

感谢您的答复。
好的,我确实怀疑在建立连接后,“创建连接”设置是用于扫描设置。

我的怀疑是从对话框的角度来看,如果现有连接存在短连接间隔(12.5ms或更小),则DA14580难以调度扫描操作的时间。

这将是您身边的简单测试才能验证。对话框中的任何人都会有更多的洞察力吗?

问候,马丁

mt_dialog.
离线
最后一次露面:4周8小时前
职员
加入:2015-06-08 11:34
嗨msun,

嗨msun,

实际上,当580年在连接和康涅狄格州ection interval is 12.5 or less there is less time for the device to schedule scanning operations. It will try to keep up with the scanning interval but will not succeed every time and offcourse the scanning window is going to be much smaller that the one instructed by the code. You can watch this by using the Power Profiler in Smart Snippets. As you can see from the images attached, the spikes that are a little bit flat on the top is the slot that the device has managed to allocate for the scanning procedure, the length of those scan events is less than 5 ms and even smaller, all the other spikes are the connection intervals. The red line in the image is a scan event that managed to find an advertising string while it was active, notice that all the other scan events are haven't managed to find anything.

So in your case while you have a connection you find a peripheral after a while (since it takes quite sometime to scan it), and you issue a connection command, after the connection command is send to the stack the central will try to find an advertising event on the air in order to send the CONNECT_REQ (since it has to find an open receiver on the advertising side), due to the small connection interval the central has to keep with the other connection, it can schedule only a small scan window in order to find the next advertising event for the second device, and that takes enough time. The reason you get that user_on_connect_failed() is because when sending the connect command to the stack you also start a timer with a 7 seconds delay (i suppose that is DSPS) so if after that 7 seconds the central hasn't managed to schedule the connection event (since it isn't able to find the adv message of the advertising device) the timer just cancels it. Try to increase the time before cancelling the connection event in order to give time to central to establish the connection.

谢谢mt_dialog.

MSUN
离线
最后一次露面:7个月1周前
加入:2015-11-30 22:40
嗨mt_dialog,

嗨mt_dialog,

感谢你的回复。阐明了它的运行方式,我将努力对我的间隔设置进行一些调整,以查看我是否可以提供更多时间扫描操作。
我会通过最后的进展更新。

谢谢,马丁