Why Flash Memory is Divided into Banks: A Deep Dive

Flash memory is the backbone of embedded systems. It holds everything from bootloaders and applications to critical configuration data. But have you ever wondered why internal flash is divided into banks?

To understand why flash memory is divided into banks, we first need to understand what a flash bank is

 

🔍 What Are Flash Banks?

Flash banks are independent regions of flash memory that are physically separated inside the chip. Each bank acts like a standalone flash array and can carry out operations such as read, program, or erase independently to a certain extent.

In a dual-bank system (stm32H5xx), for example:

  • Bank 0 might hold the bootloader or running application.
  • Bank 1 can be used for firmware updates or non-volatile data.

 

❓ Why Is Flash Divided into Banks?

The core reason lies in the physical limitations of flash memory technology:

  • Flash memory cannot be read while being written to or erased.
  • If a single flash block is being programmed, the entire array becomes busy.
  • To avoid this bottleneck, manufacturers split flash into banks — physically distinct regions that can operate in parallel.

This enables:

  • Read-while-write operations (critical in real-time systems).
  • Safe firmware updates and logging without halting execution.
  • Memory protection and better fault isolation.

 

🧠 Think of banks as separate rooms in a library. If one room is being renovated, others are still accessible for reading.

 

⏰ When Are Flash Banks Useful?

Flash banks are especially useful in scenarios like:

  • Firmware Over-The-Air (FOTA) updates
  • Bootloader/Application separation
  • Read-While-Write (RWW) applications (e.g., real-time logging while executing code)
  • Safety-critical systems, where reliability and availability are crucial

 

🌍 Where Is This Used?

Flash banks are common in:

  • Microcontrollers (MCUs) like STM32, NXP, Renesas, TI, etc.
  • Embedded Linux SoCs that support secure boot or dual-image updates.
  • Automotive ECUs, industrial controllers, and medical devices requiring failsafe behavior.

For example:

STM32H5, STM32H7 series supports dual-bank flash, allowing real-time code execution from one bank while updating the other.

 

👨‍💻 Who Benefits from Flash Banks?

Flash banks benefit:

  • Embedded developers by simplifying firmware update mechanisms.
  • System architects by enabling memory isolation for security.
  • End-users by ensuring system responsiveness and uptime during updates.

 

⚙️ How Do Flash Banks Work?

At the hardware level:

  • Each bank is a separate flash array with its own control logic.
  • Flash controllers support read-while-write by redirecting operations to available banks.
  • Firmware can select the target bank during erase/program cycles via control registers.

👉 In STM32 MCUs:

FLASH->CR |= FLASH_CR_BKER; // Select Bank 1 or 2

Some MCUs also allow bank swapping after firmware upgrade:

FLASH->OPTCR |= FLASH_OPTCR_SWAP_BANK;