1| Supported Targets | ESP32 | ESP32-C3 |
2| ----------------- | ----- | -------- |
3
4# ESP-IDF Gatt Client Multi Connection Example
5
6This example shows the usage of APIs to create a GATT multi-connection client. It can be used to connect to three GATT servers at the same time.
7
8To test this example, please run [gatt_server_demo](../gatt_server) to create three GATT server devices, namely ESP_GATTS_DEMO_a, ESP_GATTS_DEMO_b and ESP_GATTS_DEMO_c, `Gatt_client_multi_connection_demo` will connect to these three gatt server demos, and then exchange data.
9
10Please, check this [tutorial](tutorial/Gatt_Client_Multi_Connection_Example_Walkthrough.md) for more information about this example.
11
12## How to Use Example
13
14Before project configuration and build, be sure to set the correct chip target using:
15
16```bash
17idf.py set-target <chip_name>
18```
19
20The code can be modified to connect to more devices (up to 4 devices by default). If you need to connect to more devices (more than 4 devices), you need to change `BT/BLE MAX ACL CONNECTIONS` in menuconfig.
21
22### Hardware Required
23
24* A development board with ESP32/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
25* A USB cable for Power supply and programming
26
27See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it.
28
29### Build and Flash
30
31Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
32
33(To exit the serial monitor, type ``Ctrl-]``.)
34
35See the [Getting Started Guide](https://idf.espressif.com/) for full steps to configure and use ESP-IDF to build projects.
36
37## Example Output
38
39```
40I (0) cpu_start: Starting scheduler on APP CPU.
41I (512) BTDM_INIT: BT controller compile version [1342a48]
42I (522) system_api: Base MAC address is not set
43I (522) system_api: read default base MAC address from EFUSE
44I (522) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
45I (932) GATTC_MULTIPLE_DEMO: REG_EVT
46I (932) GATTC_MULTIPLE_DEMO: REG_EVT
47I (932) GATTC_MULTIPLE_DEMO: REG_EVT
48I (942) GATTC_MULTIPLE_DEMO: Scan start success
49I (1072) GATTC_MULTIPLE_DEMO: 38 68 a4 69 bb 7c
50I (1072) GATTC_MULTIPLE_DEMO: Searched Adv Data Len 28, Scan Response Len 0
51I (1072) GATTC_MULTIPLE_DEMO: Searched Device Name Len 0
52I (1082) GATTC_MULTIPLE_DEMO:
53
54I (1102) GATTC_MULTIPLE_DEMO: 08 ef 3b a7 04 41
55I (1102) GATTC_MULTIPLE_DEMO: Searched Adv Data Len 9, Scan Response Len 15
56I (1102) GATTC_MULTIPLE_DEMO: Searched Device Name Len 13
57I (1112) GATTC_MULTIPLE_DEMO: LG CM2760(41)
58I (1112) GATTC_MULTIPLE_DEMO:
59
60I (1222) GATTC_MULTIPLE_DEMO: 38 68 a4 69 bb 7c
61I (1222) GATTC_MULTIPLE_DEMO: Searched Adv Data Len 28, Scan Response Len 0
62I (1222) GATTC_MULTIPLE_DEMO: Searched Device Name Len 0
63I (1232) GATTC_MULTIPLE_DEMO:
64
65I (1372) GATTC_MULTIPLE_DEMO: 38 68 a4 69 bb 7c
66I (1372) GATTC_MULTIPLE_DEMO: Searched Adv Data Len 28, Scan Response Len 0
67I (1372) GATTC_MULTIPLE_DEMO: Searched Device Name Len 0
68I (1382) GATTC_MULTIPLE_DEMO:
69
70I (1412) GATTC_MULTIPLE_DEMO: 08 ef 3b a7 04 41
71I (1412) GATTC_MULTIPLE_DEMO: Searched Adv Data Len 9, Scan Response Len 15
72I (1422) GATTC_MULTIPLE_DEMO: Searched Device Name Len 13
73I (1422) GATTC_MULTIPLE_DEMO: LG CM2760(41)
74I (1432) GATTC_MULTIPLE_DEMO:
75
76I (1522) GATTC_MULTIPLE_DEMO: 38 68 a4 69 bb 7c
77I (1522) GATTC_MULTIPLE_DEMO: Searched Adv Data Len 28, Scan Response Len 0
78I (1522) GATTC_MULTIPLE_DEMO: Searched Device Name Len 0
79I (1532) GATTC_MULTIPLE_DEMO:
80```
81
82## Troubleshooting
83
84For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
85