summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriabdalkader <i.abdalkader@gmail.com>2022-04-13 12:41:28 +0200
committerDamien George <damien@micropython.org>2022-04-26 22:33:05 +1000
commit32914c53ef2b5ec78844427c7221ee77d67035ac (patch)
tree9f199118a6acf10f93b3a3ac5d2ce3cc58d22ce3
parent5974ac256b04a86e1ec88fd98cc8d68243f9d6be (diff)
stm32/qspi: Workaround for SR set immediately after setting AR.
See issue #5441. This issue is now reproducible on the Arduino Portenta H747, QSPI flash PN MX25L12833F.
-rw-r--r--ports/stm32/qspi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ports/stm32/qspi.c b/ports/stm32/qspi.c
index d741cf9aa..d32bd4dcf 100644
--- a/ports/stm32/qspi.c
+++ b/ports/stm32/qspi.c
@@ -354,6 +354,14 @@ STATIC void qspi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr,
QUADSPI->ABR = 0; // alternate byte: disable continuous read mode
QUADSPI->AR = addr; // address to read from
+ #if defined(STM32H7)
+ // Workaround for SR getting set immediately after setting the address.
+ if (QUADSPI->SR & 0x01) {
+ QUADSPI->FCR |= QUADSPI_FCR_CTEF;
+ QUADSPI->AR = addr; // address to read from
+ }
+ #endif
+
// Read in the data 4 bytes at a time if dest is aligned
if (((uintptr_t)dest & 3) == 0) {
while (len >= 4) {