Skip to content

Commit f634401

Browse files
ElectroInnovatorkartben
authored andcommitted
drivers: dma: sam0: Reset DMA during initialization.
Fixes issue #83555, where UART transmit operations fail in Zephyr sysbuild projects using MCUboot and the asynchronous UART API (`CONFIG_UART_ASYNC_API=y`) on SAM0 devices such as the ATSAMC21G18A. The issue occurs because the DMA controller is not reset during initialization, causing `BASEADDR` and `WRBADDR` registers to retain MCUboot's configuration. This prevents the application from reconfiguring these registers to its own RAM addresses, leading to UART transmit timeouts and triggering the `UART_TX_ABORTED` callback. This patch resolves the issue by resetting the DMA controller during initialization in `dma_sam0.c`. The following actions are performed: - Disables the DMA and CRC modules. - Applies a software reset to ensure a clean state for reconfiguration. With this change, UART transmit operations work as expected, improving stability and compatibility between MCUboot and the application. Signed-off-by: Tristen Pierson <[email protected]>
1 parent 5651764 commit f634401

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/dma/dma_sam0.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,13 @@ static int dma_sam0_init(const struct device *dev)
413413
PM->APBBMASK.bit.DMAC_ = 1;
414414
#endif
415415

416+
/* Reset the DMA controller */
417+
DMAC->CTRL.bit.DMAENABLE = 0;
418+
DMAC->CTRL.bit.CRCENABLE = 0;
419+
DMAC->CTRL.bit.SWRST = 1;
420+
while (DMAC->CTRL.bit.SWRST) {
421+
}
422+
416423
/* Set up the descriptor and write back addresses */
417424
DMA_REGS->BASEADDR.reg = (uintptr_t)&data->descriptors;
418425
DMA_REGS->WRBADDR.reg = (uintptr_t)&data->descriptors_wb;

0 commit comments

Comments
 (0)