Skip to content

Commit 95cb596

Browse files
committed
Fix ESP32-S2 SPI when DMA is sometimes used
1 parent 0d16498 commit 95cb596

File tree

1 file changed

+3
-0
lines changed
  • ports/esp32s2/common-hal/busio

1 file changed

+3
-0
lines changed

ports/esp32s2/common-hal/busio/SPI.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou
357357
} else {
358358
hal->dma_enabled = 0;
359359
burst_length = sizeof(hal->hw->data_buf);
360+
// When switching to non-DMA, we need to make sure DMA is off. Otherwise,
361+
// the S2 will transmit zeroes instead of our data.
362+
spi_ll_txdma_disable(hal->hw);
360363
}
361364

362365
// This rounds up.

0 commit comments

Comments
 (0)