From d01d85930d19a73010853b7ba8648d8811891bee Mon Sep 17 00:00:00 2001 From: soypat Date: Sun, 11 Jun 2023 15:03:45 -0300 Subject: [PATCH] rp2040: add spi busy waits on read and read/write transactions --- src/machine/machine_rp2040_spi.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/machine/machine_rp2040_spi.go b/src/machine/machine_rp2040_spi.go index 07a3745e..cb60fdbc 100644 --- a/src/machine/machine_rp2040_spi.go +++ b/src/machine/machine_rp2040_spi.go @@ -368,6 +368,9 @@ func (spi SPI) rx(rx []byte, txrepeat byte) error { continue } } + for spi.isBusy() { + gosched() + } return nil } @@ -397,6 +400,8 @@ func (spi SPI) txrx(tx, rx []byte) error { // Transaction ended early due to timeout return ErrSPITimeout } - + for spi.isBusy() { + gosched() + } return nil }