stm32/dma: Reset all dma channels during soft-reset. #12803
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On a work project I'm using a C module to configure and use DMA for timer interactions. The same thing can be done with https://github.com/andrewleech/micropython-stm32-pwm-sine-wave
Once DMA interrupts have been enabled with any channels not used by internal micropython usage, these don't get turned off on soft-reset which leaves them still enabled. If they get triggered, a hard fault occurs as the HAL interrupt tries to access the original definition struct which has now disappeared.
This MR adds an explicit reset of all DMA channels during soft reset to ensure this hard fault cannot occur.