VS1053b I2S output to Esp32

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
Post Reply
lorenzo318
User
Posts: 8
Joined: Mon 2021-03-01 23:01

VS1053b I2S output to Esp32

Post by lorenzo318 »

Hi all

I am a little bit confused about how to connect the 1053b i2s output to an esp32 mcu.

I know the 1053b is only master with respect to i2s interface so I need to program my esp32 as a slave. The first question is about the master clock generated by the codec. Is it required for esp32? Maybe the BCLK, LROUT and SDATA are enough in my case?

Another question is related to software point of view. How to configure internal codec registers in order to work correctly.? I would 24kHz Pcm audio samples to be transmit to the esp32 I2s interface.

Could you please provide me suggestions?

Thanks in advance.

BR
User avatar
Panu
VSDSP Expert
Posts: 2816
Joined: Tue 2010-06-22 13:43

Re: VS1053b I2S output to Esp32

Post by Panu »

Hi!

The VS1053 outputs 16 bits per sample. Can the ESP32 receive I2S frames that have only 2 x 16 bits?

-Panu
lorenzo318
User
Posts: 8
Joined: Mon 2021-03-01 23:01

Re: VS1053b I2S output to Esp32

Post by lorenzo318 »

Yes, it could.

The i2s driver configuration on the ESP32 side is the following:

const i2s_config_t i2s_config = {
.mode = static_cast<i2s_mode_t>(I2S_MODE_MASTER | I2S_MODE_RX),
.sample_rate = 16000,
.bits_per_sample = static_cast<i2s_bits_per_sample_t>(I2S_BITS_PER_SAMPLE_16BIT),
.channel_format = static_cast<i2s_channel_fmt_t>(I2S_CHANNEL_FMT_RIGHT_LEFT),
};

16kHz, I2S_BITS_PER_SAMPLE_16BIT, Stereo.

My doubts are related to the wire connection since I don't understand how to use the codec MCLK, and if I have to use ESP32 as a I2S_MODE_MASTER or I2S_MODE_SLAVE. I read somewhere that the VS1053b works as a master only, not slave.

Perhaps, what's the right way to configure registers in order to work with I2S interface in that configuration.

Thanks a lot again.

BR.
Hannu
Senior User
Posts: 158
Joined: Mon 2016-05-30 11:54

Re: VS1053b I2S output to Esp32

Post by Hannu »

VS1053 can be 48,96 or 192 kHz master. So configure ESP to to slave and expecting 16 bits samples. Then you need to write VS1053 I2S_CF I2S CF_ENA bit high and the samplerate bits to enable i2S out. You shouldn't need MCLK.
lorenzo318
User
Posts: 8
Joined: Mon 2021-03-01 23:01

Re: VS1053b I2S output to Esp32

Post by lorenzo318 »

Thanks a lot!

BR
Post Reply