Multiple Slave Write command

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
huangj
Level 4
Level 4
Welcome! 25 replies posted 10 replies posted

Hi all,

I have 4 custom boards. One is master base on Hello_client. The others are slave base on Hello_sensor.

I try to send write command to all hello_sensor. I use the API like this:

bleprofile_sendWriteCmd(handle, data, data_size);

But only one slave can receive the command packet.

What is the method can send packet to all slave?

0 Likes
1 Solution

Hi boont,

Thank for your help.

I have already see the  article. The case is multiple slaves send packet to the master. But I can't find the sample that master can send the packet to multiple slaves. I found the answer in the thread:hello-client switch to slaves after smartphone connectes. The master will create unique HCI handle in each connection.If the master would like to send packet to the slave1, and the master must to switch handle to handle1(unique HCI handle for slave1).

Master would like to send packet to all slaves, and the code was shown as following:

UINT8 con_index;

for (con_index = 0; con_index < HELLO_CLIENT_MAX_SLAVES; con_index++)     {

      hello_client.dev_info[con_index].connHandle);

      blecm_SetPtrConMux(hello_client.dev_info[con_index].connHandle);

      bleprofile_sendWriteReq(HANDLE, data, datasize);

}

Jack,

View solution in original post

0 Likes
11 Replies
ChristopherA_76
Employee
Employee
5 likes given First like received First like given

Hi Jack,

Have you given all your devices unique BD_ADDRs?

Gregg

0 Likes

Hi cgariss

Thank for your response.

Yes, I add different address with my make target(BT_DEVICE_ADDRESS=XXXXXXXXXXXX).

All slaves are same firmware. It mean the GATT is same.

Jack,

0 Likes
huangj
Level 4
Level 4
Welcome! 25 replies posted 10 replies posted

Could you have any suggestion and comment for changing the GATT database of slave handle on run time?

0 Likes
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Thinking out loud, if you know the BD address of the four servers, perhaps you can try doing it from the whitelist approach.

0 Likes

Hi boont,

Thank for your comment.

How can I use the whitelist to implement it?

Here is my assumption:

1.The master would like to send data1 to slave 1 and slave 2.

2.The master connect to slave 1 by whitelist, and then send the packet.

3.The master will disconnect with slave 1 after send the packet.

4.The master will connect to slave 2 by whitelist, and then send the packet.

5.The master will disconnect with slave 2 after send the packet.

6.The master would like to send data2 to slave 1 and slave 2. => go to step1

Is the assumption right?

Jack,

0 Likes
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Your algorithm is correct. By having a whitelist, your client will know exactly which server (defined by the known BD address on its whitelist) to send its data to. And doing this for one server at a time.

0 Likes

Hi boont,

Thank for your comment.

In addition to using the whitelis send packet to multiple slaves, I have another idea. But not sure the ideal is feasible.

Here is the work flow:

1.The two slaves are the same firmware, and it mean the GATT is the same.

2.The master connect to slave1(GATT1).

3.The master connect to slave2, and then the slave2 will switch to GATT2.

4.The master would like to send dataA to all slaves.

for(){

     bleprofile_sendWriteCmd(Slave1 GATT1 handle, dataA, sizeof(dataA))

     bleprofile_sendWriteCmd(Slave2 GATT2 handle, dataA, sizeof(dataA))

}

The slave1 and slave2 is different GATT, so it has different handle. Is it possible switch GATT after APPLICATION_INIT?

Jack,

0 Likes
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

It sounds kind of like odd to me, but you can try. Unless you have some have very good reasons, perhaps let's stick to known methodologies.

0 Likes

Hi boont,

I hope that all the slaves stay connected, so I don't want to use a whitelist approach.

Did BRCM support sample code for  multiple slaves write command?

Jack,

0 Likes
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

The 20737 device supports a piconet just like your scenario where there are one master and a few slaves. Check out

the "Multiple Slaves" in the below thread where this feature is demonstrated using hello_client/sensor.

Testing Master and Slave Roles

0 Likes

Hi boont,

Thank for your help.

I have already see the  article. The case is multiple slaves send packet to the master. But I can't find the sample that master can send the packet to multiple slaves. I found the answer in the thread:hello-client switch to slaves after smartphone connectes. The master will create unique HCI handle in each connection.If the master would like to send packet to the slave1, and the master must to switch handle to handle1(unique HCI handle for slave1).

Master would like to send packet to all slaves, and the code was shown as following:

UINT8 con_index;

for (con_index = 0; con_index < HELLO_CLIENT_MAX_SLAVES; con_index++)     {

      hello_client.dev_info[con_index].connHandle);

      blecm_SetPtrConMux(hello_client.dev_info[con_index].connHandle);

      bleprofile_sendWriteReq(HANDLE, data, datasize);

}

Jack,

0 Likes