File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,21 @@ static mp_obj_t rp2_dma_close(mp_obj_t self_in) {
427427 uint8_t channel = self -> channel ;
428428
429429 if (channel != CHANNEL_CLOSED ) {
430+ // Reset this channel's registers to their default values (zeros).
431+ dma_channel_config config = { .ctrl = 0 };
432+ dma_channel_configure (
433+ channel ,
434+ & config ,
435+ NULL ,
436+ NULL ,
437+ 0 ,
438+ false
439+ );
440+
441+ // Abort this channel. Must be done after clearing EN bit in control
442+ // register due to errata RP2350-E5.
443+ dma_channel_abort (channel );
444+
430445 // Clean up interrupt handler to ensure garbage collection
431446 mp_irq_obj_t * irq = MP_STATE_PORT (rp2_dma_irq_obj [channel ]);
432447 MP_STATE_PORT (rp2_dma_irq_obj [channel ]) = MP_OBJ_NULL ;
You can’t perform that action at this time.
0 commit comments