同时连接两个外设

16 posts / 0 new
最后一篇文章
匿名(未验证)
同时连接两个外设

Dear all,
你好,
I want to connect with two peripherals from a central simultaneously. I can connect to one of the peripherals and at the same time scan for other module. However, after detecting the other one I can't connect to that. Any advice is appreciated.
谢谢你

Device:
reza.yazdani67 (未验证)
没人知道!?

没人知道!?

林奇119
离线
最后一次见到:1年12个月前
已加入:2015-05-14 03:23
嗨,也许是BD地址

嗨,也许BD地址不应该完全相同。

reza.yazdani67 (未验证)
谢谢,我用不同的BD

谢谢,我用不同的BDaddresses, but still I can't connect to two peripherals simultaneously. I must disconnect from one to connect to the other one.
As Dialog says, I can connect to 6 peripherals at the same time. However, I am unable to connect to even two of them.
有人能帮忙吗?当我想发送一个启动连接命令时,我应该更改任何参数吗?

reza.yazdani67 (未验证)
我为

我为start connection命令设置的参数如下:
msg->nb_peers = 5;
memcpy(&msg->peers[0].addr,&connect\u bdaddr[device\u num],BD\u addr\u LEN);
msg->con\u intv\u min=10;
msg->con\u intv\u max=10;
msg->ce_len_min = 32;
msg->ce\u len\u max=32;
消息->控制延迟=0;
消息->op.addr_src =GAPM\公共地址;
msg->peers[0].addr\u type=GAPM\u PUBLIC\u addr;
msg->superv\u to=100;
消息->扫描间隔=384;
msg->scan_window = 352;
消息->op.code =GAPM\连接\直接;

reza.yazdani67 (未验证)
对话框,

对话框,
你好,
你能给我一些建议吗?
有示例代码你可以请期待吗me?
我的电子邮件是reza.yazdani1367@gmail.com.
谢谢你

Joacimwe
离线
最后一次见到:1 year 5 months ago
Guru
已加入:2014-01-14 06:45
nb\u对等点应设置为1

对于直接连接,nb\u对等点应设置为1(而不是5)。您确定正在正确分配大小正确的消息对象吗?

You also have to change a #define in da14580_config.h with the maximum number of simultaneous peripherals you want to support.

reza.yazdani67 (未验证)
谢谢你,乔奇姆。

谢谢你,乔奇姆。
我根据dialog staff(名为RvA)中的一个人在以下链接中看到的一些建议更改了对等点的数量(nb\U对等点):
http://support.dialog-semiconductor.com/connection-multiple-peripherals
我使用的消息分配与dsps应用程序中使用的类似:
msg = (struct gapm_start_connection_cmd *) KE_MSG_ALLOC(GAPM_START_CONNECTION_CMD , TASK_GAPM, TASK_APP, gapm_start_connection_cmd);
我在da14580\u config.h!中增加同步外设的数量(BLE\u CONNECTION\u MAX\u USER)够吗!?或者我也应该更改其他参数!?
我会做你提到的改变,并让你知道结果很快。我真的很感谢你的帮助,谢谢。

reza.yazdani67 (未验证)
我做了我认为所有的改变

我做了我认为所有的改变is needed to have two peripherals connected to one central simultaneously. I also used UM-B-011 DA14580 MemoryMapTool to correct the memory map in da14580_config.h. But nothing works out! I don't know what else I should do.
我应该一个接一个地连接所有的外围设备,对吗!?
有人能帮忙吗?
Dialog,你能给我一些建议吗?

Joacimwe
离线
最后一次见到:1 year 5 months ago
Guru
已加入:2014-01-14 06:45
长度可变的消息

具有可变长度的消息(在本例中为对等数)必须按如下方式分配:
keu MSG_ALLOC_DYN(GAPM_START_CONNECTION_CMD,TASK_GAPM,TASK_APP,GAPM_START_CONNECTION_CMD,nb_peers*sizeof(struct gap_bdaddr)),其中nb_peers应与放入MSG->nb_peers中的数字相同。

如中所述http://support.dialog-semiconductor.com/resource/gap-interface-specifica...,对于GAPM\连接\直接,nb\对等点应为1。

If you do this together with setting BLE_CONNECTION_MAX_USER, that should be enough. Just make sure you initiate a direct connect two times, first for the first peripheral (with its mac address put into msg->gap_bdaddr[0]), and then to the second peripheral (with its mac address put into msg->gap_bdaddr[0]). Note that you must wait until the first one has connected until you can start the connection of the second one. (Wait until GAPM_CMP_EVT). Other BLE chips support multiple simultaneous pending connections, but the DA14580 doesn't seem to do that. Instead you can scan for multiple peripherals and initiate a direct connection as soon as one of interest appears (but then you might want to have a timeout for this direct connection and go back to scan if you can't connect in say 30 seconds).

reza.yazdani67 (未验证)
Thanks for your help.

Thanks for your help.
最后,我将两个模块连接到一个中央处理器上。
我想问题是我没有等到一个连接完成,在收到GAPC\u connection\u REQ\u之后才开始下一个连接。不过,正如您所说,我应该在收到GAPM\u CMP\u EVT之后启动下一个连接。我真的很感激你的建议。
我还有另外一个问题,关于BLE central连接到第二个外围模块之前必须等待的时间。因为我已经测试了好几次,我无法测量一个可预测的时间。所以,我关心的是如何设置这个时间。如果我从一个中心连接到两个模块,我应该定义两个单独的配置文件来处理它们吗!?
我很感激你事先的考虑。

Joacimwe
离线
最后一次见到:1 year 5 months ago
Guru
已加入:2014-01-14 06:45
你应该能够

你应该能够immediately connect to the second peripheral once you receive GAPM_CMP_EVT (with the operation parameter set to GAPM_CONNECTION_DIRECT) so you don't have to add some delay before you connect to the next peripheral. The GAPM_CMP_EVT message is normally sent immediately after GAPC_CONNECTION_REQ_IND.
Note that the "state" of the TASK_APP as it is done in the template project (idle, advertising, connected, ...) doesn't really make sense when you have multiple peripherals in central mode. You should instead keep track somehow for each peripheral that is connected in some other way.

reza.yazdani67 (未验证)
谢谢你的建议。

谢谢你的建议。
我正在按你说的做,但我无法在连接到第一个设备后立即连接到第二个设备。
我想可能是因为启用了sps配置文件并从第一个连接的设备接收到通知事件,所以我无法立即建立第二个连接。所以,我改变了程序,在第二次连接后启用了概要文件。然而,我无法连接到第二个设备没有一个不可预知的延迟!!!
Do you have any idea how I can reduce the delay or at least have a predictable delay!?

Joacimwe
离线
最后一次见到:1 year 5 months ago
Guru
已加入:2014-01-14 06:45
我以前没见过这个。我

我以前没见过这个。我can connect directly to the second one after GAPM_CMP_EVT...
结果呢?你得到的是一个非零状态码的GAPM\u CMP\u EVT还是什么都没有发生?
你能看到使用智能代码段来测量当前发生了什么吗?

Try to increase your connection interval and reduce the scan window/interval so the da14580 is not busy with connection events of the first peripheral while it scans for the second one.

reza.yazdani67 (未验证)
谢谢,我查一下

谢谢,我查一下solution too.
I think nothing happens at all because I use a serial monitoring program to see when and why the app is going to the handler of GAPM_CMP_EVT. However I will check that again to see if I am missing something or not!
我真的很感谢你的帮助。

reza.yazdani67 (未验证)
Finally, I found what is

最后,我发现什么是问题,我不能连接到第二个设备后,连接到第一个。
It is just about some parameters that was set in the app_connect function! If I change the parameter setting as follows and leave the other parameters to be set to their default value, all the things work correctly and no unpredictable delay happens at all!

msg=(struct gapm\u start\u connection\u cmd*)KE\u msg\u ALLOC\u DYN(gapm\u start\u connection\u cmd,TASK\u gapm,TASK\u APP,
gapm\u start\u connection\u cmd,sizeof(struct gap\u bdaddr));
msg->nb\u peers=1;
memcpy(&msg->peers[0].addr,connect\u bdaddr[index].addr,BD\u addr\u LEN);
msg->con_intv_min = APP_CON_INTV_MIN;
msg->con_intv_max = APP_CON_INTV_MAX;
消息->op.addr_src =GAPM\公共地址;
msg->peers[0].addr\u type=GAPM\u PUBLIC\u addr;
msg->superv\u to=APP\u CON\u superv\u to;
msg->scan_interval = APP_CON_SCAN_INTERVAL;
msg->scan_window = APP_CON_SCAN_WINDOW;
消息->op.code =GAPM\连接\直接;

主题已锁定