summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriabdalkader <i.abdalkader@gmail.com>2022-04-13 12:40:11 +0200
committerDamien George <damien@micropython.org>2022-04-26 22:32:48 +1000
commit5974ac256b04a86e1ec88fd98cc8d68243f9d6be (patch)
treef5d1a41d730312d732a281ea9d30c6a56bc89e12
parentb28839420d84e9f7d73e37258b6ecc74d0a017d3 (diff)
stm32/qspi: Wait for a free FIFO location before writing to DR.
Must always check the FIFO before writing to DR. Without this, this function hangs on the H747.
-rw-r--r--ports/stm32/qspi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/stm32/qspi.c b/ports/stm32/qspi.c
index 027061fd7..d741cf9aa 100644
--- a/ports/stm32/qspi.c
+++ b/ports/stm32/qspi.c
@@ -228,6 +228,10 @@ STATIC void qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t
| cmd << QUADSPI_CCR_INSTRUCTION_Pos // write opcode
;
+ // Wait for at least 1 free byte location in the FIFO.
+ while (!(QUADSPI->SR & QUADSPI_SR_FTF)) {
+ }
+
// This assumes len==2
*(uint16_t *)&QUADSPI->DR = data;
}