-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
ports/rp2/machine_i2s.c: Detect and deinitialize I2S instances on boot. #14345
base: master
Are you sure you want to change the base?
Conversation
00265f7
to
6705d18
Compare
During early init some I2S instances may still be present in buffer. This issue would cause system to hang when using soft_reset without deinitializing I2S instance first.
To fix that, finalisers should be enabled on the I2S object on all ports, following how esp32 does it. That requires two things:
|
Code size report:
|
If you do not want to follow the recommendation of Damien, this deinit should better be placed at the end of main() between the label |
I'll work on this, just don't have a lot of free time. I'd rather go with Damien's solution as it seems more appropriate and portable. I don't have other devboards, so most likely fixing it globally (like calling |
In reference to #14339
machine_i2s_init0
makes all of these pointers NULL without checking if there was a pointer already. Furthermore, garbage collector doesn't care enough to callI2S.deinit()
.This created an issue, where invoking
machine.soft_reset()
would hard crash an entire board.Fix is a check if
machine_i2s_obj
contains an object (assumed to be a validmachine_i2s_obj_t
). If memory address is not NULL - object gets deinitialized. No further crashes are observed.