From d9b9e88899df86fec5679138f5f60ed62df0975f Mon Sep 17 00:00:00 2001 From: robert-hh Date: Wed, 27 Mar 2024 10:53:29 +0100 Subject: [PATCH] samd/samd_qspiflash: Avoid reading status byte 2 when not available. Change provided by @ironss-iotec. Tested with Adafruit, SEEED and MiniFig boards for non-interference. Fixes issue #14190. Signed-off-by: robert-hh --- ports/samd/samd_qspiflash.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/samd/samd_qspiflash.c b/ports/samd/samd_qspiflash.c index 60aa434dcf..d027a0495f 100644 --- a/ports/samd/samd_qspiflash.c +++ b/ports/samd/samd_qspiflash.c @@ -337,9 +337,13 @@ static mp_obj_t samd_qspiflash_make_new(const mp_obj_type_t *type, size_t n_args // The write in progress bit should be low. while (read_status() & 0x01) { } - // The suspended write/erase bit should be low. - while (read_status2() & 0x80) { + + if (!flash_device->single_status_byte) { + // The suspended write/erase bit should be low. + while (read_status2() & 0x80) { + } } + run_command(QSPI_CMD_ENABLE_RESET); run_command(QSPI_CMD_RESET); // Wait 30us for the reset