Outputting I2S to the ESP32 creates distortion

Psirus
Posts: 2
Joined: Thu Apr 15, 2021 4:55 pm

Outputting I2S to the ESP32 creates distortion

Postby Psirus » Thu Apr 15, 2021 5:19 pm

I've been trying to get sound out of this DAC board: Adafruit I2S Stereo Decoder - UDA1334A Breakout

I compiled and uploaded the I2S example from ESP-IDF to my ESP32 board, with the only change that I wanted to use pin 27 for data
out for easier wiring:

Code: Select all

-#define I2S_DO_IO       (GPIO_NUM_22)
+#define I2S_DO_IO       (GPIO_NUM_27)
However, the output contains a lot of distortion. It is not just noise, but very distorted. I was only able to record the left channel, which should output a triangle wave. You can see the output for the three different bitwidths below:
Image
Image
Image
Unfortunately, I don't now which is which.

The FFT analysis also seems to suggest that there is a triangle wave in there somewhere:
Image

Lastly, I have tried the DAC with a Raspberry PI, where it does work as expected.

Psirus
Posts: 2
Joined: Thu Apr 15, 2021 4:55 pm

Re: Outputting I2S to the ESP32 creates distortion

Postby Psirus » Sun Apr 18, 2021 4:22 pm

I figured it out. Just for posterity, there were two problems with my approach:
1. The UDA expects I2S_COMM_FORMAT_STAND_I2S rather than I2S_COMM_FORMAT_STAND_MSB.
2. The SCLK needs to be grounded when not in use.

Who is online

Users browsing this forum: No registered users and 128 guests