Skip to content

Commit b03df60

Browse files
dpslwkdpgeorge
authored andcommitted
stmhal: Correct DMA to allow SD card on L4 MCUs.
1 parent 14b7c3e commit b03df60

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

stmhal/dma.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ const dma_descr_t dma_ADC_2_RX = { DMA2_Channel4, DMA_REQUEST_0, DMA_PERIPH_TO_M
267267
const dma_descr_t dma_DAC_1_TX = { DMA2_Channel4, DMA_REQUEST_3, DMA_MEMORY_TO_PERIPH, dma_id_10, &dma_init_struct_dac };
268268
const dma_descr_t dma_SPI_1_TX = { DMA2_Channel4, DMA_REQUEST_4, DMA_MEMORY_TO_PERIPH, dma_id_10, &dma_init_struct_spi_i2c };
269269
*/
270-
#if MICROPY_HW_HAS_SDCARD
270+
#if defined(MICROPY_HW_HAS_SDCARD) && MICROPY_HW_HAS_SDCARD
271+
// defined twice as L4 HAL only needs one channel and can correctly switch direction but sdcard.c needs two channels
271272
const dma_descr_t dma_SDIO_0_TX= { DMA2_Channel4, DMA_REQUEST_7, DMA_MEMORY_TO_PERIPH, dma_id_10, &dma_init_struct_sdio };
273+
const dma_descr_t dma_SDIO_0_RX= { DMA2_Channel4, DMA_REQUEST_7, DMA_PERIPH_TO_MEMORY, dma_id_10, &dma_init_struct_sdio };
272274
#endif
273275
/* not preferred streams
274276
const dma_descr_t dma_ADC_3_RX = { DMA2_Channel5, DMA_REQUEST_0, DMA_PERIPH_TO_MEMORY, dma_id_11, NULL };

stmhal/dma.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ extern const dma_descr_t dma_I2C_1_TX;
7373
extern const dma_descr_t dma_I2C_1_RX;
7474
extern const dma_descr_t dma_SPI_3_RX;
7575
extern const dma_descr_t dma_SPI_3_TX;
76-
extern const dma_descr_t dma_SDIO_1_TX;
76+
extern const dma_descr_t dma_SDIO_0_TX;
77+
extern const dma_descr_t dma_SDIO_0_RX;
7778

7879
#endif
7980

0 commit comments

Comments
 (0)