-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Error allocating DMA buffers for I2SOut playback #10256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@tannewt I can confirm that reverting the changes made to |
I suspect this is due to the Python VM heap taking up most of the outer heap (allocated via port_malloc using tlsf). It might be simplest to use |
I'm testing now on a Pimoroni Pico Plus 2 with 8MB of PSRAM. Is this basically what we're thinking of? I can get a PR up for this, but I want to do a bit more testing. #ifdef PICO_RP2350
dma->buffer[0] = (uint8_t *)port_realloc(dma->buffer[0], max_buffer_length, true);
#else
dma->buffer[0] = (uint8_t *)m_realloc(dma->buffer[0],
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
dma->buffer_length[0], // Old size
#endif
max_buffer_length);
#endif
dma->buffer_length[0] = max_buffer_length;
if (dma->buffer[0] == NULL) {
return AUDIO_DMA_MEMORY_ERROR;
} #ifdef PICO_RP2350
port_free(dma->buffer[0]);
#else
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
m_free(dma->buffer[0], dma->buffer_length[0]);
#else
m_free(dma->buffer[0]);
#endif
#endif
dma->buffer[0] = NULL;
dma->buffer_length[0] = 0; |
Yup! That's what I'm thinking. |
CircuitPython version and board name
Code/REPL
Behavior
No audio output occurs.
Description
circuitpython/ports/raspberrypi/common-hal/audiobusio/I2SOut.c
Line 276 in 8f7496c
circuitpython/ports/raspberrypi/audio_dma.c
Line 234 in 8f7496c
Additional information
I don't completely understand what's going on in
port_realloc
, but the primary difference I can discern againstm_realloc
is that is usestlsf_realloc
instead ofrealloc
.Any thoughts on this? @tannewt
The text was updated successfully, but these errors were encountered: