|
| 1 | +#Matter `Genio` Light Switch Example |
| 2 | + |
| 3 | +An example showing the use of Matter on the MediaTek `Genio` MT793X. |
| 4 | + |
| 5 | +<hr> |
| 6 | + |
| 7 | +- [Matter Genio Light Switch Example](#chip-genio-light-switch-example) |
| 8 | + - [Introduction](#introduction) |
| 9 | + - [Building](#building) |
| 10 | + - [Note](#note) |
| 11 | + - [Flashing the Application](#flashing-the-application) |
| 12 | + - [Viewing Logging Output](#viewing-logging-output) |
| 13 | + - [Running the Complete Example](#running-the-complete-example) |
| 14 | + - [Notes](#notes) |
| 15 | + |
| 16 | +<hr> |
| 17 | + |
| 18 | +<a name="intro"></a> |
| 19 | + |
| 20 | +## Introduction |
| 21 | + |
| 22 | +The `Genio` (MT793X) light switch example provides a baseline demonstration of a |
| 23 | +on-off light switch device, built using Matter and the MediaTek `Genio` SDK. It |
| 24 | +can be controlled by a Chip controller over Wi-Fi network.. |
| 25 | + |
| 26 | +The `Genio` device can be commissioned over Bluetooth Low Energy where the |
| 27 | +device and the Chip controller will exchange security information with the |
| 28 | +Rendez-vous procedure. Network credentials are then provided to the `Genio` |
| 29 | +device which will then join the network. |
| 30 | + |
| 31 | +The light switch example is intended to serve both as a means to explore the |
| 32 | +workings of Matter as well as a template for creating real products based on the |
| 33 | +MediaTek platform. |
| 34 | + |
| 35 | +<a name="building"></a> |
| 36 | + |
| 37 | +## Building |
| 38 | + |
| 39 | +- Following the Linux related descriptions in |
| 40 | + [Build Matter](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/BUILDING.md) |
| 41 | + to prepare the build environment. |
| 42 | + |
| 43 | +- Supported hardware: |
| 44 | + |
| 45 | + `Genio` 130A (MT7931) board: |
| 46 | + |
| 47 | + - `EK-AI7931LD KIT` |
| 48 | + |
| 49 | +* Build the example application: |
| 50 | + |
| 51 | + `cd ~/connectedhomeip` |
| 52 | + `./scripts/examples/gn_genio_example.sh ./examples/light-switch-app/genio` `./out/light-switch-app` |
| 53 | + |
| 54 | +- To delete generated executable, libraries and object files use: |
| 55 | + |
| 56 | + `$ cd ~/connectedhomeip` |
| 57 | + `$ rm -rf ./out/` |
| 58 | + |
| 59 | + OR use GN/Ninja directly |
| 60 | + |
| 61 | + `$ cd ~/connectedhomeip/examples/light-switch-app/genio` |
| 62 | + `$ git submodule update --init` |
| 63 | + `$ source third_party/connectedhomeip/scripts/activate.sh` |
| 64 | + `$ gn gen out/debug` |
| 65 | + `$ ninja -C out/debug` |
| 66 | + |
| 67 | +- To delete generated executable, libraries and object files use: |
| 68 | + |
| 69 | + `$ cd ~/connectedhomeip/examples/light-switch-app/genio` |
| 70 | + `$ rm -rf out/` |
| 71 | + |
| 72 | +## Flashing the Application |
| 73 | + |
| 74 | +- Copy the GUI based |
| 75 | + [Flash Tool](https://github.com/MediaTek-Labs/genio-matter-bsp/tree/main/flash_tool/FlashBurningTool_V2.83). |
| 76 | + from the Linux Host that the example was build to a Windows PC. |
| 77 | + |
| 78 | + Flash Tool can be found in this source tree under this directory |
| 79 | + |
| 80 | + `third_party/mt793x_sdk/filogic/flash_tool` |
| 81 | + |
| 82 | +- On the Windows PC, run the Flash Tool |
| 83 | + |
| 84 | + 1. Select the scatter.ini file in the `./out/light-switch-app` directory. |
| 85 | + 2. Follow the instruction that comes with `EK-AI7931LD KIT` to switch the |
| 86 | + kit to download mode. |
| 87 | + 3. Click `Download` on FLASH TOOL. |
| 88 | + |
| 89 | +## Running the Complete Example |
| 90 | + |
| 91 | +- This example needs one lighting-app device and one light-switch-app device. |
| 92 | + |
| 93 | +- You can provision and control the Chip device using the python controller, |
| 94 | + Chip tool standalone, Android or iOS app |
| 95 | + |
| 96 | + [CHIP |
| 97 | + Tool]](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/chip_tool_guide.md) |
| 98 | + |
| 99 | +- First of all, you have to commission with the light-switch-app (nodeID 1) |
| 100 | + and the lighting-app (nodeID 2) with the CHIP tool by following commands. |
| 101 | + |
| 102 | + ``` |
| 103 | + chip-tool pairing ble-wifi 1 my-ap myappassword 20202021 3840 |
| 104 | +
|
| 105 | + chip-tool pairing ble-wifi 2 my-ap myappassword 20202021 3840 |
| 106 | + ``` |
| 107 | +
|
| 108 | +- Next, you have to configure the ACL in the lighting-app device to allow |
| 109 | + access from switch device and chip-tool, and binding the lighting-app device |
| 110 | + to the light-switch-app device by following commands. |
| 111 | +
|
| 112 | + ``` |
| 113 | + chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null },{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [1], "targets": null }]' 2 0 |
| 114 | +
|
| 115 | + chip-tool binding write binding '[{"fabricIndex": 1, "node":2, "endpoint":1, "cluster":6}]' 1 1 |
| 116 | +
|
| 117 | + ``` |
| 118 | +
|
| 119 | +- Once all setup successfully, you can control the lighting-app device through |
| 120 | + the Matter Shell on the light-switch-app device. |
| 121 | +
|
| 122 | + ``` |
| 123 | + > switch onoff on |
| 124 | + > switch onoff off |
| 125 | + ``` |
| 126 | +
|
| 127 | +### Notes |
| 128 | +
|
| 129 | +- Depending on your network settings your router might not provide native ipv6 |
| 130 | + addresses to your devices (Border router / PC). If this is the case, you |
| 131 | + need to add a static ipv6 addresses on both device and then an ipv6 route to |
| 132 | + the border router on your PC |
0 commit comments