From 331c66d4fb82abf41221687ae035abb4bef7a19e Mon Sep 17 00:00:00 2001 From: Philipp Steiner Date: Thu, 17 Jan 2019 10:10:52 +0100 Subject: [PATCH] Add SPIF_ULBPR command and replace wrong command to clear all write-protection bits in the Block-Protection register. --- .../storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp b/components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp index 5716f9d179..194c101ede 100644 --- a/components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp +++ b/components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp @@ -88,6 +88,7 @@ enum spif_default_instructions { SPIF_RSTEN = 0x66, // Reset Enable SPIF_RST = 0x99, // Reset SPIF_RDID = 0x9f, // Read Manufacturer and JDEC Device ID + SPIF_ULBPR = 0x98, // Clears all write-protection bits in the Block-Protection register }; // Mutex is used for some SPI Driver commands that must be done sequentially with no other commands in between @@ -169,7 +170,7 @@ int SPIFBlockDevice::init() // SST devices come preset with block protection // enabled for some regions, issue write disable instruction to clear _set_write_enable(); - _spi_send_general_command(SPIF_WRDI, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0); + _spi_send_general_command(SPIF_ULBPR, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0); break; }