diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-10-26 16:58:56 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-10-26 16:59:59 -0700 |
| commit | 95cb5961d26a4e1e048d48266d21547dc9229ba9 (patch) | |
| tree | d3db7da43f2db506f54aa00ab10eaedad7288bc2 | |
| parent | 0d1649880f1c23ec6c9c0a4834f3712a8495f9d8 (diff) | |
Fix ESP32-S2 SPI when DMA is sometimes used
| -rw-r--r-- | ports/esp32s2/common-hal/busio/SPI.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/esp32s2/common-hal/busio/SPI.c b/ports/esp32s2/common-hal/busio/SPI.c index 1906ca6f0..490419f34 100644 --- a/ports/esp32s2/common-hal/busio/SPI.c +++ b/ports/esp32s2/common-hal/busio/SPI.c @@ -357,6 +357,9 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou } else { hal->dma_enabled = 0; burst_length = sizeof(hal->hw->data_buf); + // When switching to non-DMA, we need to make sure DMA is off. Otherwise, + // the S2 will transmit zeroes instead of our data. + spi_ll_txdma_disable(hal->hw); } // This rounds up. |
