-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BL602] 1.Update README 2.Add wifi scan 3.Update sdk repo to fix pbuf. (
#18944) * [BL602] 1.Update README 2.Add wifi scan 3.Update sdk repo to fix pbuf. * [BL602] Update README * Restyled by whitespace * Restyled by clang-format * Restyled by prettier-markdown * [BL602] Update README ,word list and fix spell error. * [BL602] Fix spell error * Restyled by prettier-markdown * [BL602] Delete picocom from the word list * Restyled by prettier-markdown * [BL602] delete not use code Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
Showing
18 changed files
with
192 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,157 @@ | ||
#CHIP BL602 Lighting Example | ||
# BL602 | ||
|
||
## Build | ||
This example functions as a wifi light bulb device type, with on/off | ||
capabilities. The steps were verified on BL602-IoT-DVK-3S board. | ||
|
||
- Install some additional tools(likely already present for CHIP developers): | ||
BL602-IoT-DVK-3S | ||
<img src="../../../platform/bouffalolab/bl602/doc/images/bl602_iot_3S_v2.jpg" style="zoom:25%;" /> | ||
|
||
#Linux \$ sudo apt-get install git libwebkitgtk-1.0-0 ninja-build | ||
## Initial setup | ||
|
||
#Mac OS X \$ brew install ninja | ||
- Setting up the environment on ubuntu 20.04 or 18.04 | ||
|
||
* Build the example application: | ||
``` | ||
$ sudo apt-get update | ||
$ sudo apt-get upgrade | ||
$ sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev python3-pip unzip libgirepository1.0-dev libcairo2-dev bluez avahi-daemon | ||
$ sudo apt-get install pi-bluetooth (if not raspberry pi, sudo apt-get install bluetooth) | ||
$ reboot | ||
`connectedhomeip$ ./scripts/build/build_examples.py --target bl602-lighting build` | ||
``` | ||
|
||
Generated files | ||
- Clone and initialize the connectedhomeip repo | ||
|
||
``` | ||
connectedhomeip/out/lighting_app_bl602/chip-bl602-lighting-example.bin | ||
``` | ||
``` | ||
git clone https://github.com/project-chip/connectedhomeip.git | ||
cd connectedhomeip | ||
git submodule update --init --recursive | ||
``` | ||
|
||
- To delete generated executable, libraries and object files use: | ||
- Install packets | ||
|
||
``` | ||
$ cd ~/connectedhomeip/ | ||
$ rm -rf out/ | ||
``` | ||
``` | ||
$ cd {path-to-connectedhomeip} | ||
connectedhomeip$ source ./scripts/bootstrap.sh | ||
connectedhomeip$ source ./scripts/activate.sh | ||
## Flash | ||
``` | ||
|
||
- Download [FLASH_TOOL](https://dev.bouffalolab.com/download/). | ||
## Build the image | ||
|
||
### Setting up Python Controller | ||
- Build the example application: | ||
|
||
Once BL602 is up and running, we need to set up a device controller to perform | ||
commissioning and cluster control. | ||
`connectedhomeip$ ./scripts/build/build_examples.py --target bl602-light build` | ||
|
||
- Set up python controller. | ||
Generated files | ||
|
||
``` | ||
$ cd {path-to-connectedhomeip} | ||
$ ./scripts/build_python.sh -m platform | ||
``` | ||
`connectedhomeip/out/bl602-light/chip-bl602-lighting-example.bin` | ||
|
||
- Execute the controller. | ||
- To delete generated executable, libraries and object files use: | ||
|
||
``` | ||
$ source ./out/python_env/bin/activate | ||
$ chip-device-ctrl | ||
``` | ||
``` | ||
$ cd ~/connectedhomeip/ | ||
$ rm -rf out/ | ||
``` | ||
### Commissioning over BLE | ||
## Flash the board | ||
- Establish the secure session over BLE. BLE is the default mode in the | ||
application and is configurable through menuconfig. | ||
- Download [Bouffalo Lab Dev Cube](https://dev.bouffalolab.com/download/). | ||
``` | ||
- chip-device-ctrl > ble-scan | ||
- chip-device-ctrl > set-pairing-wifi-credential TESTSSID P455W4RD | ||
- chip-device-ctrl > connect -ble 3904 20202021 135246 | ||
Log in to the site as a guest. | ||
Parameters: | ||
1. Discriminator: 3904 | ||
2. Setup-pin-code: 20202021 | ||
3. Node ID: Optional. | ||
If not passed in this command, then it is auto-generated by the controller and displayed in the output of connect. | ||
The same value should be used in the next commands. | ||
We have chosen a random node ID which is 135246. | ||
4. TESTSSID : Wi-Fi SSID | ||
5. P455W4RD : Wi-Fi Password | ||
``` | ||
<img src="../../../platform/bouffalolab/bl602/doc/images/image-web-login.png" style="zoom:30%;" align=left /> | ||
<img src="../../../platform/bouffalolab/bl602/doc/images/dev-cube.png" style="zoom:30%;" align=left /> | ||
run the software : | ||
<img src="../../../platform/bouffalolab/bl602/doc/images/dev-cube-home.png" style="zoom:70%;" align=left /> | ||
<img src="../../../platform/bouffalolab/bl602/doc/images/dev-cube-iot.png" style="zoom:70%;" /> | ||
The following picture shows the burning interface. To download the firmware, you | ||
need to enter the download mode: press and hold the Boot (IO8) pin of the | ||
development board, press the **RST** button, and then release the Boot button to | ||
enter the burning and downloading mode. | ||
<img src="../../../platform/bouffalolab/bl602/doc/images/image-dev-cube.png" style="zoom:70%;" align=left /> | ||
Notice: Latest version Bouffalolab dev cube is recommended. | ||
Factory Params: | ||
`BouffaloLabDevCube-1.7.2-linux-x86/chips/bl602/device_tree/bl_factory_params_IoTKitA_40M.dts` | ||
Partition Table: | ||
`BouffaloLabDevCube-1.7.2-linux-x86/chips/bl602/partition/partition_cfg_2M.toml` | ||
Boot2 Bin: | ||
`BouffaloLabDevCube-1.7.2-linux-x86/chips/bl602/builtin_imgs/boot2_iap_v5.5/boot2_iap_release.bin` | ||
Firmware Bin: `connectedhomeip/out/bl602-light/chip-bl602-lighting-example.bin` | ||
Partition Table: | ||
1. FW: The size of FW size0 must be larger than the bin size, we can do it by | ||
reducing the size of FW size1 and media partition size0. | ||
COM Port: | ||
``` | ||
ls -la /dev/ttyUSB* | ||
``` | ||
select the big one. | ||
## Validate the example | ||
1.The device should present itself as a USB serial device on your computer. You | ||
may look it up in `/dev/`: | ||
``` | ||
ls -la /dev/tty* | ||
``` | ||
You can open the serial console. For example, if the device is at `/dev/USB1`: | ||
``` | ||
picocom -b 2000000 /dev/ttyUSB1 | ||
``` | ||
To reset the board, press the **RST** button. And you will see the log from the | ||
demo board. | ||
## Commission a device using chip-tool | ||
To initiate a client commissioning request to a device, run the built executable | ||
and choose the pairing mode. | ||
#### Commissioning over BLE | ||
Run the built executable and pass it the discriminator and pairing code of the | ||
remote device, as well as the network credentials to use. | ||
The command below uses the default values hard-coded into the debug versions of | ||
the BL602 lighting-app to commission it onto a Wi-Fi network: | ||
``` | ||
$ sudo ./chip-tool pairing ble-wifi 1 ${SSID} ${PASSWORD} 20202021 3840 | ||
|
||
Parameters: | ||
1. Discriminator: 3840 | ||
2. Setup-pin-code: 20202021 | ||
3. Node ID: 1 | ||
4. SSID : Wi-Fi SSID | ||
5. PASSWORD : Wi-Fi Password | ||
``` | ||
### Cluster control | ||
- After successful commissioning, use the OnOff cluster commands to control | ||
the OnOff attribute. This allows you to toggle a parameter implemented by | ||
the device to be On or Off. | ||
`chip-device-ctrl > zcl OnOff On 135246 1 1` | ||
`chip-device-ctrl > zcl OnOff Off 135246 1 1` | ||
|
||
- Use the LevelControl cluster commands to control the CurrentLevel attribute. | ||
This allows you to control the brightness of the led. | ||
|
||
`chip-device-ctrl > zcl LevelControl MoveToLevel 135246 1 1 level=10 transitionTime=0 optionMask=0 optionOverride=0` | ||
`$ sudo ./chip-tool onoff on 1 1` | ||
- Use the ColorControl cluster commands to control the CurrentHue and | ||
CurrentSaturation attribute. | ||
- Use ColorControl cluster command to control the color attributes: | ||
`chip-device-ctrl > zcl ColorControl MoveToHue 135246 1 1 hue=100 direction=0 transitionTime=0 optionsMask=0 optionsOverride=0` | ||
`chip-device-ctrl > zcl ColorControl MoveToSaturation 135245 1 1 saturation=200 transitionTime=0 optionsMask=0 optionsOverride=0` | ||
`$ sudo ./chip-tool colorcontrol move-to-hue-and-saturation 240 100 0 0 0 1 1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.