I2S Audio Pins
The ESP32-P4-WIFI6-DEV-KIT includes a complete audio subsystem built around the ES8311 codec, connected to the ESP32-P4 via the I2S peripheral.
I2S pin assignments
Section titled “I2S pin assignments”| Signal | GPIO | Direction | Description |
|---|---|---|---|
| MCLK | GPIO13 | P4 to codec | Master clock. Drives the ES8311’s internal PLL. Typically 256x the sample rate (e.g., 12.288 MHz for 48 kHz audio). |
| SCLK | GPIO12 | P4 to codec | Serial clock (bit clock). Clocks each audio sample bit on the I2S bus. |
| LRCK | GPIO10 | P4 to codec | Left/right clock (word select). Toggles to indicate left or right channel data. Frequency equals the sample rate. |
| ASDOUT | GPIO11 | P4 to codec | Audio data out from ESP32-P4 to ES8311. Used for playback (speaker, headphone). |
| DSDIN | GPIO9 | Codec to P4 | Audio data in from ES8311 to ESP32-P4. Used for recording (microphone input). |
Amplifier control
Section titled “Amplifier control”| Signal | GPIO | Description |
|---|---|---|
| PA_Ctrl | GPIO53 | Enable/disable the NS4150B Class D amplifier. Drive HIGH to enable speaker output, LOW to mute. |
Audio signal chain
Section titled “Audio signal chain”Playback path
Section titled “Playback path”ESP32-P4 (I2S TX) -- ASDOUT (GPIO11) --> ES8311 codec (DAC) -- analog --> +-- 3.5 mm headphone jack +-- NS4150B amplifier (enabled by PA_Ctrl / GPIO53) -- amplified --> MX1.25 speaker connector (8 ohm / 2 W)Capture path
Section titled “Capture path”SMD MEMS microphone -- analog --> ES8311 codec (ADC) -- DSDIN (GPIO9) --> ESP32-P4 (I2S RX)ES8311 codec details
Section titled “ES8311 codec details”| Parameter | Value |
|---|---|
| Chip | ES8311 (Everest Semiconductor) |
| Interface | I2S (slave mode) |
| Control bus | I2C (address 0x18, on the default I2C bus: SCL/GPIO8, SDA/GPIO7) |
| DAC resolution | Up to 24-bit |
| ADC resolution | Up to 24-bit |
| Sample rates | 8 kHz to 96 kHz |
| SNR (DAC) | 110 dB typical |
| SNR (ADC) | 95 dB typical |
NS4150B amplifier
Section titled “NS4150B amplifier”| Parameter | Value |
|---|---|
| Chip | NS4150B (Nsiway) |
| Type | Class D, mono, filterless |
| Output power | 3 W at 4 ohm, 2 W at 8 ohm |
| Enable pin | GPIO53 (active HIGH) |
| Speaker connector | MX1.25 2P |
| Recommended speaker | 8 ohm, 2 W |
The amplifier is always powered but only drives the speaker when PA_Ctrl is HIGH. Set GPIO53 LOW before configuring the I2S peripheral to avoid transient noise on the speaker output during initialization.
I2C control bus (shared)
Section titled “I2C control bus (shared)”The ES8311 shares the I2C bus with any external devices connected to:
- 40-pin header pins 3 (SDA/GPIO7) and 5 (SCL/GPIO8)
- The dedicated I2C port connector (component 15)
The ES8311 I2C address is 0x18. Ensure no external device conflicts with this address on the shared bus.
Pin assignments and codec details sourced from the Waveshare ESP32-P4-WIFI6-DEV-KIT Wiki and ES8311 datasheet.