-
Notifications
You must be signed in to change notification settings - Fork 42
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
Stops playing MP3s on T4.1 #23
Comments
I am not aware of this problem, it does not happen to me and I have not heard of it from any other user. Theoretically, this can happen if Hope ist helps, |
First off, thanks heaps for the quick reply! Indeed, this does not happen when only running the MP3 player. Audio blocks, as in AudioMemory? 32. No other SD-card access is done - the MP3 player reigns supreme. This firmware does have some very high-priority (0) interrupts running though, as suggested. Perhaps I should also mention that I am not running the card off the SDIO interface, but SPI1 at 16MHz. So, if this can theoretically happen under these circumstances, could you point me in the direction of exactly what, theoretically, it is that would happen? :) Any suggestion on overcoming this would be highly appreciated. Fantastic library, by the way. |
In my quest to make my thingy work all good 'n stuff; I found a racing condition that, while not the cause of my problems, is something that I think might warrant a fix. In If an audio interrupt occurs between these two events, the interrupt will be working with buffers that point to memory that is no longer "owned". The chance of this causing a problem is very low, but could happen and would likely be a major headache to troubleshoot since it could have rare and asymptomatic effects - the worst kinds of bugs to squash. For example, if another interrupt occurs, which allocates memory previously used by the now Unless I am missing something Anyways, if a check is inserted into
Then the problem can be solved in
For this to work under all conditions, buf pointers should also be made volatile for option 2, or use a memory barrier for option 1. Look, it's late, it's Friday, and I'm all full of Old No. 7; so I might be wrong about some of this... but I sure did get the occasional crash and reboot during stress-testing with really short MP3s until I secured those buffers. I've managed to get things working by replacing the lower-than-audio-priority chained software interrupt for decodeMp3 and calling decodeMp3() directly from But, for good measure, I went back to the original code and inserted counters in |
On Teensy 4.1, at seemingly random intervals a few to a few tens of minutes apart, the MP3 player just stops playing.
What I know and have tried:
Tried a few different MP3-files and two different SD-cards - no change.
Ported the library to directly use SdFat instead of going via Arduino SD - no change.
To verify the SD card and filesystem code I set up a loop to continuously read and checksum the file over several hours:
The Teensy Audio system is still running; other sources continue playing.
Calling another .play() gets the MP3Player going just fine again.
When the problem occurs, _fposition of the CodecFile class just sits there without changing, but I haven't taken any further plunges into the code - wanted to ask for ideas or suggestions first.
Got any? :)
The text was updated successfully, but these errors were encountered: