From a5489e62f8910f8cbb43b7c16eb5dd9ec25cc30b Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 4 Mar 2023 18:14:37 +0100 Subject: [PATCH] spiFlash: ST M25P16 --- src/spiFlash.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/spiFlash.cpp b/src/spiFlash.cpp index 4ff66ba..e97cc6c 100644 --- a/src/spiFlash.cpp +++ b/src/spiFlash.cpp @@ -399,6 +399,14 @@ int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len) _unprotect = true; must_relock = true; } + /* ST M25P16 has not TB bit: + * block protection is always in top mode: + * if write is not at offset 0 -> force unlock + */ + if ((_jedec_id >> 8) == 0x202015 && tb == 1 && base_addr != 0) { + _unprotect = true; + must_relock = true; + } } } else { // unknown chip: basic test printWarn("flash chip unknown: use basic protection detection");