Skip to content

WIP: esp32c6: add ESP32-C6 platform support and loopback test suite - #11200

Draft
lgirdwood wants to merge 5 commits into
thesofproject:mainfrom
lgirdwood:feature/esp32c6-sof-port
Draft

lgirdwood wants to merge 5 commits into
thesofproject:mainfrom
lgirdwood:feature/esp32c6-sof-port

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Summary

This draft PR introduces Sound Open Firmware (SOF) platform support for Espressif ESP32-C6 (Single-core RISC-V @ 160 MHz) development boards:

  • Seeed Studio XIAO ESP32-C6 (Default Master Tx)
  • Waveshare ESP32-C6-Zero (Default Slave Rx)

Companion Zephyr DAI driver changes are pushed to lgirdwood/zephyr on branch feature/esp32c6-dai-port.


Key Changes

  1. ESP32-C6 Platform Support:
    • Added platform initialization, mailbox stubs, memory maps, and clocks in src/platform/esp32c6/.
    • Added board configurations and devicetree overlays for xiao_esp32c6/esp32c6/hpcore and esp32c6_devkitc/esp32c6/hpcore.
  2. Static Pipeline Architecture:
    • Implemented esp32c6_pipeline_def.c with S16_LE stereo playback and capture pipelines, intermediate buffers, and static volume kcontrols.
    • Guarded UAC2-specific macros and routed direct volume/pipeline triggers when USB Audio Class stack is not present.
  3. Dynamic DAI Discovery:
    • Replaced hardcoded component IDs in sof_static_pipeline_set_clock_mode() with dynamic topology iteration matching SOF_STATIC_COMP_DAI, preventing invalid pointer casting across topologies with different component layouts.
  4. Shell & Diagnostics:
    • Added sof cap dump <count> in esp32_shell.c to inspect captured PCM stereo waveforms directly from the console.
  5. Automated Verification:
    • Added scripts/test_c6_loopback.py to automate bidirectional hardware I2S loopback testing between XIAO and Waveshare with frame synchronization, RMS/pk-pk checks, and channel symmetry verification.

Hardware Loopback Verification

Executed bidirectional loopback between Seeed XIAO and Waveshare C6-Zero connected via GPIO 18 (BCLK), GPIO 19 (WS), GPIO 20 (DOUT), and GPIO 21 (DIN):

  • Forward Loopback (XIAO Master Tx -> Waveshare Slave Rx): PASS (max|L - R| = 0, RMS 5297, pk-pk 64632).
  • Reverse Loopback (Waveshare Master Tx -> XIAO Slave Rx): PASS (max|L - R| = 0, 1000 Hz, RMS 1414, pk-pk 4000).
  • Overall test suite returned exit code 0.

Update west manifest to use lgirdwood/zephyr on branch
feature/esp32c6-dai-port and lgirdwood/hal_espressif on branch
esp32p4-uac2 for ESP32-C6 DAI driver and peripheral support.

Signed-off-by: Liam Girdwood <lgirdwood@gmail.com>
@lgirdwood
lgirdwood force-pushed the feature/esp32c6-sof-port branch 2 times, most recently from 32ecd83 to 0859dcf Compare November 1, 2026 21:56
…stry entries

- Register usb_audio and bt_audio UUIDs in uuid-registry.txt.
- Define DCACHE_LINE_SIZE 32 for ESP32-C6 in rtos/cache.h.
- Add static heapmem buffer for ESP32 platforms in zephyr/lib/alloc.c.

Signed-off-by: Liam Girdwood <lgirdwood@gmail.com>
…port

- Add COMP_USB_AUDIO pseudo-host streaming endpoint component for platforms
  without hardware USB Audio Class 2.0 device controllers.
- Support synthesizing IPC3 volume configuration in vol_static_create().
- Guard IPC4 static selector module ops behind CONFIG_IPC_MAJOR_4.
- In dai-zephyr.c, add SOF_DAI_ESP32_I2S and SOF_DAI_ESP32_PDM cases and
  allow bursting up to 4 periods on ESP32 to absorb scheduling jitter.
- In ipc3/dai.c, handle SOF_DAI_ESP32_I2S and SOF_DAI_ESP32_PDM in
  dai_config_dma_channel() and ipc_dai_data_config().
- In static_pipeline_loader.c, call dai_set_config() and set
  SOF_DAI_CONFIG_FLAGS_HW_PARAMS on IPC3 DAI endpoint creation.
- Add SOF_DAI_ESP32_I2S / SOF_DAI_ESP32_PDM to ipc/dai.h and
  SOF_DMA_DEV_I2S / SOF_DMA_DEV_PDM to sof/lib/dma.h.

Signed-off-by: Liam Girdwood <lgirdwood@gmail.com>
- Add CONFIG_PLATFORM_ESP32C6 to src/platform/Kconfig selecting
  ZEPHYR_LOG, ZEPHYR_NATIVE_DRIVERS, and STATIC_PIPELINE.
- Add src/platform/esp32c6 platform support with clock control,
  interrupt handlers, mailbox stubs, memory mappings, and platform init.
- Define static S16_LE stereo playback and capture pipelines with
  volume controls in esp32c6_pipeline_def.c.
- Add board configurations and overlays for Seeed Studio XIAO ESP32-C6
  (xiao_esp32c6/esp32c6/hpcore) and Waveshare ESP32-C6-Zero
  (esp32c6_devkitc/esp32c6/hpcore).
- Add DMA driver registration for ESP32 GDMA in zephyr/lib/dma.c.
- Update app/src/main.c to initialize static pipelines.

Signed-off-by: Liam Girdwood <lgirdwood@gmail.com>
…oopback test suite

- Implement sof_static_pipeline.c providing runtime pipeline trigger,
  clock mode switching (master/slave), volume/mute controls, and dynamic
  DAI discovery across static topologies.
- Add esp32_shell.c providing interactive SOF shell commands:
  sof status, play start/stop, cap start/stop/stats/dump, vol, mute,
  mode, and register dumping.
- Add scripts/test_c6_loopback.py automated bidirectional hardware I2S
  loopback test suite validating forward (XIAO -> Waveshare) and
  reverse (Waveshare -> XIAO) audio transmission with channel symmetry
  and waveform verification.

Signed-off-by: Liam Girdwood <lgirdwood@gmail.com>
@lgirdwood
lgirdwood force-pushed the feature/esp32c6-sof-port branch from 0859dcf to 5d0d566 Compare November 1, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant