Skip to content

Commit c61445a

Browse files
committed
QSPIFBlockDevice: fix misconception in minimum program size
Prior to this PR, the minimum program size (QSPI_MIN_PROG_SIZE) of QSPIFBlockDevice was 256 by default and 512 for some targets. Those values were in fact page sizes, not program sizes. Here's an explanation: * Most QSPI flashes can be programmed to a granularity of a single byte or a few bytes - no need to be a whole page. This should be the value of QSPI_MIN_PROG_SIZE. Applications need to align buffer sizes to this granularity when programming QSPI flashes. * Each sending of the underlying QSPI program signal requires destination bytes to be located within the same page. If a QSPIFBlockDevice::program() call crosses page boundaries, this function breaks down the operation into multiple chunks, so it's not a concern for the application. So this PR changes the default program size to 1 (byte), and for targets with a 4-byte (1-word) read size it overrides the program size. Note: No config is needed for the page size, as it comes from the SFDP table parsed during initialisation.
1 parent 66c05dd commit c61445a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

storage/blockdevice/COMPONENT_QSPIF/mbed_lib.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"QSPI_POLARITY_MODE": 0,
1919
"QSPI_FREQ": "40000000",
2020
"QSPI_MIN_READ_SIZE": "1",
21-
"QSPI_MIN_PROG_SIZE": "256"
21+
"QSPI_MIN_PROG_SIZE": "1"
2222
},
2323
"target_overrides": {
2424
"MX25R6435F": {
@@ -37,15 +37,18 @@
3737
"MCU_NRF52840": {
3838
"QSPI_FREQ": "32000000",
3939
"QSPI_MIN_READ_SIZE": "4",
40-
"QSPI_MIN_PROG_SIZE": "256"
40+
"QSPI_MIN_PROG_SIZE": "4"
4141
},
4242
"MCU_PSOC6": {
43-
"QSPI_FREQ": "50000000",
44-
"QSPI_MIN_PROG_SIZE": "512"
43+
"QSPI_FREQ": "50000000"
4544
},
4645
"EFM32GG11_STK3701": {
4746
"QSPI_MIN_READ_SIZE": "4",
48-
"QSPI_MIN_PROG_SIZE": "256"
47+
"QSPI_MIN_PROG_SIZE": "4"
48+
},
49+
"MCU_LPC546XX": {
50+
"QSPI_MIN_READ_SIZE": "4",
51+
"QSPI_MIN_PROG_SIZE": "4"
4952
}
5053
}
5154
}

0 commit comments

Comments
 (0)