diff options
| author | Philip Jander <info@jander.it> | 2021-01-22 21:51:43 +0100 |
|---|---|---|
| committer | Philip Jander <info@jander.it> | 2021-02-07 16:59:11 +0100 |
| commit | 127cc6204a653080e88350f6b2528f6cb97f3379 (patch) | |
| tree | 4eda33fcd829c742b6d6270f3a8b7ac4155c9015 | |
| parent | a10ce39ae6dd21a9226c24a8782c8e94ee8343ff (diff) | |
adds: idle loop to wait for SPI not busy (mimxrt10xx)
| -rw-r--r-- | ports/mimxrt10xx/common-hal/busio/SPI.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index ce7cbea7e..518bf83de 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -289,7 +289,11 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self, xfer.dataSize = len; xfer.configFlags = kLPSPI_MasterPcs0; - const status_t status = LPSPI_MasterTransferBlocking(self->spi, &xfer); + status_t status; + do { + status = LPSPI_MasterTransferBlocking(self->spi, &xfer); + } while (status == kStatus_LPSPI_Busy); + if (status != kStatus_Success) printf("%s: status %ld\r\n", __func__, status); @@ -311,7 +315,11 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, xfer.rxData = data; xfer.dataSize = len; - const status_t status = LPSPI_MasterTransferBlocking(self->spi, &xfer); + status_t status; + do { + status = LPSPI_MasterTransferBlocking(self->spi, &xfer); + } while (status == kStatus_LPSPI_Busy); + if (status != kStatus_Success) printf("%s: status %ld\r\n", __func__, status); @@ -333,7 +341,11 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou xfer.rxData = data_in; xfer.dataSize = len; - const status_t status = LPSPI_MasterTransferBlocking(self->spi, &xfer); + status_t status; + do { + status = LPSPI_MasterTransferBlocking(self->spi, &xfer); + } while (status == kStatus_LPSPI_Busy); + if (status != kStatus_Success) printf("%s: status %ld\r\n", __func__, status); |
