AnsweredAssumed Answered

Flash mass erase: are MER1/MER2 bits swapped when flash banks are swapped?

Question asked by haun.mark.001 on Mar 3, 2016
Latest reply on Mar 16, 2016 by haun.mark.001
On STM32L4 (and some other parts), the FB_MODE bit in SYSCFG->MEMRMP is used to swap the mapping of flash banks 1 and 2.  This is how the factory bootloader implements "boot from bank 2" (BFB2) in the flash option bytes.

The flash controller provides two bits in FLASH->CR, MER1 and MER2, which allow for erasing a single bank or both banks (if both MER1=MER2=1).  This raises an obvious question: Does MER1 always refer to bank 1?  Or does it refer to whichever bank is currently mapped into the lower address range (0x0800 0000 on my 1-MB part)?