Test on Ubuntu 20.04
To check out this repository:
mkdir ${HOME}/AmebaD_with_CHIP
cd ${HOME}/AmebaD_with_CHIP
git clone https://github.com/hank820/ambd_sdk.git
cd ${HOME}/AmebaD_with_CHIP
git clone -b base1028_gn https://github.com/hank820/connectedhomeip
cd ${HOME}/AmebaD_with_CHIP/connectedhomeip
source scripts/bootstrap.sh
source scripts/activate.sh
> Find more details to setup linux build environment
> https://github.com/hank820/connectedhomeip/blob/master/docs/BUILDING.md
cd ${HOME}/AmebaD_with_CHIP/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp
make all
output : project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp/asdk/image/km0_boot_all.bin
cd ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp
make -C asdk lib_all
cd ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp
make -C asdk light
CHIP core (generate by GN/ninja in connectedhomeip. Config by chip/Makefile)
output : ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application
> libCHIP.a
CHIP application (generate by chip_main/Makefile)
output : ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/lib/application
> lib_main.a
cd ${HOME}/AmebaD_with_CHIP/ambd_sdk/project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp
make all
output :
project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km4_boot_all.bin
project/realtek_amebaD_va0_example/GCC-RELEASE/project_hp/asdk/image/km0_km4_image2.bin
Please refer Application Note Chapter 8 : Image Tool
Image Tool Path : $(SDK_ROOT)/tools/AmebaD/Image_Tool/
-
In "connectedhomeip/config/ambd/args.gni"
- set
chip_bypass_rendezvous = true
- Set
chip_ip_commissioning = false
- Set
chip_use_clusters_for_ip_commissioning = false
- Set
chip_config_network_layer_ble = false
- set
-
In "connectedhomeip/src/platform/AMBD/CHIPDevicePlatformConfig.h"
- Set
#define CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING 0
- Set
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0
- Set
-
Build and Flash
-
In "connectedhomeip/config/ambd/args.gni"vim
- Set
chip_ip_commissioning = true
- Set
chip_use_clusters_for_ip_commissioning = true
- Set
chip_config_network_layer_ble = false
- Set
-
In "connectedhomeip/src/platform/AMBD/CHIPDevicePlatformConfig.h"
- Set
#define CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING 1
- Set
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0
- Set
-
Build and Flash
-
In "connectedhomeip/config/ambd/args.gni"
- Set
chip_ip_commissioning = false
- Set
chip_use_clusters_for_ip_commissioning = false
- Set
chip_config_network_layer_ble = true
- Set
-
In "connectedhomeip/src/platform/AMBD/CHIPDevicePlatformConfig.h"
- Set
#define CONFIG_USE_CLUSTERS_FOR_IP_COMMISSIONING 0
- Set
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1
- Set
-
Build and Flash
Test with chip-tool
Use standalone chip-tool app(linux) to communicate with the device.
In order to send commands to a device, it must be commissioned with the client. chip-tool currently only supports commissioning and remembering one device at a time. The configuration state is stored in /tmp/chip_tool_config.ini
; deleting this and other .ini
files in /tmp
can sometimes resolve issues due to stale configuration.
- Enter the ATCMD
ATS$
- Connect to AP using
ATW0, ATW1, ATWC
commands - Run CHIP-TOOL IP commissioning command
./chip-tool pairing bypass XXX.XXX.XXX.XXX 5540 (Ameba IP)
- Enter the ATCMD
ATS$
- Connect to AP using
ATW0, ATW1, ATWC
commands - Run CHIP-TOOL IP commissioning command
./chip-tool pairing onnetwork 0 20202021 3840 XXX.XXX.XXX.XXX 5540 (Ameba IP)
- Enter the ATCMD
ATS$
- Run CHIP-TOOL IP commissioning command
./chip-tool pairing ble-wifi SSID PASSWORD 0 20202021 3840
Use PB_5 as output, connect a LED to this pin and GND.
-
Run CHIP-TOOL on-off cluster command
./chip-tool onoff on 1
-
Run CHIP-TOOL on-off cluster command
./chip-tool onoff off 1
Get doork lock cluster command on Ameba
-
Run CHIP-TOOL on-off cluster command
./chip-tool doorlock lock-door 1 1
-
Run CHIP-TOOL on-off cluster command
./chip-tool doorlock unlock-door 1 1
Test with Python Controller
To build the Python Controller (linux), run the following command.
./scripts/build_python.sh --clusters_for_ip_commissioning true --chip_mdns platform
To launch Python Controller, activate the python environment first.
source out/python_env/bin/activate
chip-device-ctrl
- Enter the ATCMD
ATS$
- Connect to AP using
ATW0, ATW1, ATWC
commands - Run python controller IP commissioning command
chip-device-ctrl > connect -ip <IP> 20202021 135246
- Resolve DNS-SD name and update address of the node in the device controller. Get fabric ID using get-fabricid and use the decimal value of compressed fabric id.
chip-device-ctrl > get-fabricid
- Resolve mDNS
chip-device-ctrl > resolve <Compressed Fabric ID> 135246
- On-Off cluster command
chip-device-ctrl >zcl OnOff On 135246 1 1
- On-Off cluster command
chip-device-ctrl >zcl OnOff Off 135246 1 1
-
Enter the ATCMD
ATS$
-
Run python controller BLE commissioning command
chip-device-ctrl > connect -ble 3840 20202021 135246
-
Provide network credentials
chip-device-ctrl > zcl NetworkCommissioning AddWiFiNetwork 135246 0 0 ssid=str:TESTSSID credentials=str:TESTPASSWD breadcrumb=0 timeoutMs=1000
-
Connect to AP
chip-device-ctrl > zcl NetworkCommissioning EnableNetwork 135246 0 0 networkID=str:TESTSSID breadcrumb=0 timeoutMs=1000
-
Close the BLE connection
chip-device-ctrl > close-ble
-
Resolve DNS-SD name and update address of the node in the device controller. Get fabric ID using get-fabricid and use the decimal value of compressed fabric id.
chip-device-ctrl > get-fabricid
-
Resolve mDNS
chip-device-ctrl >resolve <Compressed Fabric ID> 135246
-
On-Off cluster command
chip-device-ctrl >zcl OnOff On 135246 1 1
-
On-Off cluster command
chip-device-ctrl >zcl OnOff Off 135246 1 1