Target: Seeed XIAO ESP32-S3, ESP-IDF 6.1.
The current build is a minimal native USB CDC+HID diagnostic firmware. It
initializes only GPIO1/GPIO2 for active-low PTT inputs, while I2C, I2S, the
AIC3204, audio and NVS remain disabled. The earlier CDC-only source is retained
in main/main_cdc_only_fallback.c.
The diagnostic image was built successfully as
build/peiker_usb_mic.bin (204,240 bytes). The build reports a binary image
size of 0x31dd0 bytes and 81% free space in the application partition.
Do not treat the project as a finished, validated codec firmware or flash it into a PCB without reviewing the pin map and electrical design.
- PTT1: GPIO1, switch to GND
- PTT2: GPIO2, switch to GND
- AIC3204 RESET: GPIO3
- I2C SDA: GPIO5 (AIC3204 pin 10)
- I2C SCL: GPIO6 (AIC3204 pin 9)
- I2S BCLK: GPIO7 (AIC3204 pin 2)
- I2S WCLK: GPIO8 (AIC3204 pin 3)
- I2S data from codec: GPIO9 (AIC3204 pin 5)
- I2C address is configured as 0x18; verify the AIC3204 address-select pin/wiring.
These are the pins discussed for the custom PCB; confirm against the actual XIAO ESP32-S3 pinout and schematic before use.
After Windows opens the CDC port, the firmware sends:
PEIKER_DIAG BOOT OK
PEIKER_DIAG CDC CONNECTED
PEIKER_DIAG RUNNING
Send any text to the port to receive PEIKER_DIAG RX OK. No JSON
configuration protocol is active in this diagnostic build.
PTT state changes are also reported:
PEIKER_DIAG PTT1 DOWN
PEIKER_DIAG PTT1 UP
PEIKER_DIAG PTT2 DOWN
PEIKER_DIAG PTT2 UP
The HID keyboard interface sends F13 for PTT1 and F14 for PTT2. The configuration descriptor uses CDC interfaces 0/1 and HID interface 2. The diagnostic build also reports raw input samples every 300 ms:
PEIKER_DIAG GPIO RAW D0/GPIO1=HIGH D1/GPIO2=HIGH
On the XIAO ESP32-S3 pin mapping, D0 is GPIO1 and D1 is GPIO2. The inputs use the ESP32 internal pull-ups, so an open input should read HIGH and a direct connection to GND should read LOW.
The CDC interface accepts one JSON object per line:
{"cmd":"get"}
{"gain_db":30,"noise_gate":true,"noise_filter":true,"gate_threshold":250}
{"cmd":"save"}
Changes are applied immediately to the running firmware. They are persistent
only after the explicit save command. PTT key values are USB HID usage IDs;
the defaults are F13 (0x68) and F14 (0x69).
- Install VS Code and Espressif's ESP-IDF extension with ESP-IDF 6.1.
- Open this folder as an ESP-IDF project.
- Select target
esp32s3if prompted. - Build, then flash using the XIAO's USB-C connector.
- For this diagnostic build, check that Windows creates a CDC COM port and a keyboard device after reset. Open the new application port (not the ROM bootloader port) with a serial terminal and look for the messages above.
- Connect PTT1 (GPIO1/D0) or PTT2 (GPIO2/D1) to GND. A press/release should produce one DOWN and one UP CDC message and one F13/F14 key transition.
CLI alternative from an ESP-IDF terminal:
idf.py set-target esp32s3
idf.py build
idf.py -p COMx flash monitorReplace COMx with the actual port.
- Verify the AIC3204 pinout, supply/LDO configuration, microphone type and input route.
- Provide a valid MCLK source or the exact PLL clocking supported by the assembled AIC3204 circuit.
- Validate the USB descriptors and endpoint behavior on the target ESP-IDF version and Windows host.
- Replace the conservative codec bring-up with the verified ADC/PGA register sequence and test the microphone signal electrically.