Hi,
a recent project involves audio transmission with ESP32's using external I2S codecs and ESPnow, all written using the Arduino environment in PlatformIO.
Current setup: Audio transmitter
Wolfson WM8960 in i2s slave mode, 48kHz sample rate, 16 bit stereo
-> ESP32 running an instance of the OPUS codec, 96kBit, complexity 6, generating
an OPUS data frame with 240 bytes every 20 ms.
These frames are transmitted using the broadcast mode of ESPnow.
Current setup: Audio receiver:
ESPnow receives 240 bytes OPUS blocks + 8 bytes management information
-> Decoding into 1920 samples which are fed into the DMA buffer for transfer to the codec.
Here is my issue. As the transmitter and receiver use their own reference crystals, the saple rate is slightly off (TX: 48kHz, RX: 48.003 kHz) which leads to buffer overrun / underrun after some time.
I've tried measuring the time between my frames and tweaking the receiver's sample rate on the fly by counting samples within a give time but the real deal would be to get access to the buffer state of the DMA chain and try to keep the buffer at 50%.
I have lots of bare metal experience on the PIC32 where I can get Interrupts from the DMA chain when the buffer is below 50% so I know how many samples I can push in before overrun.
Is there something similar on the ESP32? I'm hesitation implementing a second buffer in software just to track how full it is as low latency is curcial in my application.
Thanks in advance!
ESP32 I2S with DMA buffer issue: ways to detect buffer over/underrun
-
- Posts: 2
- Joined: Wed Jul 21, 2021 1:55 pm
Who is online
Users browsing this forum: msfujino and 29 guests