summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-12-14 10:40:35 +1100
committerDamien George <damien.p.george@gmail.com>2017-12-14 10:43:18 +1100
commitbadaf3ecfe5d0c8158debf4bd0cb1458016c77f4 (patch)
tree70846e1eecd3da1bc994d357a6512ff6e8191355
parentbb516af1eb97d0c24fa12b00bfde196b3db94c66 (diff)
esp8266/machine_hspi: After an SPI write wait for last byte to transfer.
Because otherwise the function can return with data still waiting to be clocked out, and CS might then be disabled before the SPI transaction is complete. Fixes issue #3487.
-rw-r--r--ports/esp8266/machine_hspi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/esp8266/machine_hspi.c b/ports/esp8266/machine_hspi.c
index 9fd0f4868..ff7728291 100644
--- a/ports/esp8266/machine_hspi.c
+++ b/ports/esp8266/machine_hspi.c
@@ -65,6 +65,9 @@ STATIC void machine_hspi_transfer(mp_obj_base_t *self_in, size_t len, const uint
spi_tx8fast(HSPI, src[i]);
++i;
}
+ // wait for SPI transaction to complete
+ while (spi_busy(HSPI)) {
+ }
} else {
// we need to read and write data