I2S audio with PCM5102a

Hi all,

I have a ESP32-VROOM and a PCM5102a DAC in order to be able to stream from HA to my olf hifi system.

I followed the I2S audio doc and verified my cabling … but no sound !

Anyone has an idea ?

Relevant config:

# I2S Audio Output configuration
i2s_audio:
  i2s_lrclk_pin: GPIO25
  i2s_bclk_pin: GPIO26
  id: i2s_audio1

# Media Player configuration
media_player:
  - platform: i2s_audio
    name: "ESP32 Audio Streamer"
    dac_type: external
    i2s_dout_pin: GPIO22
    mode: mono
    i2s_audio_id: i2s_audio1

and log (in VERY_VERVOSE):

[14:20:07][C][api:144]:   Using noise encryption: NO
[14:20:07][C][improv_serial:032]: Improv Serial:
[14:20:07][C][audio:214]: Audio:
[14:20:07][C][audio:236]:   External DAC channels: 1
[14:20:07][C][audio:237]:   I2S DOUT Pin: 22
[14:20:09][VV][scheduler:226]: Running interval '' with interval=10000 last_execution=2866 (now=12867)
WARNING esphome-web-53eccc @ 192.168.5.108: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for esphome-web-53eccc @ 192.168.5.108
WARNING Disconnected from API
INFO Successfully connected to esphome-web-53eccc @ 192.168.5.108 in 0.016s
INFO Successful handshake with esphome-web-53eccc @ 192.168.5.108 in 0.086s
[14:20:55][VV][scheduler:226]: Running interval '' with interval=10000 last_execution=23533 (now=33533)
[14:21:02][VV][api.service:873]: on_media_player_command_request: MediaPlayerCommandRequest {
  key: 445274471
  has_command: NO
  command: MEDIA_PLAYER_COMMAND_PLAY
  has_volume: YES
  volume: 0.75
  has_media_url: NO
  media_url: ''
  has_announcement: NO
  announcement: NO
}
[14:21:02][D][media_player:061]: 'ESP32 Audio Streamer' - Setting
[14:21:02][D][media_player:071]:   Volume: 0.75
[14:21:02][VV][api.service:873]: on_media_player_command_request: MediaPlayerCommandRequest {
  key: 445274471
  has_command: NO
  command: MEDIA_PLAYER_COMMAND_PLAY
  has_volume: NO
  volume: 0
  has_media_url: YES
  media_url: 'http://192.168.5.142:8097/announcement/media_player.esphome_web_53eccc_esp32_audio_streamer.mp3?pre_announce=True'
  has_announcement: NO
  announcement: NO
}
[14:21:02][D][media_player:061]: 'ESP32 Audio Streamer' - Setting
[14:21:02][D][media_player:068]:   Media URL: http://192.168.5.142:8097/announcement/media_player.esphome_web_53eccc_esp32_audio_streamer.mp3?pre_announce=True
[14:21:02][W][component:237]: Component api took a long time for an operation (61 ms).
[14:21:02][W][component:238]: Components should block for at most 30 ms.
[14:21:02][VV][api.service:324]: send_media_player_state_response: MediaPlayerStateResponse {
  key: 445274471
  state: MEDIA_PLAYER_STATE_PLAYING
  volume: 0.75
  muted: NO
}
[14:21:02][W][component:237]: Component i2s_audio.media_player took a long time for an operation (561 ms).
[14:21:03][W][component:238]: Components should block for at most 30 ms.
[14:21:05][VV][scheduler:226]: Running interval '' with interval=10000 last_execution=33533 (now=43536)
[14:21:06][VV][scheduler:226]: Running interval '' with interval=60000 last_execution=4294952561 (now=45280)
[14:21:16][VV][scheduler:226]: Running interval '' with interval=10000 last_execution=43533 (now=53533)
[14:21:26][VV][scheduler:226]: Running interval '' with interval=10000 last_execution=53533 (now=63533)

@ananyevgv you requested this feature, did you implement it successfully ?

I remember on this board I had to bridge 2 contacts with solder on the back of the board.

I’m getting this exact same issue. See I²S DAC and ESP32 - media player crashes ESP32 - #3 by johndoe47

I’ve tested with both the PCM5102A and MAX98357A I²S DAC, same issue. I have succesfully played audio with the MAX98357 using some Arduino example code so I know my hardware is fine.

This is where it hangs, and subsequently gets triggered by the watchdog and reboots:

[18:36:45][D][media_player:059]: 'ESPHome I2S Media Player' - Setting
[18:36:45][D][media_player:066]:   Media URL: https://myHAservername.org:8123/media/local/test.mp3?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxYzAwN2UyNjNjZjY0OThiYWM0ODg2NTRkNzIwMjAzYiIsInBhdGgiOiIvbWVkaWEvbG9jYWwvR29sZGJhbmQgTm9vZGdldmFsIC0ga29ydC5tcDMiLCJwYXJhbXMiOltdLCJpYXQiOjE3MjQ1MTc0MDUsImV4cCI6MTcyNDYwMzgwNX0.mSTcRgyiAvdDu6_JUOsYyIHCwRxivQIBiPJOxI_jzzc
[18:36:45][W][component:214]: Component api took a long time for an operation (0.09 s).
[18:36:45][W][component:215]: Components should block for at most 20-30ms.

Any help on how to troubleshoot this would be very welcome!

Hello, I have the same issue. ESP32 WROOM + PCM5102A. No sound, and in the logs I get the error message about the long operation time. Same problem for two setups. Did you manage to get it working?

Got similar issue, error’s about long time for an operation and suddenly reboot.
I’m able to get a sound by connecting XSMT contact to 3.3v.
Also only web radios are played, TTS and local media causes a reboot for my ESP32-S3 dev kit.