Skip to content

Commit 74e707b

Browse files
author
Mangesh Malusare
committed
Merge branch 'fix/bt_doc_minor_fix' into 'master'
Doc fix for (a) BLE5.0 PHY layer configuration hcitool command (b) gatt client server for <5.0 See merge request app-frameworks/esp_hosted!192
2 parents 2538994 + 1db9903 commit 74e707b

File tree

1 file changed

+38
-51
lines changed

1 file changed

+38
-51
lines changed

docs/Linux_based_host/Getting_started.md

Lines changed: 38 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,46 @@ hci0: Type: Primary Bus: SDIO
117117

118118
### 2.1 BT/BLE Test procedure
119119

120-
* ESP-Hosted related BR/EDR 4.2 and BLE 4.2 functionalities are tested with `bluez` 5.43+.
120+
* ESP-Hosted related BR/EDR 4.2 and BLE 4.2 functionalities are tested with `bluez` 5.50+.
121121
Whereas BLE 5.0 functionalities are tested with `bluez` 5.45+.
122122
* We suggest latest stable `bluez` version to be used. Any other bluetooth stack instead of `bluez` also could be used.
123123
* To upgrade `bluez` for particular version, follow this [link](https://scribles.net/updating-bluez-on-raspberry-pi-from-5-43-to-5-50/). Replace bluez `older version` to `expected version` while following mentioned link.
124124

125125
#### 2.1.1 GATT server
126-
127-
1. Go to `bluez-5.xx` folder. Run `./test/example-gatt-server`. This will start GATT server on Raspberry-Pi.
128-
129-
2. Now start advertising. Run `sudo hciconfig hci0 leadv`.
130-
131-
3. Now ESP peripheral's mac address should be listed in scan list of mobile app.
132-
133-
4. Connect to ESP peripheral's mac address with mobile as GATT client.
134-
135-
5. Check read/write characteristics fields in `Heart Rate` service.
126+
Steps:
127+
1. Run `sudo bluetoothctl`.
128+
2. Run `list` to get MAC address of ESP32.
129+
3. To set device name, run `menu advertise`. Then `name <enter_any_name>`.
130+
4. To come back to main menu, run `back`.
131+
5. To start advertising, run `advertise on`.
132+
Perform below steps on Mobile Phone:
133+
6. Turn on mobile phone's bluetooth. Open nRF connect application, ESP32's MAC address will be displayed under `SCANNER` tab as a result of scan.
134+
7. Click on connect. Client tab will be open. Click on `Generic Attribute` option.
135+
8. Perform read/write on listed characteristics fields in `Generic Attribute` service.
136+
To disconnet:
137+
9. Run `disconnect <MAC_ADDRESS_of_gatt_client>` on linux host's `bluetoothctrl` OR click on `DISCONNECT` in nRF connect application's `GATT client` screen.
136138

137139
#### 2.1.2 GATT Client
138140

139-
1. Run `./test/example-gatt-client` on Raspberry Pi. This will start GATT client on Raspberry Pi.
140-
141-
2. You should see a `Heart Rate Measurement` field in Raspberry Pi console.
141+
1. Run `sudo bluetoothctl`.
142+
2. To Turn on power, run `power on`.
143+
3. Make device discoverable, run `discoverable on`.
144+
4. Make device pairable, run `pairable on`.
145+
5. Set current agent to default, run `default-agent`.
146+
6. Turn on bluetooth support, run `agent on`.
147+
7. Turn on mobile phone's bluetooth so that linux host can detect it.
148+
8. Start scanning, run `scan on`.
149+
9. Once mobile phone's MAC address is listed in scan list, stop scanning, run `scan off`.
150+
10. Start btmon to collect log in separate terminal window, run `sudo btmon &`.
151+
11. To trust, run `trust <MAC address of mobile phone>`.
152+
12. To pair, run `pair <MAC address of mobile phone>`.
153+
13. To connect, run `connect <MAC address of mobile phone>`.
154+
14. Once connected, please run `discoverable off`.
155+
15. Go to gatt menu, run `menu gatt`.
156+
16. list available attributes, run `list-attributes`.
157+
17. select characteristic of service, run `select-attribute <characteristic_of_service>`.
158+
18. perform read/write operation on selected characteristic.
159+
19. To disconnect, run `disconnect <MAC_ADDRESS_of_gatt_server>`.
142160

143161
#### 2.1.3 BT scan
144162

@@ -191,46 +209,14 @@ Steps:
191209
BLE 5.0 has backword compability. It can connect with BLE4.2 devices.
192210
Below example demonstrate linux host as GATT server and mobile phone as GATT client. We are using `nRF connect` application for GATT client operartion.
193211

194-
Execute following steps on linux host.
195-
Steps:
196-
1. Run `sudo bluetoothctl`.
197-
2. Run `list` to get MAC address of ESP32.
198-
3. To set device name, run `menu advertise`. Then `name <enter_any_name>`.
199-
4. To come back to main menu, run `back`.
200-
5. To start advertising, run `advertise on`.
201-
Perform below steps on Mobile Phone:
202-
6. Turn on mobile phone's bluetooth. Open nRF connect application, ESP32's MAC address will be displayed under `SCANNER` tab as a result of scan.
203-
7. Click on connect. Client tab will be open. Click on `Generic Attribute` option.
204-
8. Perform read/write on listed characteristics fields in `Generic Attribute` service.
205-
To disconnet:
206-
9. Run `disconnect <MAC_ADDRESS_of_gatt_client>` on linux host's `bluetoothctrl` OR click on `DISCONNECT` in nRF connect application's `GATT client` screen.
212+
Follow section [2.1.1](#211-gatt-server) for GATT server connections.
207213

208214
#### 2.2.3 GATT client
209215

210216
BLE 5.0 has backword compability. It can connect with BLE4.2 devices.
211217
Below example demonstrate linux host as GATT client and mobile phone as GATT server. We are using `nRF connect` application for GATT server operartion.
212218

213-
Execute following steps on linux host.
214-
Steps:
215-
1. Run `sudo bluetoothctl`.
216-
2. To Turn on power, run `power on`.
217-
3. Make device discoverable, run `discoverable on`.
218-
4. Make device pairable, run `pairable on`.
219-
5. Set current agent to default, run `default-agent`.
220-
6. Turn on bluetooth support, run `agent on`.
221-
7. Turn on mobile phone's bluetooth so that linux host can detect it.
222-
8. Start scanning, run `scan on`.
223-
9. Once mobile phone's MAC address is listed in scan list, stop scanning, run `scan off`.
224-
10. Start btmon to collect log in separate terminal window, run `sudo btmon &`.
225-
11. To trust, run `trust <MAC address of mobile phone>`.
226-
12. To pair, run `pair <MAC address of mobile phone>`.
227-
13. To connect, run `connect <MAC address of mobile phone>`.
228-
14. Once connected, please run `discoverable off`.
229-
15. Go to gatt menu, run `menu gatt`.
230-
16. list available attributes, run `list-attributes`.
231-
17. select characteristic of service, run `select-attribute <characteristic_of_service>`.
232-
18. perform read/write operation on selected characteristic.
233-
19. To disconnect, run `disconnect <MAC_ADDRESS_of_gatt_server>`.
219+
Follow section [2.1.2](#212-gatt-client) for GATT client connections.
234220

235221
#### 2.2.4 1M, 2M, CODED phy for LE
236222

@@ -256,8 +242,9 @@ Steps:
256242
3. Connect to BLE5.0 device using above mentioned steps in section 2.2.1.
257243
4. while executing connect command, there is `LE Enhanced Connection Complete` event in `btmon` log. Note down `handle` value.
258244
5. After connection, exit form bluetoothctl. Run `exit` in bluetoothctl.
259-
6. Now configure phy into 2M. Run `sudo hcitool cmd 08 32 <handle_value> 03 02 02 00`.
260-
7. Follow gatt read/write from `gatt menu` in bluetoothctl.
245+
6. Now configure phy into 2M. Run `sudo hcitool cmd 08 32 <handle value in two bytes in little endian format > 03 02 02 00 00`.
246+
ex. For handle 1 -> `sudo hcitool cmd 08 32 01 00 03 02 02 00 00`
247+
7. Follow gatt read/write from `menu gatt` in bluetoothctl.
261248

262249
##### Using CODED phy:
263250
Configure CODED phy on host and peripheral side.
@@ -266,7 +253,7 @@ Steps:
266253
1. To configure phy as CODED phy, run `sudo hcitool cmd 08 31 03 04 04`.
267254
2. To check selected phy, Go to `bluez-5.56` directory. Run `sudo ./tools/btmgmt --index hci0` and run `phy`.
268255
3. Connect to BLE5.0 device using above mentioned steps in section 2.2.1.
269-
4. Follow gatt read/write from gatt menu in bluetoothctl.
256+
4. Follow gatt read/write from `menu gatt` in bluetoothctl.
270257

271258
## 3. OTA operation
272259

0 commit comments

Comments
 (0)