How do I write to I2S/DAC in stereo?

physiii
Posts: 23
Joined: Fri Nov 17, 2017 9:37 pm

How do I write to I2S/DAC in stereo?

Postby physiii » Sat Jun 06, 2020 1:33 pm

The i2s_adc_dac example just mirrors the left and right channels into the built in DAC1/DAC2. But I want to get a 1khz tone from DAC1 and 1khz tone with 180 degree phase shift from DAC2.

How do I i2s_write to left/right channels separately?

physiii
Posts: 23
Joined: Fri Nov 17, 2017 9:37 pm

Re: How do I write to I2S/DAC in stereo?

Postby physiii » Wed Jun 10, 2020 1:03 pm

Bump.

This seems applicable for many different projects, no one has tried to use I2S DAC1/DAC2 independently?

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: How do I write to I2S/DAC in stereo?

Postby ESP_Sprite » Thu Jun 11, 2020 7:42 am

If I recall correctly, the signal needs to be 32-bit interleaved. In other words, you take the 8-bit DAC values, multiply them by 256, then concatenate the resulting two 16-bit values to get a 32-bit value. You then feed those 32-bit values to the I2S driver.

aldolo
Posts: 1
Joined: Mon Feb 21, 2022 5:25 am

Re: How do I write to I2S/DAC in stereo?

Postby aldolo » Mon Feb 21, 2022 5:49 am

Hi. did you succede with stereo dac?

Who is online

Users browsing this forum: No registered users and 108 guests