Skip to main content
ICohe.1
Associate III
October 12, 2020
Solved

How much flash the BSP_QSPI_Erase_Block() erases ?

  • October 12, 2020
  • 2 replies
  • 1596 views

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 ?

This topic has been closed for replies.
Best answer by Tesla DeLorean

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

2 replies

Tesla DeLorean
Guru
October 12, 2020

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

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
ICohe.1
ICohe.1Author
Associate III
October 13, 2020

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

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
October 13, 2020

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

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..