From 0040d9203055a519417d3bedcbc9c0e75f0fcbca Mon Sep 17 00:00:00 2001 From: "David G. F." Date: Tue, 10 Feb 2026 08:49:06 +0100 Subject: [PATCH] Fix SD hangs on certain write sequences (#9) When the card status is not ready yet (after a successful write tx is completed) a second DMA is scheduled to read the return code (instead of manually reading it when it's ready). The current code schedules the DMA and immediately proceeds to complete the read due to a missing early return. This results in the IRQ handler being called one extra time and desyncing the TX sequence, which hangs due to "done" > "total" It is unclear when this happens, allegedly when the DMA IRQ is triggered before the card becomes Idle (response is pushed after it becomes Idle). --- src/sd/rp2040_sdio.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sd/rp2040_sdio.cpp b/src/sd/rp2040_sdio.cpp index 1b75392..b9d4813 100644 --- a/src/sd/rp2040_sdio.cpp +++ b/src/sd/rp2040_sdio.cpp @@ -662,6 +662,7 @@ static void rp2040_sdio_irq() channel_config_set_dreq(&dmacfg, pio_get_dreq(SDIO_PIO, SDIO_DATA_SM, false)); dma_channel_configure(SDIO_DMA_CHB, &dmacfg, &g_sdio.card_response, &SDIO_PIO->rxf[SDIO_DATA_SM], 1, true); + return; } } }