The right connection sequence between three devices

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

cross mob
MiWa_3859701
Level 1
Level 1
First like given

Hello fellows,

I'm lost:(

I'm trying to figure out how to connect three devices and what roles would be assigned for each of that devices(Master, Slave, Central, Peripheral, Server, Client, etc).

I have:

  • Device_A -- measure and sent the result of that measurements after the request from\to Device_B;
  • Device_B -- sending requests to Device_A and also answering(sent a response) to Device_C;
  • Device_C -- mobile application which is connected to Device_B and asking about Device_A measurements;

Device_C is working only with Device_B, I mean Device_C doesn't know anything about Device_A and all communication goes through the Device_B.

Could someone explain me the roles of that Devices and the correct data flow?

Really appreciate for your adviсe.

0 Likes
1 Solution
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

1. PSoC 4 BLE devices supports only one connection at a time, so it is not possible to connect multiple devices simultaneously over BLE.

2. For your application, configure Device_A in peripheral mode and Device_B in both Central and Peripheral mode. After connection, when Device_A sends the data to the Device_B, store this data in a buffer. Disconnect the Device_B from Device_A and switch the Device_B role to peripheral mode, and connect to the Central device(i.e., Device_C). Send the stored data values from Device_B to central device through notification/indication. Please refer to the Central and Peripheral code example in the GitHub for more information. In this example project, when Device is acting as Central, it can scan and connect to peer device(i.e., Device_A) which is advertising. When acting as peripheral it can advertise and connect to other Central device(Device_C). The project is controlled based on the commands from UART, accordingly changing PSoC4 BLE role.

3. For more information on sending the data from peripheral to central device, please refer to the Day_024_Throughput project(GATT_Notification projects) in which when the devices are connected, the server will sends continuous notification data to the central device.

4. Please refer to the below points for information on different roles of BLE device.

    a. Peripheral device advertises itself and waits for a central to connect to it. Whereas, the Central device scans for other devices.  After a connection is established with the Central, peripheral operates as a slave. After a central makes a connection, it operates as master.

    b. After a BLE connection has been established, devices can be either a client or a server. A GATT server contains the data or information. It receives requests from a GATT client and responds with data. Whereas, A GATT client requests and/or receives data from a GATT server.

Please let me know if you have any questions.

Thanks,

P Yugandhar.

View solution in original post

2 Replies
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

1. PSoC 4 BLE devices supports only one connection at a time, so it is not possible to connect multiple devices simultaneously over BLE.

2. For your application, configure Device_A in peripheral mode and Device_B in both Central and Peripheral mode. After connection, when Device_A sends the data to the Device_B, store this data in a buffer. Disconnect the Device_B from Device_A and switch the Device_B role to peripheral mode, and connect to the Central device(i.e., Device_C). Send the stored data values from Device_B to central device through notification/indication. Please refer to the Central and Peripheral code example in the GitHub for more information. In this example project, when Device is acting as Central, it can scan and connect to peer device(i.e., Device_A) which is advertising. When acting as peripheral it can advertise and connect to other Central device(Device_C). The project is controlled based on the commands from UART, accordingly changing PSoC4 BLE role.

3. For more information on sending the data from peripheral to central device, please refer to the Day_024_Throughput project(GATT_Notification projects) in which when the devices are connected, the server will sends continuous notification data to the central device.

4. Please refer to the below points for information on different roles of BLE device.

    a. Peripheral device advertises itself and waits for a central to connect to it. Whereas, the Central device scans for other devices.  After a connection is established with the Central, peripheral operates as a slave. After a central makes a connection, it operates as master.

    b. After a BLE connection has been established, devices can be either a client or a server. A GATT server contains the data or information. It receives requests from a GATT client and responds with data. Whereas, A GATT client requests and/or receives data from a GATT server.

Please let me know if you have any questions.

Thanks,

P Yugandhar.

Thanks. Now it's clear:)

0 Likes