Kode Dot

Audio

How sound gets into and out of a Kode Dot through one codec, two buses, a microphone and a speaker, and why the speaker needs the second chip.

What it is

Sound on the Kode Dot goes through one chip in both directions. A codec, an ES8311, turns the microphone's analogue signal into numbers on the way in and numbers back into a signal for the speaker on the way out. It is mono: one microphone, one speaker, one channel each way.

The P4 talks to that codec over two buses, and keeping them apart is the first thing to learn:

On the way out there is one more part. The codec's output is a line-level signal, too weak for a speaker, so a small class-D amplifier sits between them. Its enable pin is on the Kode Dot's other chip, the ESP32-C5, which is the one fact on this page that explains most silent boards.

How it is connected

flowchart LR
p4["ESP32-P4"] -- "I2C, 0x18" --> codec["ES8311 codec"]
p4 <-- "I2S" --> codec
mic["ZTS6211E microphone"] --> codec
codec --> amp["NS4150B amplifier"] --> spk["Speaker"]
c5["ESP32-C5"] -. "PA_CTRL, IO4" .-> amp
Configuration over I2C, audio over I2S, and the amplifier's enable on the C5

The codec answers at 0x18 on the shared I2C bus that kode_bsp_init brings up. Audio runs over I2S on GPIO33 (master clock), GPIO34 (bit clock), GPIO37 (word select), GPIO38 (P4 to codec) and GPIO36 (codec to P4). The microphone is wired straight into the codec's analogue input, so it is not a device on any bus. The amplifier's enable, PA_CTRL, is IO4 on the C5: the P4 cannot raise it, and Kode's C5 firmware raises it at boot.

Apps that use it

On the marketplace, apps that put this part to work. Install one from start/first-app and see it before you write a line.

The parts

PartWhat it gives youPage
Speaker, through the codec's DAC and the NS4150BSound out: tones, notifications, playbackdevice/audio/speaker
Microphone, through the codec's ADCSound in: a level, a waveform, a recordingdevice/audio/microphone

Gotchas

In the SDK