Skip to content

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.

SignalGPIODirectionDescription
MCLKGPIO13P4 to codecMaster clock. Drives the ES8311’s internal PLL. Typically 256x the sample rate (e.g., 12.288 MHz for 48 kHz audio).
SCLKGPIO12P4 to codecSerial clock (bit clock). Clocks each audio sample bit on the I2S bus.
LRCKGPIO10P4 to codecLeft/right clock (word select). Toggles to indicate left or right channel data. Frequency equals the sample rate.
ASDOUTGPIO11P4 to codecAudio data out from ESP32-P4 to ES8311. Used for playback (speaker, headphone).
DSDINGPIO9Codec to P4Audio data in from ES8311 to ESP32-P4. Used for recording (microphone input).
SignalGPIODescription
PA_CtrlGPIO53Enable/disable the NS4150B Class D amplifier. Drive HIGH to enable speaker output, LOW to mute.
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)
SMD MEMS microphone
-- analog -->
ES8311 codec (ADC)
-- DSDIN (GPIO9) -->
ESP32-P4 (I2S RX)
ParameterValue
ChipES8311 (Everest Semiconductor)
InterfaceI2S (slave mode)
Control busI2C (address 0x18, on the default I2C bus: SCL/GPIO8, SDA/GPIO7)
DAC resolutionUp to 24-bit
ADC resolutionUp to 24-bit
Sample rates8 kHz to 96 kHz
SNR (DAC)110 dB typical
SNR (ADC)95 dB typical
ParameterValue
ChipNS4150B (Nsiway)
TypeClass D, mono, filterless
Output power3 W at 4 ohm, 2 W at 8 ohm
Enable pinGPIO53 (active HIGH)
Speaker connectorMX1.25 2P
Recommended speaker8 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.

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.