Fix ESP32-S2 SPI when DMA is sometimes used

This commit is contained in:
Scott Shawcroft 2020-10-26 16:58:56 -07:00
parent 0d1649880f
commit 95cb5961d2
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 3 additions and 0 deletions

View File

@ -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.