Skip to content

Commit e9221fb

Browse files
SPITFT - M4 SPI DMA fix
1 parent 12ced10 commit e9221fb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Adafruit_SPITFT.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,13 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
574574
dma_busy = true;
575575
dma.startJob();
576576
while(dma_busy); // Wait for completion
577+
#ifdef __SAMD51__
578+
// SAMD51: SPI DMA seems to leave the SPI peripheral in a freaky
579+
// state on completion. Workaround is to explicitly set it back...
580+
_spi->setDataMode(SPI_MODE0);
581+
#endif
577582

578-
// Unfortunately the wait is necessary. An earlier version returned
583+
// Unfortunately blocking is necessary. An earlier version returned
579584
// immediately and checked dma_busy on startWrite() instead, but it
580585
// turns out to be MUCH slower on many graphics operations (as when
581586
// drawing lines, pixel-by-pixel), perhaps because it's a volatile

0 commit comments

Comments
 (0)