summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--ports/esp32/machine_hw_spi.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ports/esp32/machine_hw_spi.c b/ports/esp32/machine_hw_spi.c
index d011ce53e3..560d19a5aa 100644
--- a/ports/esp32/machine_hw_spi.c
+++ b/ports/esp32/machine_hw_spi.c
@@ -186,9 +186,16 @@ STATIC void machine_hw_spi_init_internal(
};
//Initialize the SPI bus
- // FIXME: Does the DMA matter? There are two
- ret = spi_bus_initialize(self->host, &buscfg, 1);
+ // Select DMA channel based on the hardware SPI host
+ int dma_chan = 0;
+ if (self->host == HSPI_HOST) {
+ dma_chan = 1;
+ } else if (self->host == VSPI_HOST) {
+ dma_chan = 2;
+ }
+
+ ret = spi_bus_initialize(self->host, &buscfg, dma_chan);
switch (ret) {
case ESP_ERR_INVALID_ARG:
mp_raise_msg(&mp_type_OSError, "invalid configuration");