/rp2040-uart-eui

Simple UART demo with Electric UI and Raspberry Pi Pico

Primary LanguageCMakeMIT LicenseMIT

RP2040 Electric UI Example Project

Basic project demonstrating integration of the electricui-embedded library with Raspberry Pi Pico RP2040 microcontroller, using the pico-sdk C/C++ toolchain. Compatible with the quickstart tutorial.

We use the uart driver abstractions in preference to stdout, along with a non-blocking configurable LED blink demo.

In the main loop, any inbound bytes are passed to eui_parse() as they arrive. When a response is formed by eUI, it calls the eui_write() callback, which wraps the hal uart_putc_raw() call.

Hardware Setup

  • Developed against a Raspberry Pi Pico.
    • If using a board like the Adafruit RP2040 Feather, pass the PICO_BOARD setting to CMake - cmake .. -DPICO_BOARD=adafruit_feather_rp2040.
  • Exposes eui access over uart0 on GP0(TX)/GP1(RX) labelled pins. Connect a USB-UART (TTL) adapter to these pins (and ground).
  • UART is configured to run at 115200 baud, 8N1 by default.
  • The onboard green LED (GP25) is used as a blinker for the standard hello-electric example.
    • This pin definition may need to be modified to suit different board variants.

Firmware Setup

This is a normal pico-sdk based example project and should work with your normal development toolchain, assuming PICO_SDK_PATH has a correct reference to your toolchain.

mkdir build
cd build
cmake ..
make

Dependencies

Relies on the electricui-embedded library, which can be downloaded from GitHub, uncompressed, and placed in /electricui-embedded/.

The embedded library comes ready for CMake. Refer to the subdirectory and linker entries in the CMakeLists.txt in the root of this repo, or check out the longform integration guide for more detail.