Files
tinyusb/examples/device/cdc_uac2
hathach 4b1c8d16f7 docs: add build-doc tooling and a README for every example
Documentation tooling:
- Add the `build-doc` skill and `tools/build_doc.py` wrapper for local
  Sphinx builds (clean / -W / open).
- Enable Markdown (MyST) in conf.py and auto-collect
  examples/{device,host,dual}/*/README.md into a 3-level Examples nav
  (Examples > Device/Host/Dual > example), noting each page's source
  location and normalizing headings to a single H1.
- Remove the stale `.claude/commands/build-doc.md`; point the AGENTS.md
  Documentation section at the skill.

Example docs:
- Add a README.md for every device/host/dual example: what it does, USB
  interface table, notable tusb_config.h settings, generic CMake + Make
  build steps, and how to try it.
- Fold each *_freertos variant into its base README, noting the FreeRTOS
  source path and any RTOS-specific behavior.

Generated docs/examples/ output is git-ignored. Builds clean with
`sphinx-build -W`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 10:16:25 +07:00
..
2025-02-09 00:25:38 +01:00
2025-10-14 17:53:55 +07:00

CDC + UAC2

This example provides a composite CDC + UAC2 device.

Use Cases

  • The CDC + UAC2 composite device happens to be important, especially in the amateur radio community.

    Modern radios (rigs) like Icom IC-7300 + IC-705 expose a sound card and a serial device (composite device) to the computer over a single USB cable. This allows for Audio I/O and CAT control over a single USB cable which is very convenient.

    By including and maintaining this example in TinyUSB repository, we enable the amateur radio community to build (homebrew) radios with similar functionality as the (expensive) commercial rigs.

  • https://digirig.net/digirig-mobile-rev-1-9/ is a digital interface for interfacing radios (that lack an inbuilt digital interface) with computers. Digirig Mobile works brilliantly (is OSS!) and is a big improvement over traditional digital interfaces (like the SignaLink USB Interface). By using a CDC + UAC2 composite device, we can simplify the Digirig Mobile schematic, drastically reduce the manufacturing cost, and (again) enable the homebrewers community to homebrew a modern digital interface with ease themselves.

Build Steps

mkdir build && cd build
cmake -DBOARD=raspberry_pi_pico ..
cmake --build .

Make:

make BOARD=raspberry_pi_pico all

USB Descriptors

Interface Class driver
02 UAC2 audio (control, speaker streaming, mic streaming)
34 CDC (virtual serial)

Configuration

Notable tusb_config.h settings:

#define CFG_TUD_CDC                            1
#define CFG_TUD_AUDIO                          1
#define CFG_TUD_AUDIO_FUNC_1_N_FORMATS         2       // two audio formats
#define CFG_TUD_AUDIO_FUNC_1_MAX_SAMPLE_RATE   96000   // 48000 on Renesas RX
#define CFG_TUD_CDC_RX_BUFSIZE   (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE   (TUD_OPT_HIGH_SPEED ? 512 : 64)

How to use

After flashing, the device enumerates as both a USB sound card and a serial port:

  • Audio: appears as a standard UAC2 sound card — list it with arecord -l / aplay -l on Linux, or find it in the OS sound settings. Audio is sourced/sunk by the example's audio_task.
  • Serial: the CDC port shows up as /dev/ttyACMx (Linux/macOS) or a COM port (Windows); open it with any terminal.

In the amateur-radio setup, digital-mode software (WSJT-X, fldigi, …) uses the sound card for audio and the serial port for CAT/PTT control — both over the one cable.