I'm working on a USB Audio aysnchronous implementation on a microcontroller and I seem to be running into buffer underrun issues on the input side of things at 48kHz sample rate/24 bit rate (it works at 44.1kHz though).
I'm double buffering in my implementation:
(1) Codec -> DMA has a couple buffers. When one buffer is completely filled, I load this into my USB buffers.
(2) USB side has 40 buffers (basically 40ms of data). When a buffer's status is "FILLED", it is okay to send. A USB callback is done after a successful USB transfer and sends the next filled buffer.
In my implementation, I fill at least 3/4 of the buffers (30 buffers) before before USB starts transferring actual data (so in the first 30ms, it's just "silent" data). Basically, the buffer underrun happens as my codec/dma buffer is not completely filled yet and the next buffer to be read is "EMPTY". I feel like the easiest solution to this would be to have more buffers (clearly 40 buffers is not enough; approximately 11kb of data since 40 * 294 bytes = 11760 bytes), however I cannot increase it as my microcontroller has simply run out of available memory.
What are my options to solving this at this point of time? Is there a workaround to the limit of available buffers I have/available leftover memory? Or is the only way to add a SRAM on to have enough available buffers.
Thanks!
EDIT: It appears this is a bit confusing. Basically codec isn't filling fast enough; thus, there are gaps of data in USB buffers and creating an "underrun" of data.
EDIT2: I'm running an asynchronous with implicit sync endpoint; host is being read once per frame. Sorry that wasn't clear either.