Examples
Every wrapped peripheral has a minimal reference example. Each example carries a board.yaml, an annotated src/main.c, and a boards/ overlay directory — they double as tutorials. Comment density is ~50 % so the source teaches by itself.
Browse the full tree at alp-sdk/examples.
Build any example
cd alp-workspace
west alp-build -b native_sim/native/64 alp-sdk/examples/<name>
west build -d build -t run # native_sim
# or:
west flash # real silicon
On native_sim most peripherals don't have emul controllers (only I²C / SPI / GPIO / UART do). Examples that target unwrapped peripherals exit after printing alp_last_error() — that's expected and proves the wrapper plumbing compiles + links cleanly.
Cross-family examples
Work on any conformant SoM. Pick som.sku to match your hardware.
| Example | What it shows |
|---|---|
| GPIO Button + LED | GPIO open + input/output basics |
| I²C Scanner | Walk an I²C bus, report ACK'ing devices |
| PWM LED Fade | PWM channel open + duty sweep |
| ADC Voltmeter | ADC sample + millivolt conversion |
| SPI Loopback | SPI master TX/RX loopback |
| UART Echo | UART TX + RX echo |
| UART RX Ring Buffer | Interrupt-driven UART RX with byte-granular ring buffer |
| Counter + Alarm | Counter open + alarm callback |
| Quadrature Encoder Readout | Quadrature-encoder position read |
| RTC Clock | Set + read SoC RTC |
| Watchdog Feed | Watchdog open + feed cadence |
| CAN Loopback | CAN frame send + receive in loopback |
| I²S Tone | I²S sine-tone playback |
| Audio Loopback | PDM mic in → I²S speaker out |
| Multi-Proc Mailbox | M55-HP / M55-HE mailbox round-trip on AEN (both peer images ship) |
V2N-specific examples
Exercise the V2N's on-module GD32 bridge + dual Ethernet + secure element.
| Example | What it shows |
|---|---|
| GD32 Bridge Ping | PING + GET_VERSION on both SPI + I²C transports |
| Board ID Readout | Read SoM EEPROM manifest + assert SKU |
| EEPROM Manifest Dump | Hexdump + decode the 128-byte EEPROM manifest |
| Dual Ethernet Bring-up | Bring up both RTL8211FDI PHYs; WoL configuration |
| RTC Multi-Alarm | Multi-source callbacks on the RV-3028-C7 dispatcher |
| Temperature Sensor | TMP112 read loop |
| PWM Fan Control | Ramp a GD32-side PWM channel along a fan curve |
| Secure-Element Sign | OPTIGA Trust M ECDSA-P256 sign via raw APDU |
| xSPI NOR Read/Write | Erase + write + verify on the on-module xSPI NOR |
| eMMC Block Stat | Read on-module eMMC geometry |
| GD32 SWD Flash | Host-driven SWD bit-bang — bridge firmware recovery |
AEN-specific examples
| Example | What it shows |
|---|---|
| EdgeAI Vision (AEN) | Camera → Ethos-U inference → OLED overlay |
Application demos (v0.5 showcase, [UNTESTED])
End-to-end demos that combine multiple chip drivers + library knobs + LVGL UIs. All marked [UNTESTED] — they compile and pass smoke tests, HiL bring-up arrives in v0.6 / v0.8.
Edge AI
| Demo | What it shows |
|---|---|
| AI Camera Viewer | OV5640 → Ethos-U person-detect → LVGL bbox overlay (AEN) |
| Realtime Object Detection | OV5640 → DEEPX DX-M1 YOLOv8-tiny → LVGL overlay (V2N-M1) |
| Vibration Anomaly Detection | LSM6DSO vibration window → 1D-CNN anomaly score (AEN) |
Audio AI
| Demo | What it shows |
|---|---|
| Wake-Word ("Hey Alp") | Always-on KWS on AEN's low-power AI subsystem; ~1 mW continuous |
| Noise Suppression | Real-time spectral denoise (V2N) — headset / hearable / conferencing |
Drone
| Demo | What it shows |
|---|---|
| Drone HUD | IMU + GNSS + battery + ST7789 attitude HUD with LVGL |
| Drone Autopilot | PID-stabilised quadcopter flight controller (cascaded 1 kHz / 250 Hz / 25 Hz loops) |
IoT
| Demo | What it shows |
|---|---|
| IoT Dashboard | BME280 → MQTT/TLS publish + local LVGL dashboard |
| IoT Fleet OTA | Mender + MCUboot + OPTIGA-pinned ECDSA-P256 signed updates |
LVGL UI
| Demo | What it shows |
|---|---|
| LVGL Widgets Demo | Headline LVGL widget showcase on ST7789 |
| LVGL Benchmark | Per-scene FPS comparison across SoMs — reveals what GPU2D / DMA2D buy you per SKU |
| LVGL Music Player | LVGL UI + WM8960 codec + minimp3 decoder |
Heterogeneous-compute (v0.6 flagships)
One board.yaml v2, one orchestrator pass, two OSes — A-class Yocto + M-class Zephyr on the same SoM, talking through framed RPMsg via <alp/rpc.h>. Walkthrough at Heterogeneous Builds.
| Demo | What it shows |
|---|---|
rpmsg-v2n | V2N101 A55 (Yocto) ↔ M33-SM (Zephyr) pub/sub over RPMsg |
rpmsg-aen | AEN701 A32 (Yocto) ↔ M55-HP (Zephyr) with cacheable carve-out |
rpmsg-imx93 | iMX93 A55 (Yocto) ↔ M33 (Zephyr) |
heterogeneous-offload | A55 delegates FFT to the M33-SM peer via synchronous alp_rpc_call |
End-to-end reference applications
| Application | Stack |
|---|---|
| EdgeAI Vision (AEN) | Camera capture → ISP → Ethos-U inference → on-board OLED |
| IoT Connected Camera | Camera capture → DRP-AI inference → MQTT/TLS publish + LVGL UI |
| Production Deployment | The v1.0 integration flagship — factory provisioning → secure boot → OTA → remote attestation |
All three follow the same board.yaml workflow at a larger scale.
See also
- Quick start — first example end-to-end
- Firmware quickstart — per-SoM patterns
board.yamlreference