2020-10-12 09:18 AM
I am using STM32F769I-DISO board with an MX25L51245G QSPI chip
As I understand it, I must erase before writing. So if I have 100 bytes of date on the QSPI
and I want to change byte number 51 in my 100 byte data I should first eras this location.
However the only function I can use for erasing is BSP_QSPI_Erase_Block(). I I want to keep the rest of the data unchanged, I must first read the unchanged data so I can save it after the erase operation. But I hav no idea how big is this block and therefore how much unchanged data I have to keep in RAM and rewrite after the erase. So How large this bock is ?
Solved! Go to Solution.
2020-10-13 06:38 AM
Journal your structure across multiple sectors, have a sequence number and checksum so you can locate the most recent and complete copy. When you reach the end of the last sector, erase the first
2020-10-12 09:39 AM
Depends what command you chose to use 0x20/0x21 (4KB), 0x52 (32KB) or 0xD8/0xDC (64KB)
Make a secondary function to pick one suitable for your purpose. The current one should be evident from the source/defines.
Here's the datasheet for the part, you might want to review that to understand how it works, and the general mechanics
https://www.macronix.com/Lists/Datasheet/Attachments/7574/MX25L51245G,%203V,%20512Mb,%20v1.3.pdf
2020-10-13 05:11 AM
So I must buffer the whole sector(4KB) , change the bytes needed , erase the sector and write the buffer back to flash.
If something happen (power down) after erase and before write, I lose the whole sector. I could of course make a copy , set a flag, change,erase and write back, then delete that flage.
If something happen just after erase, the flag will tell me to use the copy. Any better idea, Thanks
2020-10-13 06:38 AM
Journal your structure across multiple sectors, have a sequence number and checksum so you can locate the most recent and complete copy. When you reach the end of the last sector, erase the first