1 # CHIP ESP32 Pigweed Example Application
3 The ESP32 example demonstrates the usage of Pigweed module functionalities in an
6 The example is based on [CHIP](https://github.com/project-chip/connectedhomeip),
7 the [Pigweed](https://pigweed.googlesource.com/pigweed/pigweed) module, which is
8 a collection of libraries that provide different functionalities for embedded
9 systems, and the ESP32 platform.
11 You can use this example as a training ground for making experiments, testing
12 Pigweed module features and checking what actions are necessary to fully
13 integrate Pigweed in a CHIP project.
15 Pigweed functionalities are being gradually integrated into CHIP. Currently, the
16 following features are available:
18 - **Echo RPC** - Creates a Remote Procedure Call server and allows sending
19 commands through the serial port to the device, which makes echo and sends
20 the received commands back.
24 - [CHIP ESP32 Pigweed Example Application](#chip-esp32-pigweed-example-application)
25 - [Building the Example Application](#building-the-example-application)
26 - [To build the application, follow these steps:](#to-build-the-application-follow-these-steps)
27 - [Testing the Example Application](#testing-the-example-application)
31 ## Building the Example Application
33 Building the example application requires the use of the Espressif ESP32 IoT
34 Development Framework and the xtensa-esp32-elf toolchain.
36 The VSCode devcontainer has these components pre-installed, so you can skip this
37 step. To install these components manually, follow these steps:
39 - Clone the Espressif ESP-IDF and checkout release/v4.2 branch
43 $ git clone https://github.com/espressif/esp-idf.git
45 $ git checkout release/v4.2
46 $ git submodule update --init
47 $ export IDF_PATH=${HOME}/tools/esp-idf
52 $ sudo apt-get install ninja-build
54 ### To build the application, follow these steps:
56 Currently building in VSCode _and_ deploying from native is not supported, so
57 make sure the IDF_PATH has been exported(See the manual setup steps above).
59 - In the root of the example directory, sync the CHIP tree's submodules and
60 source `idf.sh`. Note: This does not have to be repeated for incremental
65 - Configuration Options
67 To choose from the different configuration options, run menuconfig
71 This example uses UART0 for serial communication. You can change this through
72 `PW RPC Example Configuration`. As a result, the console has been shifted to UART1
73 You can change this through `Component config` -> `Common ESP-related` ->
74 `UART for console output`
76 To use the default configuration options, run the default config
80 - Run make to build the demo application.
84 - After building the application, to flash it outside of VSCode, connect your
85 device via USB. Then run the following command to flash the demo application
86 onto the device and then monitor its output. If necessary, replace
87 `/dev/tty.SLAB_USBtoUART`(MacOS) with the correct USB device name for your
88 system(like `/dev/ttyUSB0` on Linux). Note that sometimes you might have to
89 press and hold the `boot` button on the device while it's trying to connect
90 before flashing. For ESP32-DevKitC devices this is labeled in the
91 [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description).
93 $ idf make flash ESPPORT=/dev/tty.SLAB_USBtoUART
95 Note: Some users might have to install the
96 [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers)
97 before the device shows up on `/dev/tty`.
99 ## Testing the Example Application
101 Run the following command to start an interactive Python shell, where the Echo
102 RPC commands can be invoked:
104 python -m pw_hdlc.rpc_console --device /dev/tty.SLAB_USBtoUART -b 115200 $CHIP_ROOT/third_party/pigweed/repo/pw_rpc/pw_rpc_protos/echo.proto -o /tmp/pw_rpc.out
106 To send an Echo RPC message, type the following command, where the actual
107 message is the text in quotation marks after the `msg=` phrase:
109 rpcs.pw.rpc.EchoService.Echo(msg="hi")