Connecting to multiple servers from a client in BLE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connecting to multiple servers from a client in BLE

13,025 Views
EmbeddedTech
Contributor III

Hi,

I am trying to connect my BLE Client (iMXRT1060 +ublox module) with 2 servers (QN9090). I was able to successfully connect to one board and read the data. When I try to establish connection with both the servers only one gets connected and for the other module I get the error as below,

Found device:
Create connection failed (err -12)

I have configured the CONFIG_BT_MAX_CONN to 2 and have done the required modifications in the central_ht.c file to connect to 2 servers. But I understand from the above error that the SDK currently supports only one connection. Is that correct?

Is there any sample SDK to connect to multiple servers as we need to connect to multiple peripherals to get data. Your help on this is highly appreciated.

Thanks.

 

0 Kudos
Reply
16 Replies

12,968 Views
EmbeddedTech
Contributor III

Hi Kerry,

Ok, I will wait for your reply.

Thanks.

0 Kudos
Reply

12,953 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @EmbeddedTech 

  nxf56274 is my BLE colleague, he helps you test it today, please follow his code and test it on your side, whether it works or not?

 Any updated information, please kindly let me know.

Best Regards,

Kerry

0 Kudos
Reply

12,945 Views
EmbeddedTech
Contributor III

Hi Kerry,

I will update on my side and test it today.

Thanks.

0 Kudos
Reply

13,001 Views
EmbeddedTech
Contributor III

Hi,

Our requirement is to connect to multiple servers (atleast 3) to get the data. Since BLE can support a maximum of 7 connections at a time, should the sdk also support multiple connections? Can you help us with the changes to be done on the sdk side to support multiple connections?

Thanks.

0 Kudos
Reply

12,992 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @EmbeddedTech 

   Sorry, my previous reply is not correct, I checked with our BLE engineer, the client can connect more than 2 server at the same time.

  Please refer to this application note at first:

https://www.nxp.com/docs/en/application-note/AN12414.pdf

 If you still have question about it please kindly let me know.

Best Regards,

Kerry

  

0 Kudos
Reply

12,985 Views
EmbeddedTech
Contributor III

Hi Kerry,

Does the edgefast bluetooth example in iMXRT 1060 SDK support multiple connections? I am using the ublox module so I have defined the macro WIFI_BOARD_AW_CM358. The sdk code for edgefast bluetooth is different from the freedom series code. 

I have defined the macro CONFIG_BT_MAX_CONN to 2 and have also done changes in the central_ht.c file to support 2 connections. But looks like I can establish only one connection at a time.

In file bluetooth.h, what does the below macro mean?

/**
* @def BT_ID_DEFAULT
*
* Convenience macro for specifying the default identity. This helps
* make the code more readable, especially when only one identity is
* supported.
*/
#define BT_ID_DEFAULT 0

The above ID is used in bt_pal_conn.c etc. Does this mean the sdk currently supports only one connection?

Your help on this is highly appreciated.

Thanks.

0 Kudos
Reply

12,961 Views
nxf56274
NXP Employee
NXP Employee

Hi,

I wrote a code but I do not have the device. So I hope you can test it. I am trying to use the array to store the connection info. 

nxf56274_0-1639991403244.png

 

0 Kudos
Reply

12,940 Views
EmbeddedTech
Contributor III

Hi,

I have tested the code and it is asserting after subscribing to one service. Please find attached the screenshots for your reference.

Thanks.

0 Kudos
Reply

12,930 Views
nxf56274
NXP Employee
NXP Employee

Hi,

1 Comment the 'scan_start', Does it work with only one device?

asd1.PNG

2 If so, please try to create a thread. In the thread, the uart is waiting for the cmd to call the scan_start after the first device sending the data normally.

0 Kudos
Reply

12,925 Views
EmbeddedTech
Contributor III

Hi,

Do you mean like setting some sort of flag in the notify function on first receive and then use the flag in a new task to start scanning again?

0 Kudos
Reply

12,914 Views
nxf56274
NXP Employee
NXP Employee

Hi,

Yeah, this method works on kw. So I want you to try.

0 Kudos
Reply

12,912 Views
EmbeddedTech
Contributor III

Hi,

Please find attached the file and the screenshot. Let me know if it makes sense. I will do some more testing to see if its consistent and will also do changes to my custom peripherals read to see if it works.

Thanks.

12,906 Views
nxf56274
NXP Employee
NXP Employee

Hi,

Yeah, it looks good 

0 Kudos
Reply

12,506 Views
EmbeddedTech
Contributor III

Hi,

Good morning. Now, I am trying to connect a third peripheral to my central device and I am able to establish a connection after connecting and subscribing to the first two peripherals. But after connecting the service discovery fails. The error code is 12 (ENOMEM). What does that mean?

Thanks.

0 Kudos
Reply

12,478 Views
nxf56274
NXP Employee
NXP Employee

Hi,

 

I will no longer support the wireless mcu. If you have any other question, please create a new thread. Many thanks.

 

BR,

Da

0 Kudos
Reply

12,975 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @EmbeddedTech 

  Please keep patient, I will find more resource to check the details, any updated information will let you know, please give me more time, thanks.

Best Regards,

kerry

0 Kudos
Reply