Skip to content
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

Freezes/race conditions when sending MIDI data outside of uClock's timer interrupts #130

Open
doctea opened this issue Dec 19, 2023 · 0 comments

Comments

@doctea
Copy link
Contributor

doctea commented Dec 19, 2023

Please see midilab/uClock#30 for description and example sketch using uClock that results in freezes when trying to send USB MIDI data outside of the uClock timer callback.

https://github.com/doctea/USBHost_t36/tree/merge-interrupt-fix has a fix - it seems to work around this by adding checks in several places to ensure that interrupts were already enabled before re-enabling them again. That seems to be the important part of solving the problem in the example sketch.

However, the branch has some other little workarounds that I have to add in order to have it working correctly in my project - without them, my project freezes during initial startup. I also find that doing Serial.print() several times while interrupts are disabled and the serial monitor isn't connected causes my app to freeze, until the serial monitor is connected - as if we're getting stuck in a loop waiting for the USB serial data to be collected. Prefacing my calls to Serial.printX with if (Serial) works around this.
I haven't built a simple sketch to replicate those problems yet as my main project is fairly large and complicated, but I'll try and circle back round to this at a later date. Mentioning this here now to help document the problem(s), provide potential workaround, and in case its happening to anyone else or if someone with greater understanding of the library can deduce what's going on! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant