How to have full duplex i2s streams on ESP32-WROVER-IE-N4R8?

djfmfrlnc
Posts: 1
Joined: Fri Nov 29, 2024 9:26 pm

How to have full duplex i2s streams on ESP32-WROVER-IE-N4R8?

Postby djfmfrlnc » Fri Nov 29, 2024 10:04 pm

I am working on a `ESP32-WROVER-IE-N4R8` board, and I can't for the life of me figure out how to have a full duplex or even two half duplex i2s streams.

The [documentation](https://www.espressif.com/sites/default ... eet_en.pdf) says this board has two I2S busses but that seems to be inaccurate because if I try to pass `I2S_NUM_1` instead of `I2S_NUM_0` to i2s initialization functions it results in a crash.

I've tried initializing one stream in write mode and one stream in read mode on the same i2s port (0) but it is clear that they share the same settings because for instance if the stream reader changes the sample rate it also changes for the stream writer... and it's pretty annoying to have to re-configure I2S literally every 30 seconds...

I initialize my streams like that:

```
i2s_stream_cfg_t cfg_writer I2S_STREAM_CFG_DEFAULT_WITH_TYLE_AND_CH(
I2S_NUM_0,
sample_rate,
bits_per_sample,
AUDIO_STREAM_WRITER,
I2S_SLOT_MODE_STEREO
);
auto writer = i2s_stream_init(&cfg_writer);
```

```
i2s_stream_cfg_t cfg_reader= I2S_STREAM_CFG_DEFAULT_WITH_TYLE_AND_CH(
I2S_NUM_0,
sample_rate,
bits_per_sample,
AUDIO_STREAM_READER
I2S_SLOT_MODE_MONO
);
auto reader = i2s_stream_init(&cfg_reader);
```

Can I do any better or do I really need to reconfigure i2s and pipelines each time I want to switch from transmitting to receiving or conversely?

Despite my board being `ESP32-WROVER-IE-N4R8`, since it is not available in `menuconfig`, I chose (in the HAL sub-menu) the `Lyrat v4.3` board, because it has the same pinout as my board - as far as i2s is concerned at least - and it uses the ES8388 audio codec as does my board too.

Any help would be greatly appreciated, this is making me crazy. I know that alternatively I can destroy and recreate the pipeplines all the time but that seems wasteful and will probably increase latency.

Thank you,
FM.

Who is online

Users browsing this forum: No registered users and 37 guests