Browse Source

esp32/machine_hw_spi: Use separate DMA channels for HSPI and VSPI.

Otherwise only one of HSPI or VSPI can be used at a time.  Fixes
issue #4068.
pull/4424/head
Damien George 6 years ago
parent
commit
d82f344f61
  1. 11
      ports/esp32/machine_hw_spi.c

11
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");

Loading…
Cancel
Save