1
\$\begingroup\$

I have been reading up on the STM32F429 flash memory (2MB version). From the STM32F4 reference manual I found out that it has two memory banks and supports read-while-write (RWW), which means it can read from one memory bank while writing to the other.

My application has real-time constraints and I want to know what the worst-case situation is.

Lets say the microcontroller application is running from memory bank 1 and I want to write/erase data on memory bank 2. I have some questions after reading section 3.4 to 3.6 in the reference manual.

  1. Is there any situation where the microcontroller application in memory bank 1 needs to write to flash during normal code execution?

  2. If yes to question 1. Does this mean the application code execution have to wait until e.g. a sector erase is done on the memory bank 2 as it does not support write-while-write? Or is it someway to give memory bank 1 priority is it needs write/erase access?

\$\endgroup\$
4
  • \$\begingroup\$ What do you mean "bank"? I only find the FSMC controller has bank, but not the internal flash memory. \$\endgroup\$
    – diverger
    Nov 14, 2014 at 10:27
  • \$\begingroup\$ @diverger The STM32F429 has two Flash banks, the reference manual is pretty clear. \$\endgroup\$
    – markt
    Nov 14, 2014 at 10:41
  • \$\begingroup\$ @diverger: Bank is mentioned 23 times on the first page of the flash chapter... \$\endgroup\$ Nov 14, 2014 at 10:55
  • \$\begingroup\$ Oh, i think my reference manual is outdated. \$\endgroup\$
    – diverger
    Nov 14, 2014 at 12:12

1 Answer 1

1
\$\begingroup\$
  1. Flash are non-volatile memory device, so you may want to save some system configurations or calibration data in it. And STM32 gives you opportunity to protected them from read/write, so this may save you from another EEPROM, or other external non-valatile memory devices.
  2. According to section 3.6.5

This feature allows to perform a read operation from one bank while an erase or program operation is performed to the other bank.

When you are executing/reading code/data from bank1, you can executing erasing/programming operations on bank2. For example, your code is running in bank1, and you execute some codes to start one "earas" operation on bank2, once the "erasing" start, you needn't wait the operation done, you can continue to do other things (but can't execute codes to do erasing/programing on bank2). Then, after some while, you check the BSY bit to see if the erasing done. So your code executing and erasing are doing at the same time, no waiting needed.

According to "Read from bank 1 while erasing bank 2":

While executing a program code from bank 1, it is possible to perform an erase operation on bank 2 (and vice versa). Follow the procedure below:

  1. Check that no Flash memory operation is ongoing by checking the BSY bit in the FLASH_SR register (BSY is active when erase/program operation is on going to bank 1 or bank 2)...

So, there is no "priority", you can't fire two "erasing/programming" operations at the same time. The first fired always be served first. And you must wait until one erasing/programming operation done, then fire a new one.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.