2. System and memory overview
2.1 System architecture
In STM32F413/423, the main system consists of 32-bit multilayer AHB bus matrix that interconnects:
- • Six masters:
- – Cortex ® -M4 with FPU core I-bus, D-bus and S-bus
- – DMA1 memory bus
- – DMA2 memory bus
- – DMA2 peripheral bus
- • Seven slaves:
- – Internal Flash memory ICode bus
- – Internal Flash memory DCode bus
- – Main internal SRAM1 (256 KB)
- – Auxiliary internal SRAM2 (64 KB)
- – AHB1 peripherals including AHB to APB bridges and APB peripherals
- – AHB2 peripherals
- – FSMC / QuadSPI
The bus matrix provides access from a master to a slave, enabling concurrent access and efficient operation even when several high-speed peripherals work simultaneously. This architecture is shown in Figure 1 .
Figure 1. System architecture

The diagram illustrates the system architecture of the RM0430 microcontroller. At the top, three master blocks are shown: ARM Cortex-M4, GP DMA1, and GP DMA2. The ARM Cortex-M4 is connected to the Bus matrix-S via three buses: I-bus (to S0), D-bus (to S1), and S-bus (to S2). GP DMA1 is connected via DMA_PI (to S3) and DMA_MEM1 (to S4). GP DMA2 is connected via DMA_MEM2 (to S4) and DMA_P2 (to S5). The Bus matrix-S is a grid with six slave interfaces (S0 to S5) and seven master interfaces (M0 to M6). The connections are as follows:
- M0 (ICODE) connects to Flash Up to 1.5 MB.
- M1 (DCODE) connects to ACCEL.
- M2 connects to SRAM1 256 KB.
- M3 connects to AHB periph. 1, which in turn connects to APB1 and APB2.
- M4 connects to AHB periph. 2.
- M5 connects to FSMC external MemCtrl/QuadSPI.
- M6 connects to SRAM2 64 KB.
Access methods are indicated by symbols in the matrix:
- Access through remap (pink circle): S1 to M2, S2 to M2.
- Access by aliasing (blue square): S0 to M6, S1 to M6.
Reference code: MSV40821V3
2.1.1 I-bus
This bus connects the Instruction bus of the Cortex ® -M4 with FPU core to the BusMatrix. This bus is used by the core to fetch instructions. The target of this bus is a memory containing code (internal Flash memory/SRAM1/SRAM2).
2.1.2 D-bus
This bus connects the databus of the Cortex ® -M4 with FPU to the BusMatrix. This bus is used by the core for literal load and debug access. The target of this bus is a memory containing code or data (internal Flash memory/SRAM1/SRAM2).
2.1.3 S-bus
This bus connects the system bus of the Cortex ® -M4 with FPU core to a BusMatrix. This bus is used to access data located in a peripheral or in SRAM1 or in SRAM2. Instructions may also be fetch on this bus (less efficient than ICode). The targets of this bus are the internal SRAM1/SRAM2, the AHB1 peripherals including the APB peripherals, the AHB2 peripherals and the external memories through the FSMC and the QUADSPI.
2.1.4 DMA memory bus
This bus connects the DMA memory bus master interface to the BusMatrix. It is used by the DMA to perform transfer to/from memories. The targets of this bus are data memories: internal Flash memory, internal SRAM1/SRAM2 and additionally for S4 the AHB1/AHB2 peripherals including the APB peripherals.
2.1.5 DMA peripheral bus
This bus connects the DMA peripheral master bus interface to the BusMatrix. This bus is used by the DMA to access AHB peripherals or to perform memory-to-memory transfers. The targets of this bus are the AHB and APB peripherals plus data memories: Flash memory and internal SRAM1/SRAM2.
2.1.6 BusMatrix
The BusMatrix manages the access arbitration between masters. The arbitration uses a round-robin algorithm.
2.1.7 AHB/APB bridges (APB)
The two AHB/APB bridges, APB1 and APB2, provide full synchronous connections between the AHB and the two APB buses, allowing flexible selection of the peripheral frequency.
Refer to the device datasheets for more details on APB1 and APB2 maximum frequencies, and to Table 1 for the address mapping of AHB and APB peripherals.
After each device reset, all peripheral clocks are disabled (except for the SRAM and Flash memory interface). Before using a peripheral you have to enable its clock in the RCC_AHBxENR or RCC_APBxENR register.
Note: When a 16- or an 8-bit access is performed on an APB register, the access is transformed into a 32-bit access: the bridge duplicates the 16- or 8-bit data to feed the 32-bit vector.
2.2 Memory organization
2.2.1 Introduction
Program memory, data memory, registers and I/O ports are organized within the same linear 4-Gbyte address space.
The bytes are coded in memory in Little Endian format. The lowest numbered byte in a word is considered the word's least significant byte and the highest numbered byte the most significant.
The addressable memory space is divided into eight main blocks, of 512 Mbytes each.
2.2.2 Memory map and register boundary addresses
Figure 2. Memory map

| Physical Address Range | Memory Block / Feature | Logical Address Range | Logical Block / Feature |
|---|---|---|---|
| 0x0000 0000 - 0x07FF FFFF | Alias to Flash, system, memory or SRAM1 depending on the BOOT pins | 0x4000 0000 - 0x4000 7FFF | APB1 |
| 0x0800 0000 - 0x0817 FFFF | Flash memory | 0x4000 8000 - 0x4000 FFFF | Reserved |
| 0x0818 0000 - 0x081F FFFF | Reserved | 0x4001 0000 - 0x4001 7FFF | APB2 |
| 0x1000 0000 - 0x1000 FFFF | SRAM2 (64KB accessed by CPU via Ibus and Dbus) | 0x4001 8000 - 0x4001 FFFF | Reserved |
| 0x1001 0000 - 0x1001 FFFF | Reserved | 0x4002 0000 - 0x4002 67FF | AHB1 |
| 0x1FFF 0000 - 0x1FFF 77FF | System memory | 0x6000 0000 - 0x6000 1FFF | AHB3 |
| 0x1FFF 7800 - 0x1FFF 7A0F | OTP area + lock | 0x6000 2000 - 0x6000 7FFF | Reserved |
| 0x1FFF 7A10 - 0x1FFF BFFF | Reserved | 0xE000 0000 - 0xE000 FFFF | Cortex-M4 internal peripherals |
| 0x1FFF C000 - 0x1FFF C00F | User option bytes | 0xE010 0000 - 0xE010 FFFF | Reserved |
| 0x2000 0000 - 0x2003 FFFF | SRAM1 (256 KB aliased by bit-banding) | ||
| 0x2004 0000 - 0x2004 FFFF | SRAM2 (64 KB aliased by bit-banding) | ||
| 0x2005 0000 - 0x3FFF FFFF | Reserved | ||
| 0x4000 0000 - 0x3FFF FFFF | 512-Mbyte block 1 inc. SRAM1/SRAM2 | ||
| 0x6000 0000 - 0x5FFF FFFF | 512-Mbyte block 2 peripherals | ||
| 0x8000 0000 - 0x7FFF FFFF | 512-Mbyte block 0 Code | ||
| 0xA000 0000 - 0xA000 1FFF | Reserved | ||
| 0xC000 0000 - 0xBFFF FFFF | 512-Mbyte block 6 Not used | ||
| 0xE000 0000 - 0xDFFF FFFF | 512-Mbyte block 7 internal peripherals |
All the memory map areas that are not allocated to on-chip memories and peripherals are considered “Reserved”. For the detailed mapping of available memory and register areas, refer to the following table.
The following table gives the boundary addresses of the peripherals available in the devices.
Table 1. Register boundary addresses
| Bus | Boundary address | Peripheral |
|---|---|---|
| - | 0xE010 0000 - 0xFFFF FFFF | Reserved |
| Cortex ® -M4 | 0xE000 0000 - 0xE00F FFFF | Cortex-M4 internal peripherals |
| AHB3 | 0xA000 2000 - 0xDFFF FFFF | Reserved |
| 0xA000 1000 - 0xA000 1FFF | QuadSPI control register | |
| 0xA000 0000 - 0xA000 0FFF | FSMC control register | |
| 0x9000 0000 - 0x9FFF FFFF | QUADSPI | |
| 0x7000 0000 - 0x8FFF FFFF | Reserved | |
| 0x6000 0000 - 0x6FFF FFFF | FSMC | |
| AHB2 | 0x5006 0C00 - 0x5FFF FFFF | Reserved |
| 0x5006 0800 - 0x5006 0BFF | RNG | |
| 0x5006 0400 - 0x5006 07FF | Reserved | |
| 0x5006 0000 - 0x5006 03FF | AES (1) | |
| 0x5004 0000 - 0x5005 FFFF | Reserved | |
| 0x5000 0000 - 0x5003 FFFF | USB OTG FS | |
| AHB1 | 0x4002 6800 - 0x4FFF FFFF | Reserved |
| 0x4002 6400 - 0x4002 67FF | DMA2 | |
| 0x4002 6000 - 0x4002 63FF | DMA1 | |
| 0x4002 4000 - 0x4002 5FFF | Reserved | |
| 0x4002 3C00 - 0x4002 3FFF | Flash interface register | |
| 0x4002 3800 - 0x4002 3BFF | RCC | |
| 0x4002 3400 - 0x4002 37FF | Reserved | |
| 0x4002 3000 - 0x4002 33FF | CRC | |
| 0x4002 2000 - 0x4002 2FFF | Reserved | |
| 0x4002 1C00 - 0x4002 1FFF | GPIOH | |
| 0x4002 1800 - 0x4002 1BFF | GPIOG | |
| 0x4002 1400 - 0x4002 17FF | GPIOF | |
| 0x4002 1000 - 0x4002 13FF | GPIOE | |
| 0x4002 0C00 - 0x4002 0FFF | GPIO D | |
| 0x4002 0800 - 0x4002 0BFF | GPIOC | |
| 0x4002 0400 - 0x4002 07FF | GPIOB | |
| 0x4002 0000 - 0x4002 03FF | GPIOA |
| Bus | Boundary address | Peripheral |
|---|---|---|
| APB2 | 0x4001 6800 - 0x4001 FFFF | Reserved |
| 0x4001 6400 - 0x4001 67FF | DFSDM2 | |
| 0x4001 6000 - 0x4001 63FF | DFSDM1 | |
| 0x4001 5C00 - 0x4001 5FFF | Reserved | |
| 0x4001 5800 - 0x4001 5BFF | SAI1 | |
| 0x4001 5400 - 0x4001 57FF | Reserved | |
| 0x4001 5000 - 0x4001 53FF | SPI5/I2S5 | |
| 0x4001 4C00 - 0x4001 4FFF | Reserved | |
| 0x4001 4800 - 0x4001 4BFF | TIM11 | |
| 0x4001 4400 - 0x4001 47FF | TIM10 | |
| 0x4001 4000 - 0x4001 43FF | TIM9 | |
| 0x4001 3C00 - 0x4001 3FFF | EXTI | |
| 0x4001 3800 - 0x4001 3BFF | SYSCFG | |
| 0x4001 3400 - 0x4001 37FF | SPI4/I2S4 | |
| 0x4001 3000 - 0x4001 33FF | SPI1/I2S1 | |
| 0x4001 2C00 - 0x4001 2FFF | SDIO | |
| 0x4001 2400 - 0x4001 2BFF | Reserved | |
| 0x4001 2000 - 0x4001 23FF | ADC1 | |
| 0x4001 1C00 - 0x4001 1FFF | UART10 | |
| 0x4001 1800 - 0x4001 1BFF | UART9 | |
| 0x4001 1400 - 0x4001 17FF | USART6 | |
| 0x4001 1000 - 0x4001 13FF | USART1 | |
| 0x4001 0800 - 0x4001 0FFF | Reserved | |
| 0x4001 0400 - 0x4001 07FF | TIM8 | |
| 0x4001 0000 - 0x4001 03FF | TIM1 |
Table 1. Register boundary addresses (continued)
| Bus | Boundary address | Peripheral |
|---|---|---|
| APB1 | 0x4000 8000 - 0x4000 FFFF | Reserved |
| 0x4000 7C00 - 0x4000 7FFF | UART8 | |
| 0x4000 7800 - 0x4000 7BFF | UART7 | |
| 0x4000 7400 - 0x4000 77FF | DAC | |
| 0x4000 7000 - 0x4000 73FF | PWR | |
| 0x4000 6C00 - 0x4000 6FFF | CAN3 | |
| 0x4000 6800 - 0x4000 6BFF | CAN2 | |
| 0x4000 6400 - 0x4000 67FF | CAN1 | |
| 0x4000 6000 - 0x4000 63FF | I2CFMP1 | |
| 0x4000 5C00 - 0x4000 5FFF | I2C3 | |
| 0x4000 5800 - 0x4000 5BFF | I2C2 | |
| 0x4000 5400 - 0x4000 57FF | I2C1 | |
| 0x4000 5000 - 0x4000 53FF | UART5 | |
| 0x4000 4C00 - 0x4000 4FFF | UART4 | |
| 0x4000 4800 - 0x4000 4BFF | USART3 | |
| 0x4000 4400 - 0x4000 47FF | USART2 | |
| 0x4000 4000 - 0x4000 43FF | I2S3ext | |
| 0x4000 3C00 - 0x4000 3FFF | SPI3 / I2S3 | |
| 0x4000 3800 - 0x4000 3BFF | SPI2 / I2S2 | |
| 0x4000 3400 - 0x4000 37FF | I2S2ext | |
| 0x4000 3000 - 0x4000 33FF | IWDG | |
| 0x4000 2C00 - 0x4000 2FFF | WWDG | |
| 0x4000 2800 - 0x4000 2BFF | RTC & BKP Registers | |
| 0x4000 2400 - 0x4000 27FF | LPTIM1 | |
| 0x4000 2000 - 0x4000 23FF | TIM14 | |
| 0x4000 1C00 - 0x4000 1FFF | TIM13 | |
| 0x4000 1800 - 0x4000 1BFF | TIM12 | |
| 0x4000 1400 - 0x4000 17FF | TIM7 | |
| 0x4000 1000 - 0x4000 13FF | TIM6 | |
| 0x4000 0C00 - 0x4000 0FFF | TIM5 | |
| 0x4000 0800 - 0x4000 0BFF | TIM4 | |
| 0x4000 0400 - 0x4000 07FF | TIM3 | |
| 0x4000 0000 - 0x4000 03FF | TIM2 |
- 1. AES is only available for STM32F423xx. This boundary address is reserved for STM32F413xx.
2.3 Embedded SRAM
STM32F413/423 devices feature 320 Kbytes of system SRAM.
The embedded SRAM can be accessed as bytes, half-words (16 bits) or full words (32 bits). Read and write operations are performed at CPU speed with 0 wait state.
The embedded SRAM is divided into two blocks:
- • SRAM1 mapped at address 0x2000 0000 and accessible by all AHB masters.
- • SRAM2 mapped at address 0x2004 0000 and accessible by all AHB masters.
The CPU can access the embedded SRAM1, through the System Bus or through the I-Code/D-Code buses when boot from SRAM1 is selected or when physical remap is selected (See Section 8.2.1: SYSCFG memory remap register (SYSCFG_MEMRMP) ).
To get the max performance on SRAM1 execution, physical remap should be selected (boot or software selection).
The CPU can access the embedded SRAM2, through the System Bus or through the I-Code/D-Code buses when SRAM2 is mapped at the address range: 0x1000 0000 to 0x1000 FFFF. To get the max performance on SRAM2 execution, mapping at the address 0x1000 0000 should be selected.
To get the max performance on embedded SRAM, use SRAM1/SRAM2 to execute code via I-code and SRAM2/SRAM1 to store data
2.4 Flash memory overview
The Flash memory interface manages CPU AHB I-Code and D-Code accesses to the Flash memory. It implements the erase and program Flash memory operations and the read and write protection mechanisms. It accelerates code execution with a system of instruction prefetch and cache lines.
The Flash memory is organized as follows:
- • A main memory block divided into sectors.
- • System memory from which the device boots in System memory boot mode
- • 512 OTP (one-time programmable) bytes for user data.
- • Option bytes to configure read and write protection, BOR level, watchdog software/hardware and reset when the device is in Standby or Stop mode.
Refer to Section 3: Embedded Flash memory interface for more details.
2.5 Bit banding
The Cortex ® -M4 with FPU memory map includes two bit-band regions. These regions map each word in an alias region of memory to a bit in a bit-band region of memory. Writing to a word in the alias region has the same effect as a read-modify-write operation on the targeted bit in the bit-band region.
In the STM32F4x3xx devices both the peripheral registers and the SRAM1 are mapped to a bit-band region, so that single bit-band write and read operations are allowed. The operations are only available for Cortex ® -M4 with FPU accesses, and not from other bus masters (e.g. DMA).
A mapping formula shows how to reference each word in the alias region to a corresponding bit in the bit-band region. The mapping formula is:
where:
- – bit_word_addr is the address of the word in the alias memory region that maps to the targeted bit
- – bit_band_base is the starting address of the alias region
- – byte_offset is the number of the byte in the bit-band region that contains the targeted bit
- – bit_number is the bit position (0-7) of the targeted bit
Example
The following example shows how to map bit 2 of the byte located at SRAM1 address 0x20000300 to the alias region:
Writing to address 0x22006008 has the same effect as a read-modify-write operation on bit 2 of the byte at SRAM1 address 0x20000300.
Reading address 0x22006008 returns the value (0x01 or 0x00) of bit 2 of the byte at SRAM1 address 0x20000300 (0x01: bit set; 0x00: bit reset).
For more information on bit-banding, refer to the Cortex®-M4 with FPU programming manual (see Related documents on page 1 ).
2.6 Boot configuration
Due to its fixed memory map, the code area starts from address 0x0000 0000 (accessed through the ICode/DCode buses) while the data area (SRAM) starts from address 0x2000 0000 (accessed through the system bus). The Cortex®-M4 with FPU CPU always fetches the reset vector on the ICode bus, which implies to have the boot space available only in the code area (typically, Flash memory). STM32F4xx microcontrollers implement a special mechanism to be able to boot from other memories (like the internal SRAM).
In the STM32F4x3xx, three different boot modes can be selected through the BOOT[1:0] pins as shown in Table 2 .
Table 2. Boot modes
| Boot mode selection pins | Boot mode | Aliasing | |
|---|---|---|---|
| BOOT1 | BOOT0 | ||
| x | 0 | Main Flash memory | Main Flash memory is selected as the boot space |
| 0 | 1 | System memory | System memory is selected as the boot space |
| 1 | 1 | Embedded SRAM | Embedded SRAM is selected as the boot space |
The values on the BOOT pins are latched on the 4th rising edge of SYSCLK after a reset. It is up to the user to set the BOOT1 and BOOT0 pins after reset to select the required boot mode.
BOOT0 is a dedicated pin while BOOT1 is shared with a GPIO pin. Once BOOT1 has been sampled, the corresponding GPIO pin is free and can be used for other purposes.
The BOOT pins are also resampled when the device exits the Standby mode. Consequently, they must be kept in the required Boot mode configuration when the device is in the Standby mode. After this startup delay is over, the CPU fetches the top-of-stack value from address 0x0000 0000, then starts code execution from the boot memory starting from 0x0000 0004.
Note: When the device boots from SRAM, in the application initialization code, you have to relocate the vector table in SRAM using the NVIC exception table and the offset register.
Embedded bootloader
The embedded bootloader mode is used to reprogram the Flash memory using one of the interface described in the table below. The availability of the interface is package dependent.
Table 3. Embedded bootloader interfaces
| Package | USART1 PA9/ PA10 | USART2 PD6/ PD5 | USART3 PB11/ PB10 | I2C1 PB6/ PB7 | I2C2 PF0/ PF1 | I2C3 PA8/ PB4 | I2C FMP1 PB14/ PB15 | SPI1 PA4/ PA5/ PA6/ PA7 | SPI3 PA15/ PC10/ PC11/ PC12 | SPI4 PE11/ PE12/ PE13/ PE14 | CAN2 PB5/ PB13 | USB PA11 /P12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| UFQFPN48 | Y | - | - | Y | - | Y | Y | Y | - | - | Y | Y |
| LQFP64 | Y | - | - | Y | - | Y | Y | Y | Y | - | Y | Y |
| WLCSP81 | Y | - | - | Y | - | Y | Y | Y | Y | Y | Y | Y |
| LQFP100 | Y | Y | - | Y | - | Y | Y | Y | Y | Y | Y | Y |
| LQFP144 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| UFBGA100 | Y | Y | Y | Y | - | Y | Y | Y | Y | Y | Y | Y |
| UFBGA144 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
The USART peripherals operate at the internal 16 MHz oscillator (HSI) frequency, while the CAN and USB OTG FS require an external clock (HSE) multiple of 1 MHz (ranging from 4 to 26 MHz).
The embedded bootloader code is located in system memory. It is programmed by ST during production. For additional information, refer to application note AN2606.
Physical remap in STM32F413/423
Once the boot pins are selected, the application software can modify the memory accessible in the code area (in this way the code can be executed through the ICode bus in place of the System bus). This modification is performed by programming the Section 8.2.1: SYSCFG memory remap register (SYSCFG_MEMRMP) in the SYSCFG controller.
The following memories can thus be remapped:
- • Main Flash memory
- • System memory
- • Embedded SRAM
| Addresses | Boot/Remap in main Flash memory | Boot/Remap in embedded SRAM | Boot/Remap in System memory |
|---|---|---|---|
| 0x2000 0000 - 0x2003 FFFF | SRAM (256 KB) | SRAM (256KB) | SRAM (256KB) |
| 0x1FFF 0000 - 0x1FFF 77FF | System memory | System memory | System memory |
| 0x0802 0000 - 0x1FFE FFFF | Reserved | Reserved | Reserved |
| 0x0800 0000 - 0x080F FFFF | Flash memory | Flash memory | Flash memory |
| 0x0400 000 - 0x07FF FFFF | Reserved | Reserved | Reserved |
| 0x0000 0000 - 0x0003 FFFF (1) | Flash (1M) Aliased | SRAM1 (256 KB) Aliased | System memory (30 KB) Aliased |
- 1. Even when aliased in the boot memory space, the related memory is still accessible at its original memory space.