BL70X is highly integrated BLE and IEEE 802.15.4 combo chip for IoT applications, and BL702 is a general name for BL70X family.
This example is powered by BL706 and functions as a Thread light bulb device type, with on/off, level and color capabilities. The steps were verified with following boards:
- BL706-IoT-DVK - BL706-NIGHT-LIGHT
bflb-iot-tool
, will be installed.source scripts/bootstrap.sh
Note,
scripts/bootstrap.sh
only installsbflb-iot-tool
under connectedhomeip build context.
bflb-iot-tool
will import under this environment.source scripts/activate.sh
Build with script gn_bouffalolab_example.sh
under root folder of connectedhomeip repo
Command format:
./scripts/examples/gn_bouffalolab_example.sh <Example folder> <Output folder> <Bouffalolab_board_name> [<Build options>]
Build lighting-app for board BL706-IoT-DVK.
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK
Build lighting-app for board BL706-NIGHT-LIGHT
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-NIGHT-LIGHT
With UART shell command enabled:
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK chip_build_libshell=true
With pigweed RPC enabled:
./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK 'import("//with_pw_rpc.gni")'
Note, UART shell command and pigweed RPC can not build together.
Build with build_examples.py
Build for BL706-IoT-DVK and BL706-NIGHT-LIGHT as following commands.
./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-BL706C-22-light build ./scripts/build/build_examples.py --target bouffalolab-BL706-NIGHT-LIGHT-light build
Build with pigweed RPC enabled as following commands.
./scripts/build/build_examples.py --target bouffalolab-BL706-IoT-DVK-BL706C-22-light-rpc build
Build options
chip_build_libshell
, whether to enable shell command line. It is set to false by default.baudrate
, UART baudrate for log output or shell command line.enable_psram
, whether to enable PSRAM
. It is set to true by default.build_examples.py
Modify value of build options in BUILD.gn file under example application folder../scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-IoT-DVK chip_build_libshell=true
Download image
Using script chip-bl702-lighting-example.flash.py
.
After building gets done, a python chip-bl702-lighting-example.flash.py
will generated under build output folder. Such as chip-bl702-lighting-example.flash.py for lighting-app example. Please check help
option of script for more detail.
Hold BOOT pin and reset chip, let it be in download mode.
Download image as following execution under build output folder:
./chip-bl702-lighting-example.flash.py --port /dev/tty.usbserial-3
Note, where
/dev/tty.usbserial-3
is UART port of device.
Build Bouffalolab OTA image as following execution under build output folder:
./chip-bl702-lighting-example.flash.py --build
After script executed, a folder ota_images
and image FW_OTA.bin.xz.hash
will generated. FW_OTA.bin.xz.hash
is compressed with hash verification with chip-bl702-lighting-example.bin
.
Note,
chip-bl702-lighting-example.flash.py
uses Python modulebflb-iot-tool
to flash device. Please make sure current terminal is under matter build environment, otherwise, Python modulebflb-iot-tool
should be installed with default Python.
Using Bouffalo Lab
flash toolBLDevCube
DTS
file <connectedhomeip_repo_path>/examples/platform/bouffalolab/bl702/flash_config/bl_factory_params_IoTKitA_32M.dts
;<connectedhomeip_repo_path>/examples/platform/bouffalolab/bl702/flash_config/partition_cfg_2M.toml
;Where
connectedhomeip_repo_path
is the root path of repo connectedhomeip.
Firmware Behavior
IOT Dev board Status LED: TX0
Lighting LED: RX1
Factory Reset: Short IO11
to GND
over 3 seconds
Night Light Unprovisioned state: light shows yellow. Provisioned state: light show white. Factory Reset: Power cycle 3 times before light is on; at 3rd time, light shows green and does factory reset after 3 seconds later. And factory reset can be cancelled during 3 seconds wait time.
UART baudrate for log and shell command
gn_bouffalolab_example.sh
with baudrate=[uart baudrate]
followed, such as ./scripts/examples/gn_bouffalolab_example.sh lighting-app out/debug BL706-NIGHT-LIGHT module_type="BL702" baudrate=115200
./chip-tool pairing ble-thread <node_id> hex:<thread_operational_dataset> 20202021 3840
node_id
is matter node id, such as 10; <thread_operational_dataset>
is Border Router Dataset, which to get with command sudo ot-ctl dataset active -x
on Rasp PI border router.$ ./chip-tool onoff toggle <node_id> 1
./chip-tool identify identify <identify_duration> <node_id> 1
which <identify_duration>
is how many seconds to execute identify command.
FW_OTA.bin.xz.hash
Under connectedhomeip repo path
$ ./src/app/ota_image_tool.py create -v 0xFFF1 -p 0x8005 -vn 1 -vs "1.0" -da sha256 <FW_OTA.bin.xz.hash> lighting-app.ota
lighting-app.ota should have greater software version which is defined by macro CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION in CHIPProjectConfig.h
$ rm -r /tmp/chip_* $ ./chip-ota-provider-app -f <path_to_ota_bin>/lighting-app.otawhere
<path_to_ota_bin>
is the folder for lighting-app.ota.$ ./chip-tool pairing onnetwork 1 20202021 $ ./chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0
./chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 <node_id_to_lighting_app> 0where
<node_id_to_lighting_app>
is node id of BL702 lighting app.