espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.33k stars 7.2k forks source link

I2S: odd codec output when using single channel (IDFGH-3682) #5616

Open boborjan2 opened 4 years ago

boborjan2 commented 4 years ago

Problem Description

When setting I2S configuration to single channel (using a stereo codec), and feeding i2s with mono sample data, output changes according to the screenshots below. Note that this also happens when using internal DAC. Stereo: lyrat_i2s_500Hz_stereo Mono: lyrat_i2s_500Hz_mono

This behavior is easier to notice when signal frequency is closer to sampling freq.

Expected Behavior

The signals should be the same

Actual Behavior

Signals differ.

Steps to reproduce

I am using the i2s example provided by ESP-IDF. I modified that example to 1) run on LyraT-4.3, 2) to produce mono signal 3) to test different frequencies, like 500Hz. I made this change because on higher frequencies, the issue is easier to observe.

Code to reproduce this issue

The code is mostly (99%) from i2s example from ESP-IDF. [GIST] https://gist.github.com/boborjan2/bdf3ca0a99345e20aa364c9eb61557b2

You need to #define/#undef macro "MONO" at the beginning of the file.

// If your code is longer than 30 lines, GIST is preferred.

Debug Logs

None, please check screenshots.

boborjan2 commented 4 years ago

I forgot one detail: the scope measurements were taken at the "phone jack" output of the LyraT-4.3 board with 32Ohm stereo headphones plugged in. Note: the signal looks the same with other (smaller) loads as well.

Alvin1Zhang commented 4 years ago

Thanks for reporting, we will look into.