Skip to content

Commit

Permalink
[Ameba] Update README.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
pankore committed Dec 16, 2021
1 parent 0f66b08 commit 475ed90
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/all-clusters-app/ameba/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ control.
- [BLE mode](#ble-mode)
- [IP mode](#ip-mode)
- [Cluster control](#cluster-control)
- [Running RPC Console](#running-rpc-console)

---

Expand Down Expand Up @@ -113,3 +114,27 @@ to be On or Off.
[Python Controller](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/python_chip_controller_building.md#step-8-control-application-zcl-clusters)

$ chip-device-ctrl > zcl OnOff Toggle 1234 1 0

## Running RPC Console

- Connect a USB-TTL Adapter as shown below

Ameba USB-TTL
A19 TX
A18 RX
GND GND

- Build the [chip-rpc console](https://github.com/project-chip/connectedhomeip/tree/master/examples/common/pigweed/rpc_console)

- As part of building the example with RPCs enabled the chip_rpc python interactive console is installed into your venv. The python wheel files are also created in the output folder: out/debug/chip_rpc_console_wheels. To install the wheel files without rebuilding:

$ pip3 install out/debug/chip_rpc_console_wheels/*.whl

- Launch the chip-rpc console after inputting `ATS$` command

$ python3 -m chip_rpc.console --device /dev/tty<port connected to usb-ttl adapter> -b 115200

- Get and Set lighting directly using the RPC console

rpcs.chip.rpc.Lighting.Get()
rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5))
81 changes: 81 additions & 0 deletions examples/pigweed-app/ameba/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# CHIP Ameba Pigweed Example Application

This example demonstrates the usage of Pigweed module functionalities in an
application.

The example is based on [CHIP](https://github.com/project-chip/connectedhomeip),
the [Pigweed](https://pigweed.googlesource.com/pigweed/pigweed) module, which is
a collection of libraries that provide different functionalities for embedded
systems, and the Ameba platform.

You can use this example as a training ground for making experiments, testing
Pigweed module features and checking what actions are necessary to fully
integrate Pigweed in a CHIP project.

Pigweed functionalities are being gradually integrated into CHIP. Currently, the
following features are available:

- **Echo RPC** - Creates a Remote Procedure Call server and allows sending
commands through the serial port to the device, which makes echo and sends
the received commands back.

---

- [CHIP Ameba Pigweed Example Application](#chip-ameba-pigweed-example-application)
- [Building the Example Application](#building-the-example-application)
- [Testing the Example Application](#testing-the-example-application)

---

## Building the Example Application

- Pull docker image:

$ docker pull pankore/chip-build-ameba:latest

- Run docker container:

$ docker run -it -v ${CHIP_DIR}:/root/chip pankore/chip-build-ameba:latest

- Setup build environment:

$ source ./scripts/bootstrap.sh

- To build the demo application:

$ ./scripts/build/build_examples.py --target ameba-amebad-pigweed build

The output image files are stored in
`out/ameba-amebad-pigweed/asdk/image` folder.

The bootloader image files are stored in
`out/ameba-amebad-pigweed/asdk/bootloader` folder.

- After building the application, **Ameba Image Tool** is used to flash it to
Ameba board.

1. Connect your device via USB and open Ameba Image Tool.
2. Select correct serial port and set baudrate as **115200**.
3. Browse and add the corresponding image files in the Flash Download list to
the correct locations
4. Click **Download** button.

## Testing the Example Application

Connect a USB-TTL Adapter as shown below

Ameba USB-TTL
A19 TX
A18 RX
GND GND

Build the [chip-rpc console](https://github.com/project-chip/connectedhomeip/tree/master/examples/common/pigweed/rpc_console)

Input `ATS$` command, then launch the chip-rpc console, where the Echo RPC commands can be invoked

python -m pw_hdlc.rpc_console --device /dev/tty<USB-TTL port> -b 115200

To send an Echo RPC message, type the following command, where the actual
message is the text in quotation marks after the `msg=` phrase:

rpcs.pw.rpc.EchoService.Echo(msg="hi")

0 comments on commit 475ed90

Please sign in to comment.