Skip to content

Commit 5f4ff5d

Browse files
DBS06Cruz Monrreal II
authored andcommitted
Add SPIF_ULBPR command and replace wrong command to clear all write-protection bits in the Block-Protection register.
1 parent 1a8844e commit 5f4ff5d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ enum spif_default_instructions {
8888
SPIF_RSTEN = 0x66, // Reset Enable
8989
SPIF_RST = 0x99, // Reset
9090
SPIF_RDID = 0x9f, // Read Manufacturer and JDEC Device ID
91+
SPIF_ULBPR = 0x98, // Clears all write-protection bits in the Block-Protection register
9192
};
9293

9394
// 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()
169170
// SST devices come preset with block protection
170171
// enabled for some regions, issue write disable instruction to clear
171172
_set_write_enable();
172-
_spi_send_general_command(SPIF_WRDI, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0);
173+
_spi_send_general_command(SPIF_ULBPR, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0);
173174
break;
174175
}
175176

0 commit comments

Comments
 (0)