Connect to multiple peripherals simultaneously

Learn MoreFAQsTutorials

5 posts / 0 new
Last post
takeuchi0304
Offline
Last seen:1 year 10 months ago
加入:2019-02-26 02:37
Connect to multiple peripherals simultaneously

Hello.

Is it possible to establish BLE connection to multiple peripheral devices simultaneously?

I tried to set device config to make DA14585 behave as central mode, and connect to 2 peripheral devices.

The connection to 1st peripheral device was successfully established, but the connection to 2nd peripheral device seemed not to be started unless the 1st connection was disposed.

Could you tell me how to establish multiple connection if possible?

Thank you.

Device:
PM_Dialog
Offline
Last seen:13 hours 58 min ago
工作人员
加入:2018-02-08 11:03
Hi takeuchi0304,

Hi takeuchi0304,

Yes, it is possible. Please check the CFG_MAX_CONNECTIONS which is in the da1458x_config_basic.h header file. This definition determines the maximum concurrent connections supported by application. It configures the heap memory allocated to service multiple connections. It is used for GAP central role applications.

Thanks, PM_Dialog

takeuchi0304
Offline
Last seen:1 year 10 months ago
加入:2019-02-26 02:37
Thank you for the response!

Thank you for the response!

takeuchi0304
Offline
Last seen:1 year 10 months ago
加入:2019-02-26 02:37
I tried as below;

I tried as below;

```

#define CFG_MAX_CONNECTIONS (2)

uint8_t bd_addr_0[6]; // fixed BD Address

uint8_t bd_addr_1[6]; // fixed BD Address

struct gapm_start_connection_cmd *cmd = KE_MSG_ALLOC_DYN(

GAPM_START_CONNECTION_CMD, TASK_GAPM, TASK_APP, gapm_start_connection_cmd,

CFG_MAX_CONNECTIONS * sizeof(struct gap_bdaddr));

cmd->op.code = GAPM_CONNECTION_DIRECT;

cmd->op.addr_src = GAPM_STATIC_ADDR;

cmd->scan_interval = 0x180;

cmd->scan_window = 0x160;

cmd->con_intv_min = 100;

cmd->con_intv_max = 100;

cmd->con_latency = 0;

cmd->superv_to = 0x1f4;

cmd->ce_len_min = MS_TO_DOUBLESLOTS(0);

cmd->ce_len_max = MS_TO_DOUBLESLOTS(0);

cmd->nb_peers = 2;

memcpy(cmd->peers[0].addr.addr, bd_addr_0, BD_ADDR_LEN * sizeof(uint8_t));

cmd->peers[0].addr_type = GAPM_CFG_ADDR_PUBLIC;

memcpy (cmd - >同行[1].addr。addr, bd_addr_1, BD_ADDR_LEN * sizeof(uint8_t));

cmd->peers[1].addr_type = GAPM_CFG_ADDR_PUBLIC;

ke_msg_send(cmd);

```

I expected that the both of GAPC_CONNECTION_REQ_IND events can be received.

But the event for 2nd device could not be received.

What went wrong with my code?

Could you give me a code snippet or correct message sequence?

Thanks.

PM_Dialog
Offline
Last seen:13 hours 58 min ago
工作人员
加入:2018-02-08 11:03
Hi takeuchi0304,

Hi takeuchi0304,

You could check theSW Example: BLE Central Security Demo Projectsoftware example as a reference which is based on the top of SDK6.0.10.511. Also, be aware that all the software examples of the DA14585/6 don’t include the SDK files, so you will have to link the example with your SDK path in order to build them. The procedure that you should follow is described in this link :SW Example: DA1458x Example Setup.

Thanks, PM_Dialog