PWMAudio Crashing #2431
-
Hello! Thank you for your amazing work. The entire arduino-pico project is fantastic. I am having an issue that had me scratching my head for the past few days. I've been trying to use PWMAudio for a project very similar to the example for PWMAudio and a headerless wav. It seems to fail unexpectedly when storing that wav file with The easiest way to reproduce this issue follows:
And adding a This code will work fine without the lines:
It will also work fine if the I'm not really worried about getting Serial to work, this is just the easiest way to show an issue that happens under other circumstances as well. It's fairly important that I put the audio files in flash (as they are large). Any help is appreciated, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
A quick glance makes me think you're underflowing because of the small default buffer sizes. The DMA engine misses two interrupts and gets confused. Try adding |
Beta Was this translation helpful? Give feedback.
This is an alignment issue because your array is a
char
and you're readingint16_t
. GCC is giving your array an odd address (perfectly legal forchar
but illegal forint16_t
). Export your WAV as 16-bits (might be a pain) or align the array to a 2-byte boundary usingWhile you saw it with
Serial
this really could be cause by even having a single global variable anywhere in the app. The alignment primitive will take care of this.