|
| 1 | +# Checking out the Matter code |
| 2 | + |
| 3 | +## Checking out all Platforms |
| 4 | + |
| 5 | +To check out the Matter repository with all platforms, run the following |
| 6 | +command: |
| 7 | + |
| 8 | +``` |
| 9 | +git clone --recurse-submodules https://github.com/project-chip/connectedhomeip.git |
| 10 | +``` |
| 11 | + |
| 12 | +## Checking out `Bouffalo Lab` Platform |
| 13 | + |
| 14 | +- Checking out matter top level repo with command below: |
| 15 | + |
| 16 | + ``` |
| 17 | + git clone --depth=1 https://github.com/project-chip/connectedhomeip.git |
| 18 | + ``` |
| 19 | +
|
| 20 | +- check out `Bouffalo Lab` platform support repos as follows: |
| 21 | +
|
| 22 | + ``` |
| 23 | + scripts/checkout_submodules.py --shallow --recursive --platform bouffalolab |
| 24 | + ``` |
| 25 | +
|
| 26 | + If you want to checkout Matter Linux example and development tools, please |
| 27 | + try as follows: |
| 28 | +
|
| 29 | + ``` |
| 30 | + scripts/checkout_submodules.py --shallow --recursive --platform linux bouffalolab |
| 31 | + ``` |
| 32 | +
|
| 33 | + Or if you want to checkout Matter Darwin example and development tools, |
| 34 | + please try as follows: |
| 35 | +
|
| 36 | + ``` |
| 37 | + scripts/checkout_submodules.py --shallow --recursive --platform darwin bouffalolab |
| 38 | + ``` |
| 39 | +
|
| 40 | +# Setup build environment |
| 41 | +
|
| 42 | +Please refer to section `Prerequisites` in |
| 43 | +[BUILDING.md](../../guides/BUILDING.md) to install build software. |
| 44 | +
|
| 45 | +## Install toolchains for `Bouffalo Lab` SoC |
| 46 | +
|
| 47 | +- Enter to cloned Matter project in terminal and run the following script |
| 48 | +
|
| 49 | + ``` |
| 50 | + ./integrations/docker/images/stage-2/chip-build-bouffalolab/setup.sh |
| 51 | + ``` |
| 52 | +
|
| 53 | + Script `setup.sh` requires to select install path, and please execute |
| 54 | + following command to export `BOUFFALOLAB_SDK_ROOT` before building. |
| 55 | +
|
| 56 | + ``` |
| 57 | + export BOUFFALOLAB_SDK_ROOT="Your install path" |
| 58 | + ``` |
| 59 | +
|
| 60 | +## Setup Matter build environment |
| 61 | +
|
| 62 | +- Enter to cloned Matter project in terminal and run the following script |
| 63 | +
|
| 64 | + ``` |
| 65 | + source scripts/activate.sh -p bouffalolab |
| 66 | + ``` |
| 67 | +
|
| 68 | + > Please refer to `scripts/bootstrap.sh` and `scripts/activate.sh` for more |
| 69 | + > detail. |
| 70 | +
|
| 71 | +# Build examples |
| 72 | +
|
| 73 | +## Build options for `Bouffalo Lab` SoC |
| 74 | +
|
| 75 | +With `source scripts/activate.sh -p bouffalolab` under terminal, please try the |
| 76 | +following command to list supports options. |
| 77 | +
|
| 78 | +``` |
| 79 | +./scripts/build/build_examples.py targets |
| 80 | +``` |
| 81 | +
|
| 82 | +The output with `bouffalolab` started likes below: |
| 83 | +
|
| 84 | +``` |
| 85 | +bouffalolab-{bl602dk,bl704ldk,bl706dk,bl602-night-light,bl706-night-light,bl602-iot-matter-v1,xt-zb6-devkit}-{light,contact-sensor}-{ethernet,wifi,thread,thread-ftd,thread-mtd}-{easyflash,littlefs}[-shell][-mfd][-rotating_device_id][-rpc][-cdc] |
| 86 | +``` |
| 87 | +
|
| 88 | +- supported board options, select one of the following options to build |
| 89 | +
|
| 90 | + - `-bl602dk` |
| 91 | + - `-bl616dk` |
| 92 | + - `-bl704ldk` |
| 93 | + - `-bl706dk` |
| 94 | +
|
| 95 | + - `-bl602-night-light` |
| 96 | + - `-bl706-night-light` |
| 97 | + - `-bl602-iot-matter-v1` |
| 98 | + - `-xt-zb6-devkit` |
| 99 | +
|
| 100 | +- supported example options, select one of the following options to build |
| 101 | +
|
| 102 | + - `-light` |
| 103 | + - `-contact-sensor`, currently, only BL704L with Thread MTD and low power |
| 104 | + supported |
| 105 | +
|
| 106 | +- connectivity options, select one of the following options to build |
| 107 | +
|
| 108 | + - `-wifi`, specifies to use Wi-Fi for Matter application. |
| 109 | +
|
| 110 | + - `-ethernet`, specifies to use Ethernet for Matter application. |
| 111 | +
|
| 112 | + - `-thread`, specifies to use Thread FTD for Matter application. |
| 113 | +
|
| 114 | + - `-thread-ftd`, specifies to use Thread FTD for Matter application. |
| 115 | +
|
| 116 | + - `-thread-mtd`, specifies to use Thread MTD for Matter application. |
| 117 | +
|
| 118 | +- storage options, select one of the following options to build |
| 119 | +
|
| 120 | + - `-littlefs`, specifies to use `littlefs` for flash access. |
| 121 | +
|
| 122 | + - `-easyflash`, specifies to use `easyflash` for flash access. |
| 123 | +
|
| 124 | + > `littlefs` has different format with `easyflash`, please uses |
| 125 | + > `-easyflash` for your in-field production |
| 126 | +
|
| 127 | +- `-rotating_device_id`, enable rotating device id |
| 128 | +
|
| 129 | +- `-mfd`, enable Matter factory data feature, which load factory data from |
| 130 | + `MFD` partition |
| 131 | +
|
| 132 | + - Please refer to |
| 133 | + [Bouffalo Lab Matter factory data guide](./matter_factory_data.md) or |
| 134 | + contact to `Bouffalo Lab` for support. |
| 135 | +
|
| 136 | +- `-shell`, enable command line |
| 137 | +
|
| 138 | +- `-rpc`, enable Pigweed RPC feature, which will use `baudrate` 115200 for PRC |
| 139 | +
|
| 140 | +- `-cdc`, enable USB CDC feature, only support for BL706, and can't work with |
| 141 | + Ethernet Board |
| 142 | +
|
| 143 | +> `Bouffalo Lab` Matter project uses UART `baudrate` 2000000 for logging output |
| 144 | +> by default. If you want other `baudrate` for your test station, please change |
| 145 | +> variable `baudrate` in `BUILD.gn` under example project. |
| 146 | +
|
| 147 | +## Build an example |
| 148 | +
|
| 149 | +Taking lighting app with `littlefs` supported as example : |
| 150 | +
|
| 151 | +- BL602DK with Wi-Fi |
| 152 | +
|
| 153 | + ``` |
| 154 | + ./scripts/build/build_examples.py --target bouffalolab-bl602dk-light-wifi-littlefs build |
| 155 | + ``` |
| 156 | +
|
| 157 | +- BL616DK with Wi-Fi |
| 158 | +
|
| 159 | + ```shell |
| 160 | + ./scripts/build/build_examples.py --target bouffalolab-bl616dk-light-wifi-littlefs build |
| 161 | + ``` |
| 162 | +
|
| 163 | +- BL616 with Thread |
| 164 | +
|
| 165 | + ``` |
| 166 | + ./scripts/build/build_examples.py --target bouffalolab-bl616dk-light-thread-littlefs build |
| 167 | + ``` |
| 168 | +
|
| 169 | +- BL704L with Thread |
| 170 | +
|
| 171 | + ``` |
| 172 | + ./scripts/build/build_examples.py --target bouffalolab-bl704ldk-light-thread-littlefs build |
| 173 | + ``` |
| 174 | +
|
| 175 | +- BL706 with Thread |
| 176 | +
|
| 177 | + ``` |
| 178 | + ./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-thread-littlefs build |
| 179 | + ``` |
| 180 | +
|
| 181 | +- BL706 with Ethernet |
| 182 | +
|
| 183 | + ``` |
| 184 | + ./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-ethernet-littlefs build |
| 185 | + ``` |
| 186 | +
|
| 187 | +- BL706 with Wi-Fi |
| 188 | +
|
| 189 | + ``` |
| 190 | + ./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-ethernet-littlefs build |
| 191 | + ``` |
| 192 | +
|
| 193 | + > This BL706 + BL602 Wi-Fi solution: BL602 runs WLAN part and BL706 runs |
| 194 | + > TCP/IP stack which uses SPI for communication between these two parts. |
| 195 | +
|
| 196 | +# Download image |
| 197 | +
|
| 198 | +Take build target `bouffalolab-bl602dk-light-wifi-littlefs` as example to |
| 199 | +introduce image downloading steps. |
| 200 | +
|
| 201 | +After example compiled, a python script `chip-bl602-lighting-example.flash.py` |
| 202 | +will be generated out under `./out/bouffalolab-bl602dk-light-wifi-littlefs/` and |
| 203 | +is used to download image to `Bouffalo Lab` SoC. |
| 204 | +
|
| 205 | +And download image as following steps: |
| 206 | +
|
| 207 | +- Connect the board to your build machine with USB cable |
| 208 | +
|
| 209 | +- Put the SoC to the download mode: |
| 210 | +
|
| 211 | + - Press and hold the **BOOT** button. |
| 212 | + - Click the **RESET** or **EN** button. |
| 213 | + - Release the **BOOT** button. |
| 214 | +
|
| 215 | +- Type following command for image download. Please set serial port |
| 216 | + accordingly, here we use /dev/ttyACM0 as a serial port example. |
| 217 | +
|
| 218 | + ```shell |
| 219 | + ./out/bouffalolab-bl602dk-light-wifi-littlefs/chip-bl602-lighting-example.flash.py --port /dev/ttyACM0 |
| 220 | + ``` |
| 221 | +
|
| 222 | + If needs to download image with the whole flash erased, please append |
| 223 | + `--erase` option. |
| 224 | +
|
| 225 | + ```shell |
| 226 | + ./out/bouffalolab-bl602dk-light-wifi-littlefs/chip-bl602-lighting-example.flash.py --port /dev/ttyACM0 --erase |
| 227 | + ``` |
| 228 | +
|
| 229 | + > Note, better to append --erase option to download image for BL602 develop |
| 230 | + > board at first time. |
| 231 | +
|
| 232 | +- Then, open serial console `/dev/ttyACM0` with `baudrate` 2000000. The log |
| 233 | + will output if the **RESET** or **EN** button clicked. |
| 234 | +
|
| 235 | +# Test Commission and Control with chip-tool |
| 236 | +
|
| 237 | +Please follow |
| 238 | +[chip_tool_guide](../../development_controllers/chip-tool/chip_tool_guide.md) to |
| 239 | +build and [guide](../../../examples/chip-tool/README.md) use chip-tool for test. |
| 240 | +
|
| 241 | +## Prerequisite for Thread Protocol |
| 242 | +
|
| 243 | +Thread wireless protocol could runs on BL704L/BL706/BL616, which needs a Thread |
| 244 | +border router to connect Thread network to Wi-Fi/Ethernet network. Please follow |
| 245 | +this [guide](../openthread/openthread_border_router_pi.md) to setup a raspberry |
| 246 | +Pi border router. |
| 247 | +
|
| 248 | +After Thread border router setup, please type following command on Thread border |
| 249 | +router to get Thread network credential. |
| 250 | +
|
| 251 | +```shell |
| 252 | +sudo ot-ctl dataset active -x |
| 253 | +``` |
| 254 | + |
| 255 | +## Commissioning over BLE |
| 256 | + |
| 257 | +- Reset the board or factory reset the board |
| 258 | + |
| 259 | +- Enter build out folder of chip-tool and running the following command to do |
| 260 | + BLE commission |
| 261 | + |
| 262 | + - Wi-Fi |
| 263 | + |
| 264 | + ```shell |
| 265 | + ./out/linux-x64-chip-tool/chip-tool pairing ble-wifi <device_node_id> <wifi_ssid> <wifi_passwd> 20202021 3840 |
| 266 | + ``` |
| 267 | + |
| 268 | + - Thread |
| 269 | + |
| 270 | + ```shell |
| 271 | + ./out/linux-x64-chip-tool/chip-tool pairing ble-thread <device_node_id> hex:<thread_operational_dataset> 20202021 3840 |
| 272 | + ``` |
| 273 | + |
| 274 | + - Ethernet |
| 275 | + `./out/linux-x64-chip-tool/chip-tool pairing onnetwork <device_node_id> 20202021` |
| 276 | + > `<device_node_id>`, which is node ID assigned to device with |
| 277 | + > chip-tool;<br>`<wifi_ssid>`, Wi-Fi network SSID;<br>`<wifi_passwd>`, |
| 278 | + > Wi-FI network password;<br>`<thread_operational_dataset>`, Thread |
| 279 | + > network credential which running `sudo ot-ctl dataset active -x` |
| 280 | + > command on border router to get. |
| 281 | + |
| 282 | +## Read a cluster attribute |
| 283 | + |
| 284 | +``` |
| 285 | +./out/linux-x64-chip-tool/chip-tool basicinformation read vendor-name <device_node_id> 0 |
| 286 | +``` |
0 commit comments