We are running Zephyr on a STM32L486 based system, using SST26VF032B QSpi flash.
The flash erase function works unstable.
After going deep down into the flash_stm32_qspi.c driver, we can see that the erase_types table that is read out via the JEDEC flash interface command, specifies the Block Erase (0xD8) command for erasing 8, 32 and 64 Kbytes blocks. But when reading the datasheet for the flash device, these block sizes are dependent on the address on which they are applied.
At figure 3-1: “Memory map” in the linked datasheet, it can be seen, that the flash is divided into different sized erasable blocks. So therefore, the block size erased, when applying the “Block erase” command is dependent on the address.
This does not fit with the way the driver decides which command to use for a given block to be erased.
The only way I can see, this can be fixed, is to make a patch to the flash_stm32_qspi.c driver that modifies the erase_types table to always return “Erase 4 Kbytes” (0x20) command.
We are running Zephyr on a STM32L486 based system, using SST26VF032B QSpi flash. The flash erase function works unstable.
After going deep down into the flash_stm32_qspi.c driver, we can see that the erase_types table that is read out via the JEDEC flash interface command, specifies the Block Erase (0xD8) command for erasing 8, 32 and 64 Kbytes blocks. But when reading the datasheet for the flash device, these block sizes are dependent on the address on which they are applied.
https://ww1.microchip.com/downloads/en/devicedoc/20005218e.pdf
At figure 3-1: “Memory map” in the linked datasheet, it can be seen, that the flash is divided into different sized erasable blocks. So therefore, the block size erased, when applying the “Block erase” command is dependent on the address.
This does not fit with the way the driver decides which command to use for a given block to be erased.
The only way I can see, this can be fixed, is to make a patch to the flash_stm32_qspi.c driver that modifies the erase_types table to always return “Erase 4 Kbytes” (0x20) command.
Other solutions are more than welcome!