2. System and memory overview
2.1 System architecture
The main system consists of 32-bit multilayer AHB bus matrix that interconnects:
- • Up to nine masters:
- – Cortex ® -M4 with FPU core I-bus
- – Cortex ® -M4 with FPU core D-bus
- – Cortex ® -M4 with FPU core S-bus
- – DMA1
- – DMA2
- – DMA2D (Chrom-Art Accelerator ™ ) memory bus
- – LCD-TFT controller DMA-bus
- – SDMMC1 bus
- – SDMMC2 bus
(only for STM32L4P5xx and STM32L4Q5xx devices) - – GFXMMU (Chrom-GRC
™
) bus
(only for STM32L4Sxxx and STM32L4R5xxx devices)
- • Up to eleven slaves:
- – Internal Flash memory on the I-Code bus
- – Internal Flash memory on D-Code bus
- – Internal SRAM1
(192 Kbytes for STM32L4Rxxx and STM32Sxxx devices and
128 Kbytes for STM32L4P5xx and STM32Q5xx devices) - – Internal SRAM2 (64 Kbytes)
- – Internal SRAM3
(384 Kbytes for STM32L4Rxxx and STM32L4Sxxx devices and
128 Kbytes for STM32L4P5xx and STM32L4Q5xx devices) - – GFXMMU (Chrom-GRC
™
)
(only for STM32L4Rxxx and STM32L4Sxxx devices) - – AHB1 peripherals including AHB to APB bridges and APB peripherals (connected to APB1 and APB2)
- – AHB2 peripherals
- – Flexible memory controller (FMC)
- – OCTOSPI1
- – OCTOSPI2
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 for STM32L4Rxxx and STM32L4Sxxx

The diagram illustrates the system architecture for STM32L4Rxxx and STM32L4Sxxx microcontrollers. At the top, a horizontal row of components includes Cortex®-M4 with FPU, DMA1, DMA2, DMA2D, LCD-TFT, SDMMC1, and GFXMMU. Below this row is a grid labeled 'BusMatrix-S' at the bottom. The grid has 10 vertical columns and 10 horizontal rows. The first three columns are labeled 'I-bus', 'D-bus', and 'S-bus' at the top. The first seven columns (I-bus through SDMMC1) have connection points at the top of each row. The eighth column (GFXMMU) has connection points at the top and bottom of each row. The ninth and tenth columns are labeled 'ICode' and 'DCode' at the top right. To the right of the grid, an 'ACCEL' block is connected to the ICode and DCode lines. Below the ACCEL block, a vertical stack of components is connected to the grid via switches: FLASH 2 MB, SRAM1, SRAM2, SRAM3, GFXMMU, AHB1 peripherals, AHB2 peripherals, FSMC, OCTOSPI1, and OCTOSPI2. The label 'BusMatrix-S' is located at the bottom center of the grid. The reference 'MSv38490V1' is in the bottom right corner.
Figure 2. System architecture for STM32L4P5xx and STM32L4Q5xx

The diagram illustrates the system architecture for STM32L4P5xx and STM32L4Q5xx. At the top, a horizontal row of components includes: Cortex®-M4 with FPU, DMA1, DMA2, DMA2D, LCD-TFT, SDMMC1, and SDMMC2. Below this row is a grid labeled 'BusMatrix-S'. The columns of the matrix are labeled I-bus, D-bus, and S-bus. The I-bus column connects to the Cortex®-M4 with FPU and to an 'ACCEL' block. The D-bus column connects to the Cortex®-M4 with FPU, DMA1, DMA2, DMA2D, LCD-TFT, SDMMC1, and SDMMC2. The S-bus column connects to the Cortex®-M4 with FPU, DMA1, DMA2, DMA2D, LCD-TFT, SDMMC1, SDMMC2, and various peripheral blocks. On the right side of the matrix, there are several blocks: 'ACCEL' (connected to ICode and DCode), 'FLASH 2 MB', 'SRAM1', 'SRAM2', 'SRAM3', 'AHB1 peripherals', 'AHB2 peripherals', 'FSMC', 'OCTOSPI1', and 'OCTOSPI2'. The matrix itself is a grid of 10 rows and 7 columns, with dots indicating connections at various intersections. The label 'BusMatrix-S' is at the bottom center of the grid. The reference 'MSv61196V1' is in the bottom right corner.
2.1.1 I-bus
This bus connects the instruction bus of the Cortex®-M4 core to the BusMatrix. This bus is used by the core to fetch instructions. The target of this bus is a memory containing code (either internal Flash memory, internal SRAM or external memories through the FMC or OCTOSPIs).
2.1.2 D-bus
This bus connects the data bus of the Cortex®-M4 core 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 (either internal Flash memory, internal SRAM or external memories through the FMC or OCTOSPIs).
2.1.3 S-bus
This bus connects the system bus of the Cortex®-M4 core to the BusMatrix. This bus is used by the core to access data located in a peripheral or SRAM area. The targets of this bus are the internal SRAM, the AHB1 peripherals including the APB1 and APB2
peripherals, the AHB2 peripherals and the external memories through the OCTOSPI or the FMC.
The SRAM2 is also accessible on this bus to allow continuous mapping with SRAM1 and SRAM3.
2.1.4 DMA-bus
This bus connects the AHB master interface of the DMA to the BusMatrix. The targets of this bus are the SRAM1, SRAM2 and SRAM3, the AHB1 peripherals including the APB1 and APB2 peripherals, the AHB2 peripherals and the external memories through the OCTOSPI or the FMC.
2.1.5 DMA2D-bus
This bus connects the AHB master interface of the DMA2D to the BusMatrix. The targets of this bus are the SRAM1, SRAM2 and SRAM3 and external memories through the OCTOSPI or the FMC.
2.1.6 LCD-TFT controller DMA bus
This bus connects the LCD controller DMA master interface to the BusMatrix. The targets of this bus are data memories: internal SRAMs (SRAM1, SRAM2, SRAM3), internal Flash memory or external memories through FMC or OCTOSPI.
2.1.7 SDMMC1 controller DMA bus
This bus connects the SDMMC1 DMA master interface to the BusMatrix. This bus is used only by the SDMMC1 DMA to load/store data from/to memory. The targets of this bus are data memories: internal SRAMs (SRAM1, SRAM2, SRAM3), internal Flash memory or external memories through FMC or OCTOSPI.
2.1.8 SDMMC2 controller DMA bus (only for STM32L4P5xx and STM32L4Q5xx devices)
This bus connects the SDMMC2 DMA master interface to the BusMatrix. This bus is used only by the SDMMC2 DMA to load/store data from/to memory. The targets of this bus are data memories: internal SRAMs (SRAM1, SRAM2, SRAM3), internal Flash memory or external memories through FMC or OCTOSPI.
2.1.9 GFXMMU-bus (only for STM32L4Rxxx and STM32L4Sxxx devices)
This bus connects the GFXMMU (Chrom-GRC™) AHB master interface to the BusMatrix. The targets of this bus are data memories: internal SRAMs (SRAM1, SRAM2, SRAM3), internal Flash memory or external memories through FMC or OCTOSPI.
2.1.10 BusMatrix
The BusMatrix manages the access arbitration between masters. The arbitration uses a Round Robin algorithm.
For STM32L4Rxxx and STM32L4Sxxx devices, the BusMatrix is composed of
- • up to nine masters:
- – CPU AHB system bus, D-Code bus, I-Code bus, DMA1, DMA2, DMA2D, SDMMC1, LCD-TFT and GFXMMU
- • up to eleven slaves:
- – FLASH, SRAM1, SRAM2, SRAM3, AHB1 (including APB1 and APB2), AHB2, GFXMMU, OCTOSTPI1, OCTOSPI2 and FMC
For STM32L4P5xx and STM32Q5xx devices, the BusMatrix is composed of:
- • nine masters:
- – CPU AHB system bus, D-Code bus, I-Code bus, DMA1, DMA2, DMA2D, SDMMC1, SDMMC2 and LCD-TFT
- • ten slaves:
- – FLASH, SRAM1, SRAM2, SRAM3, AHB1 (including APB1 and APB2), AHB2, OCTOSTPI1, OCTOSPI2 and FMC.
AHB/APB bridges
The two AHB/APB bridges provide full synchronous connections between the AHB and the two APB buses, allowing flexible selection of the peripheral frequency.
Refer to Section 2.2.2: Memory map and register boundary addresses on page 94 for the address mapping of the peripherals connected to this bridge.
After each device reset, all peripheral clocks are disabled (except for the SRAM1/2 and Flash memory interface). Before using a peripheral you have to enable its clock in the RCC_AHBxENR and the RCC_APBxENR registers.
Note: When a 16- or 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 3. Memory map for STM32L4Rxxx and STM32L4Sxxx

The diagram illustrates the memory map for STM32L4Rxxx and STM32L4Sxxx, organized into two columns of memory regions. The left column represents the main memory map, and the right column shows the peripheral and system memory map. The regions are numbered 0 to 7, corresponding to the address ranges shown on the left.
Memory Map Details:
- 0x0000 0000 to 0x2000 0000: CODE
- 0x2000 0000 to 0x2003 0000: SRAM1
- 0x2003 0000 to 0x2004 0000: SRAM2
- 0x2004 0000 to 0x200A 0000: SRAM3
- 0x200A 0000 to 0x2FFF FFFF: Reserved
- 0x3000 0000 to 0x4000 0000: GFXMMU Virtual buffer
- 0x4000 0000 to 0x6000 0000: Peripherals
- 0x6000 0000 to 0x7000 0000: FMC bank1
- 0x7000 0000 to 0x8000 0000: OCTOSPI2
- 0x8000 0000 to 0x9000 0000: FMC bank3
- 0x9000 0000 to 0xA000 0000: OCTOSPI1
- 0xA000 0000 to 0xC000 0000: FMC and OCTOSPI registers
- 0xC000 0000 to 0xE000 0000: Reserved
- 0xE000 0000 to 0xFFFF FFFF: Cortex™-M4 with FPU Internal Peripherals
Peripheral and System Memory Map:
- 0x0000 0000 to 0x0020 0000: Flash, system memory or SRAM, depending on BOOT configuration
- 0x0020 0000 to 0x0800 0000: Reserved
- 0x0800 0000 to 0x0820 0000: Flash memory
- 0x0820 0000 to 0x1000 0000: Reserved
- 0x1000 0000 to 0x1001 0000: SRAM2
- 0x1001 0000 to 0x1FFF 0000: Reserved
- 0x1FFF 0000 to 0x1FFF 7000: System memory
- 0x1FFF 7000 to 0x1FFF 7400: OTP area
- 0x1FFF 7400 to 0x1FFF 7800: Reserved
- 0x1FFF 7800 to 0x1FFF 7810: Options bytes
- 0x1FFF 7810 to 0x1FFF 8000: Reserved
- 0x1FFF 8000 to 0x1FFF F000: System memory
- 0x1FFF F000 to 0x1FFF F800: Reserved
- 0x1FFF F800 to 0x1FFF F810: Option bytes
- 0x1FFF F810 to 0x1FFF FFFF: Reserved
- 0x4000 0000 to 0x4001 0000: APB1
- 0x4001 0000 to 0x4001 6400: Reserved
- 0x4001 6400 to 0x4002 0000: APB2
- 0x4002 0000 to 0x4002 4400: Reserved
- 0x4002 4400 to 0x4800 0000: AHB1
- 0x4800 0000 to 0x5006 0C00: Reserved
- 0x5006 0C00 to 0x5FFF FFFF: AHB2
- 0xA000 0000 to 0xA000 1000: FMC registers
- 0xA000 1000 to 0xA000 1800: OCTOSPI registers
- 0xA000 1800 to 0xBFFF FFFF: Reserved
Legend:
- Reserved (shaded gray)
MSv44746V4
Figure 4. Memory map for STM32L4P5xx and STM32L4Q5xx

The diagram illustrates the memory map for STM32L4P5xx and STM32L4Q5xx microcontrollers, organized into two main columns of memory regions. The left column shows the primary memory layout from 0x0000 0000 to 0xFFFF FFFF, while the right column provides a detailed view of specific address ranges.
Left Column: Main Memory Map
| Address Range | Memory Region |
|---|---|
| 0x0000 0000 – 0x2000 0000 | CODE |
| 0x2000 0000 – 0x2002 0000 | SRAM1 |
| 0x2002 0000 – 0x2003 0000 | SRAM2 |
| 0x2003 0000 – 0x2005 0000 | SRAM3 |
| 0x2005 0000 – 0x4000 0000 | Reserved |
| 0x4000 0000 – 0x6000 0000 | Peripherals |
| 0x6000 0000 – 0x7000 0000 | FMC bank1 |
| 0x7000 0000 – 0x8000 0000 | OCTOSPI2 |
| 0x8000 0000 – 0x9000 0000 | FMC bank3 |
| 0x9000 0000 – 0xA000 0000 | OCTOSPI1 |
| 0xA000 0000 – 0xC000 0000 | FMC and OCTOSPI registers |
| 0xC000 0000 – 0xE000 0000 | Reserved |
| 0xE000 0000 – 0xFFFF FFFF | Cortex™-M4 with FPU Internal Peripherals |
Right Column: Detailed Memory Map
| Address Range | Memory Region |
|---|---|
| 0x0000 0000 – 0x0010 0000 | Flash, system memory or SRAM, depending on BOOT configuration |
| 0x0010 0000 – 0x0800 0000 | Reserved |
| 0x0800 0000 – 0x0810 0000 | Flash memory |
| 0x0810 0000 – 0x1000 0000 | Reserved |
| 0x1000 0000 – 0x1001 0000 | SRAM2 |
| 0x1001 0000 – 0x1FFF 0000 | Reserved |
| 0x1FFF 0000 – 0x1FFF 7000 | System memory |
| 0x1FFF 7000 – 0x1FFF 7400 | OTP area |
| 0x1FFF 7400 – 0x1FFF 7800 | Reserved |
| 0x1FFF 7800 – 0x1FFF 7810 | Options bytes |
| 0x1FFF 7810 – 0x1FFF 8000 | Reserved |
| 0x1FFF 8000 – 0x1FFF F000 | System memory |
| 0x1FFF F000 – 0x1FFF F800 | Reserved |
| 0x1FFF F800 – 0x1FFF F810 | Option bytes |
| 0x1FFF F810 – 0x1FFF FFFF | Reserved |
| 0x4000 0000 – 0x4000 9800 | APB1 |
| 0x4000 9800 – 0x4001 0000 | Reserved |
| 0x4001 0000 – 0x4001 7400 | APB2 |
| 0x4001 7400 – 0x4002 0000 | Reserved |
| 0x4002 0000 – 0x4002 BC00 | AHB1 |
| 0x4002 BC00 – 0x4800 0000 | Reserved |
| 0x4800 0000 – 0x5006 2C00 | AHB2 |
| 0x5006 2C00 – 0x5FFF FFFF | Reserved |
| 0xA000 0000 – 0xA000 1000 | FMC registers |
| 0xA000 1000 – 0xA000 1800 | OCTOSPI registers |
| 0xA000 1800 – 0xBFFF FFFF | Reserved |
Legend:
- Reserved (shaded gray)
MSv61134V2
All the memory map areas that are not allocated to on-chip memories and peripherals are considered “Reserved” (highlighted in gray). For the detailed mapping of available memory and register areas, refer to the following tables.
The following tables give the boundary addresses of the peripherals available in the devices.
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary addresses
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| - | 0xA000 1800 - 0xDFFF FFFF | 1 KB | Reserved | - |
| 0xA000 1400 - 0xA000 17FF | 1 KB | OCTOSPI2 registers | Section 19.7.28: OCTOSPI register map | |
| 0xA000 1000 - 0xA000 13FF | 1 KB | OCTOSPI1 registers | Section 19.7.28: OCTOSPI register map | |
| 0xA000 0400 - 0xA000 0FFF | 1 KB | Reserved | - | |
| 0xA000 0000 - 0xA000 03FF | 1 KB | FSMC registers | Section 18.8.8: FMC register map |
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary addresses (continued)
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| AHB2 | 0x5006 2000 - 0x5FFF FFFF | ~260 MB | Reserved | - |
| 0x5006 2400 - 0x5006 27FF | 1 KB | SDMMC1 | Section 54.10.20: SDMMC register map | |
| 0x5006 2000 - 0x5006 23FF | 1 KB | Reserved | - | |
| 0x5006 1C00 - 0x5006 1FFF | 1 KB | OCTOSPIM | Section 20.5.3: OCTOSPIM register map | |
| 0x5006 0C00 - 0x5006 1BFF | 4 KB | Reserved | - | |
| 0x5006 0800 - 0x5006 0BFF | 1 KB | RNG | Section 32.7.4: RNG register map | |
| 0x5006 0400 - 0x5006 07FF | 1 KB | HASH | Section 35.7.8: HASH register map | |
| 0x5006 0000 - 0x5006 03FF | 1 KB | AES | Section 34.7.18: AES register map | |
| 0x5005 0800 - 0x5005 FFFF | 61 KB | Reserved | - | |
| 0x5005 0400 - 0x5005 07FF | 1 KB | Reserved | - | |
| 0x5005 0000 - 0x5005 03FF | 1 KB | DCMI | Section 24.5.12: DCMI register map | |
| 0x5004 0400 - 0x5004 FFFF | 62 KB | Reserved | - | |
| 0x5004 0000 - 0x5004 03FF | 1 KB | ADC | Section 21.8: ADC register map on page 726 | |
| 0x5000 0000 - 0x5003 FFFF | 16 KB | OTG_FS | Section 56.15.57: OTG_FS register map | |
| 0x4800 2400 - 0x4FFF FFFF | ~127 MB | Reserved | - | |
| 0x4800 2000 - 0x4800 23FF | 1 KB | GPIOI | Section 8.4.12: GPIO register map | |
| 0x4800 1C00 - 0x4800 1FFF | 1 KB | GPIOH | Section 8.4.12: GPIO register map | |
| 0x4800 1800 - 0x4800 1BFF | 1 KB | GPIOG | Section 8.4.12: GPIO register map | |
| 0x4800 1400 - 0x4800 17FF | 1 KB | GPIOF | Section 8.4.12: GPIO register map | |
| 0x4800 1000 - 0x4800 13FF | 1 KB | GPIOE | Section 8.4.12: GPIO register map | |
| 0x4800 0C00 - 0x4800 0FFF | 1 KB | GPIO_D | Section 8.4.12: GPIO register map | |
| 0x4800 0800 - 0x4800 0BFF | 1 KB | GPIOC | Section 8.4.12: GPIO register map | |
| 0x4800 0400 - 0x4800 07FF | 1 KB | GPIOB | Section 8.4.12: GPIO register map | |
| 0x4800 0000 - 0x4800 03FF | 1 KB | GPIOA | Section 8.4.12: GPIO register map |
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| AHB1 | 0x4002 F000 - 0x47FF FFFF | ~127 MB | Reserved | - |
| 0x4002 C000 - 0x4002 EFFF | 1KB | GFXMMU | Section 14.5.11: GFXMMU register map | |
| 0x4002 BC00 - 0x4002 BBFF | 1 KB | Reserved | - | |
| 0x4002 B000 - 0x4002 BBFF | 3 KB | DMA2D | Section 13.5.23: DMA2D register map | |
| 0x4002 4400 - 0x4002 AFFF | 26 KB | Reserved | - | |
| 0x4002 4000 - 0x4002 43FF | 1 KB | TSC | Section 31.6.11: TSC register map | |
| 0x4002 3400 - 0x4002 3FFF | 1 KB | Reserved | - | |
| 0x4002 3000 - 0x4002 33FF | 1 KB | CRC | Section 17.4.6: CRC register map | |
| 0x4002 2400 - 0x4002 2FFF | 3 KB | Reserved | - | |
| 0x4002 2000 - 0x4002 23FF | 1 KB | FLASH registers | Section 3.7.18: FLASH register map | |
| 0x4002 1400 - 0x4002 1FFF | 3 KB | Reserved | - | |
| 0x4002 1000 - 0x4002 13FF | 1 KB | RCC | Section 6.4.34: RCC register map | |
| 0x4002 0800 - 0x4002 0FFF | 2 KB | Reserved | - | |
| 0x4002 0400 - 0x4002 07FF | 1 KB | DMA2 | Section 11.6.7: DMA register map | |
| 0x4002 0800 - 0x4002 0BFF | 1 KB | DMAMUX1 | Section 12.6.7: DMAMUX register map | |
| 0x4002 0C00 - 0x4002 0FFF | 1 KB | Reserved | - | |
| 0x4002 0000 - 0x4002 03FF | 1 KB | DMA1 | Section 11.6.7: DMA register map |
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary addresses (continued)
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| APB2 | 0x4001 7400 - 0x4001 FFFF | 33 KB | Reserved | - |
| 0x4001 6C00 - 0x4001 73FF | 1 KB | DSIHOST | Section 30.15: DSI Host registers | |
| 0x4001 6800 - 0x4001 6BFF | 1 KB | LCD-TFT | Section 29.8.26: LTDC register map | |
| 0x4001 6000 - 0x4001 67FF | 2 KB | DFSDM1 | Section 28.8.16: DFSDM register map | |
| 0x4001 5C00 - 0x4001 5FFF | 1 KB | Reserved | - | |
| 0x4001 5800 - 0x4001 5BFF | 1 KB | SAI2 | Section 53.6.20: SAI register map | |
| 0x4001 5400 - 0x4001 57FF | 1 KB | SAI1 | Section 53.6.20: SAI register map | |
| 0x4001 4C00 - 0x4001 53FF | 2 KB | Reserved | - | |
| 0x4001 4800 - 0x4001 4BFF | 1 KB | TIM17 | Section 39.6.21: TIM16/TIM17 register map | |
| 0x4001 4400 - 0x4001 47FF | 1 KB | TIM16 | Section 39.6.21: TIM16/TIM17 register map | |
| 0x4001 4000 - 0x4001 43FF | 1 KB | TIM15 | Section 39.5.21: TIM15 register map | |
| 0x4001 3C00 - 0x4001 3FFF | 1 KB | Reserved | - | |
| 0x4001 3800 - 0x4001 3BFF | 1 KB | USART1 | Section 50.8.15: USART register map | |
| 0x4001 3400 - 0x4001 37FF | 1 KB | TIM8 | Section 37.4.33: TIM8 register map | |
| 0x4001 3000 - 0x4001 33FF | 1 KB | SPI1 | Section 52.6.8: SPI register map | |
| 0x4001 2C00 - 0x4001 2FFF | 1 KB | TIM1 | Section 37.4.32: TIM1 register map | |
| 0x4001 2000 - 0x4001 2BFF | 3 KB | Reserved | - | |
| 0x4001 1C00 - 0x4001 1FFF | 1 KB | FIREWALL | Section 4.4.8: Firewall register map | |
| 0x4001 0800 - 0x4001 1BFF | 5 KB | Reserved | - | |
| 0x4001 0400 - 0x4001 07FF | 1 KB | EXTI | Section 16.5.13: EXTI register map | |
| 0x4001 0200 - 0x4001 03FF | 1 KB | COMP | Section 26.6.3: COMP register map | |
| 0x4001 0030 - 0x4001 01FF | 1 KB | VREFBUF | Section 23.3.3: VREFBUF register map | |
| 0x4001 0000 - 0x4001 002F | 1 KB | SYSCFG | Section 9.2.12: SYSCFG register map |
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| APB1 | 0x4000 9800 - 0x4000 FFFF | 26 KB | Reserved | - |
| 0x4000 9400 - 0x4000 97FF | 1 KB | LPTIM2 | Section 41.7.11: LPTIM register map | |
| 0x4000 8C00 - 0x4000 93FF | 3 KB | Reserved | - | |
| 0x4000 8400 - 0x4000 87FF | 1 KB | I2C4 | Section 49.7.12: I2C register map | |
| 0x4000 8000 - 0x4000 83FF | 1 KB | LPUART1 | Section 51.7.13: LPUART register map | |
| 0x4000 7C00 - 0x4000 7FFF | 1 KB | LPTIM1 | Section 41.7.11: LPTIM register map | |
| 0x4000 7800 - 0x4000 7BFF | 1 KB | OPAMP | Section 27.5.7: OPAMP register map | |
| 0x4000 7400 - 0x4000 77FF | 1 KB | DAC1 | Section 22.7.21: DAC register map | |
| 0x4000 7000 - 0x4000 73FF | 1 KB | PWR | Section 5.4.27: PWR register map and reset value table | |
| 0x4000 6800 - 0x4000 6FFF | 2 KB | Reserved | - | |
| 0x4000 6400 - 0x4000 67FF | 1 KB | CAN1 | Section 55.9.5: bxCAN register map | |
| 0x4000 6000 - 0x4000 63FF | 1 KB | CRS | Section 7.7.5: CRS register map | |
| 0x4000 5C00 - 0x4000 5FFF | 1 KB | I2C3 | Section 49.7.12: I2C register map | |
| 0x4000 5800 - 0x4000 5BFF | 1 KB | I2C2 | Section 49.7.12: I2C register map | |
| 0x4000 5400 - 0x4000 57FF | 1 KB | I2C1 | Section 49.7.12: I2C register map | |
| 0x4000 5000 - 0x4000 53FF | 1 KB | UART5 | Section 50.8.15: USART register map | |
| 0x4000 4C00 - 0x4000 4FFF | 1 KB | UART4 | Section 50.8.15: USART register map |
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| APB1 | 0x4000 4800 - 0x4000 4BFF | 1 KB | USART3 | Section 50.8.15: USART register map |
| 0x4000 4400 - 0x4000 47FF | 1 KB | USART2 | Section 50.8.15: USART register map | |
| 0x4000 4000 - 0x4000 43FF | 1 KB | Reserved | - | |
| 0x4000 3C00 - 0x4000 3FFF | 1 KB | SPI3 | Section 52.6.8: SPI register map | |
| 0x4000 3800 - 0x4000 3BFF | 1 KB | SPI2 | Section 52.6.8: SPI register map | |
| 0x4000 3400 - 0x4000 37FF | 1 KB | Reserved | - | |
| 0x4000 3000 - 0x4000 33FF | 1 KB | IWDG | Section 44.4.6: IWDG register map | |
| 0x4000 2C00 - 0x4000 2FFF | 1 KB | WWDG | Section 45.5.4: WWDG register map | |
| 0x4000 2800 - 0x4000 2BFF | 1 KB | RTC | Section 46.6.21: RTC register map | |
| 0x4000 1800 - 0x4000 23FF | 4 KB | Reserved | - | |
| 0x4000 1400 - 0x4000 17FF | 1 KB | TIM7 | Section 40.4.9: TIMx register map | |
| 0x4000 1000 - 0x4000 13FF | 1 KB | TIM6 | Section 40.4.9: TIMx register map | |
| 0x4000 0C00 - 0x4000 0FFF | 1 KB | TIM5 | Section 38.4.26: TIMx register map | |
| 0x4000 0800 - 0x4000 0BFF | 1 KB | TIM4 | Section 38.4.26: TIMx register map | |
| 0x4000 0400 - 0x4000 07FF | 1 KB | TIM3 | Section 38.4.26: TIMx register map | |
| 0x4000 0000 - 0x4000 03FF | 1 KB | TIM2 | Section 38.4.26: TIMx register map |
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| - | 0xA000 1800 - 0xDFFF FFFF | 1 KB | Reserved | - |
| 0xA000 1400 - 0xA000 17FF | 1 KB | OCTOSPI2 registers | Section 19.7.28: OCTOSPI register map | |
| 0xA000 1000 - 0xA000 13FF | 1 KB | OCTOSPI1 registers | Section 19.7.28: OCTOSPI register map | |
| 0xA000 0400 - 0xA000 0FFF | 1 KB | Reserved | - | |
| 0xA000 0000 - 0xA000 03FF | 1 KB | FSMC registers | Section 18.8.8: FMC register map |
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| AHB2 | 0x5006 2C00 - 0x5FFF FFFF | ~260 MB | Reserved | - |
| 0x5006 2400 - 0x5006 27FF | 1 KB | SDMMC1 | Section 54.10.20: SDMMC register map | |
| 0x5006 2800 - 0x5006 2BFF | 1 KB | SDMMC2 | Section 54.10.20: SDMMC register map | |
| 0x5006 2000 - 0x5006 23FF | 1 KB | Reserved | - | |
| 0x5006 1C00 - 0x5006 1FFF | 1 KB | OCTOSPIM | Section 20.5.3: OCTOSPIM register map | |
| 0x5006 0C00 - 0x5006 1BFF | 4 KB | Reserved | - | |
| 0x5006 0800 - 0x5006 0BFF | 1 KB | RNG | Section 32.7.4: RNG register map | |
| 0x5006 0400 - 0x5006 07FF | 1 KB | HASH | Section 35.7.8: HASH register map | |
| 0x5006 0000 - 0x5006 03FF | 1 KB | AES | Section 34.7.18: AES register map | |
| 0x5005 E000 - 0x5005 FFFF | 8 KB | PKA + RAM | Section 36.7.5: PKA register map | |
| 0x5005 0800 - 0x5005 DFFF | 54 KB | Reserved | - | |
| 0x5005 0400 - 0x5005 07FF | 1 KB | PSSI | Section 25.5.8: PSSI register map | |
| 0x5005 0000 - 0x5005 03FF | 1 KB | DCMI | Section 24.5.12: DCMI register map | |
| 0x5004 0400 - 0x5004 FFFF | 62 KB | Reserved | - | |
| 0x5004 0000 - 0x5004 03FF | 1 KB | ADC1 + ADC2 | Section 21.8: ADC register map on page 726 | |
| 0x5000 0000 - 0x5003 FFFF | 16 KB | OTG_FS | Section 56.15.57: OTG_FS register map | |
| 0x4800 2400 - 0x4FFF FFFF | ~127 MB | Reserved | - | |
| 0x4800 2000 - 0x4800 23FF | 1 KB | GPIOI | Section 8.4.12: GPIO register map | |
| 0x4800 1C00 - 0x4800 1FFF | 1 KB | GPIOH | Section 8.4.12: GPIO register map | |
| 0x4800 1800 - 0x4800 1BFF | 1 KB | GPIOG | Section 8.4.12: GPIO register map | |
| 0x4800 1400 - 0x4800 17FF | 1 KB | GPIOF | Section 8.4.12: GPIO register map | |
| 0x4800 1000 - 0x4800 13FF | 1 KB | GPIOE | Section 8.4.12: GPIO register map | |
| 0x4800 0C00 - 0x4800 0FFF | 1 KB | GPIO D | Section 8.4.12: GPIO register map | |
| 0x4800 0800 - 0x4800 0BFF | 1 KB | GPIOC | Section 8.4.12: GPIO register map | |
| 0x4800 0400 - 0x4800 07FF | 1 KB | GPIOB | Section 8.4.12: GPIO register map | |
| 0x4800 0000 - 0x4800 03FF | 1 KB | GPIOA | Section 8.4.12: GPIO register map |
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary addresses (continued)
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| AHB1 | 0x4002 BC00 - 0x47FF FFFF | ~127 MB | Reserved | - |
| 0x4002 B000 - 0x4002 BBFF | 3 KB | DMA2D | Section 13.5.23: DMA2D register map | |
| 0x4002 4400 - 0x4002 AFFF | 26 KB | Reserved | - | |
| 0x4002 4000 - 0x4002 43FF | 1 KB | TSC | Section 31.6.11: TSC register map | |
| 0x4002 3400 - 0x4002 3FFF | 1 KB | Reserved | - | |
| 0x4002 3000 - 0x4002 33FF | 1 KB | CRC | Section 17.4.6: CRC register map | |
| 0x4002 2400 - 0x4002 2FFF | 3 KB | Reserved | - | |
| 0x4002 2000 - 0x4002 23FF | 1 KB | FLASH registers | Section 3.7.18: FLASH register map | |
| 0x4002 1400 - 0x4002 1FFF | 3 KB | Reserved | - | |
| 0x4002 1000 - 0x4002 13FF | 1 KB | RCC | Section 6.4.34: RCC register map | |
| 0x4002 0800 - 0x4002 0FFF | 2 KB | Reserved | - | |
| 0x4002 0400 - 0x4002 07FF | 1 KB | DMA2 | Section 11.6.7: DMA register map | |
| 0x4002 0000 - 0x4002 03FF | 1 KB | DMA1 | Section 11.6.7: DMA register map | |
| 0x4002 0800 - 0x4002 0BFF | 1 KB | DMAMUX1 | Section 12.6.7: DMAMUX register map | |
| 0x4002 0C00 - 0x4002 0FFF | 1 KB | Reserved | - |
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary addresses (continued)
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| APB2 | 0x4001 7400 - 0x4001 FFFF | 33 KB | Reserved | - |
| 0x4001 6C00 - 0x4001 73FF | 1 KB | Reserved | - | |
| 0x4001 6800 - 0x4001 6BFF | 1 KB | LCD-TFT | Section 29.8.26: LTDC register map | |
| 0x4001 6000 - 0x4001 67FF | 2 KB | DFSDM1 | Section 28.8.16: DFSDM register map | |
| 0x4001 5C00 - 0x4001 5FFF | 1 KB | Reserved | - | |
| 0x4001 5800 - 0x4001 5BFF | 1 KB | SAI2 | Section 53.6.20: SAI register map | |
| 0x4001 5400 - 0x4001 57FF | 1 KB | SAI1 | Section 53.6.20: SAI register map | |
| 0x4001 4C00 - 0x4001 53FF | 2 KB | Reserved | - | |
| 0x4001 4800 - 0x4001 4BFF | 1 KB | TIM17 | Section 39.6.21: TIM16/TIM17 register map | |
| 0x4001 4400 - 0x4001 47FF | 1 KB | TIM16 | Section 39.6.21: TIM16/TIM17 register map | |
| 0x4001 4000 - 0x4001 43FF | 1 KB | TIM15 | Section 39.5.21: TIM15 register map | |
| 0x4001 3C00 - 0x4001 3FFF | 1 KB | Reserved | - | |
| 0x4001 3800 - 0x4001 3BFF | 1 KB | USART1 | Section 50.8.15: USART register map | |
| 0x4001 3400 - 0x4001 37FF | 1 KB | TIM8 | Section 37.4.33: TIM8 register map | |
| 0x4001 3000 - 0x4001 33FF | 1 KB | SPI1 | Section 52.6.8: SPI register map | |
| 0x4001 2C00 - 0x4001 2FFF | 1 KB | TIM1 | Section 37.4.32: TIM1 register map | |
| 0x4001 2000 - 0x4001 2BFF | 3 KB | Reserved | - | |
| 0x4001 1C00 - 0x4001 1FFF | 1 KB | FIREWALL | Section 4.4.8: Firewall register map | |
| 0x4001 0800 - 0x4001 1BFF | 5 KB | Reserved | - | |
| 0x4001 0400 - 0x4001 07FF | 1 KB | EXTI | Section 16.5.13: EXTI register map | |
| 0x4001 0200 - 0x4001 03FF | 1 KB | COMP | Section 26.6.3: COMP register map | |
| 0x4001 0030 - 0x4001 01FF | 1 KB | VREFBUF | Section 23.3.3: VREFBUF register map | |
| 0x4001 0000 - 0x4001 002F | 1 KB | SYSCFG | Section 9.2.12: SYSCFG register map |
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary addresses (continued)
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| APB1 | 0x4000 9800 - 0x4000 FFFF | 26 KB | Reserved | - |
| 0x4000 9400 - 0x4000 97FF | 1 KB | LPTIM2 | Section 41.7.11: LPTIM register map | |
| 0x4000 8C00 - 0x4000 93FF | 3 KB | Reserved | - | |
| 0x4000 8400 - 0x4000 87FF | 1 KB | I2C4 | Section 49.7.12: I2C register map | |
| 0x4000 8000 - 0x4000 83FF | 1 KB | LPUART1 | Section 51.7.13: LPUART register map | |
| 0x4000 7C00 - 0x4000 7FFF | 1 KB | LPTIM1 | Section 41.7.11: LPTIM register map | |
| 0x4000 7800 - 0x4000 7BFF | 1 KB | OPAMP | Section 27.5.7: OPAMP register map | |
| 0x4000 7400 - 0x4000 77FF | 1 KB | DAC1 | Section 22.7.21: DAC register map | |
| 0x4000 7000 - 0x4000 73FF | 1 KB | PWR | Section 5.4.27: PWR register map and reset value table | |
| 0x4000 6800 - 0x4000 6FFF | 2 KB | Reserved | - | |
| 0x4000 6400 - 0x4000 67FF | 1 KB | CAN1 | Section 55.9.5: bxCAN register map | |
| 0x4000 6000 - 0x4000 63FF | 1 KB | CRS | Section 7.7.5: CRS register map | |
| 0x4000 5C00 - 0x4000 5FFF | 1 KB | I2C3 | Section 49.7.12: I2C register map | |
| 0x4000 5800 - 0x4000 5BFF | 1 KB | I2C2 | Section 49.7.12: I2C register map | |
| 0x4000 5400 - 0x4000 57FF | 1 KB | I2C1 | Section 49.7.12: I2C register map | |
| 0x4000 5000 - 0x4000 53FF | 1 KB | UART5 | Section 50.8.15: USART register map | |
| 0x4000 4C00 - 0x4000 4FFF | 1 KB | UART4 | Section 50.8.15: USART register map |
| Bus | Boundary address | Size (bytes) | Peripheral | Peripheral register map |
|---|---|---|---|---|
| APB1 | 0x4000 4800 - 0x4000 4BFF | 1 KB | USART3 | Section 50.8.15: USART register map |
| 0x4000 4400 - 0x4000 47FF | 1 KB | USART2 | Section 50.8.15: USART register map | |
| 0x4000 4000 - 0x4000 43FF | 1 KB | Reserved | - | |
| 0x4000 3C00 - 0x4000 3FFF | 1 KB | SPI3 | Section 52.6.8: SPI register map | |
| 0x4000 3800 - 0x4000 3BFF | 1 KB | SPI2 | Section 52.6.8: SPI register map | |
| 0x4000 3400 - 0x4000 37FF | 1 KB | TAMPER and BKP registers | Section 48.6.9: TAMP register map | |
| 0x4000 3000 - 0x4000 33FF | 1 KB | IWDG | Section 44.4.6: IWDG register map | |
| 0x4000 2C00 - 0x4000 2FFF | 1 KB | WWDG | Section 45.5.4: WWDG register map | |
| 0x4000 2800 - 0x4000 2BFF | 1 KB | RTC | Section 47.6.23: RTC register map | |
| 0x4000 1800 - 0x4000 23FF | 4 KB | Reserved | - | |
| 0x4000 1400 - 0x4000 17FF | 1 KB | TIM7 | Section 40.4.9: TIMx register map | |
| 0x4000 1000 - 0x4000 13FF | 1 KB | TIM6 | Section 40.4.9: TIMx register map | |
| 0x4000 0C00 - 0x4000 0FFF | 1 KB | TIM5 | Section 38.4.26: TIMx register map | |
| 0x4000 0800 - 0x4000 0BFF | 1 KB | TIM4 | Section 38.4.26: TIMx register map | |
| 0x4000 0400 - 0x4000 07FF | 1 KB | TIM3 | Section 38.4.26: TIMx register map | |
| 0x4000 0000 - 0x4000 03FF | 1 KB | TIM2 | Section 38.4.26: TIMx register map |
2.3 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 STM32L4+ Series 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 (such as 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 programming manual (see Related documents on page 1 ).
2.4 Embedded SRAM
The STM32L4Rxxx and STM32L4Sxxx devices feature up to 640 Kbytes SRAM:
- • 192 Kbytes SRAM1
- • 64 Kbytes SRAM2
- • 384 Kbytes SRAM3
The STM32L4P5xx and STM32L4Q5xx devices feature up to 320 Kbytes SRAM:
- • 128 Kbytes SRAM1
- • 64 Kbytes SRAM2
- • 128 Kbytes SRAM3
These SRAM can be accessed as bytes, half-words (16 bits) or full words (32 bits). These memories can be addressed at maximum system clock frequency without wait state and thus by both CPU and DMA.
The CPU can access the SRAM1 through the system bus or through the ICode/DCode buses when boot from SRAM1 is selected or when physical remap is selected ( Section 9.2.1: SYSCFG memory remap register (SYSCFG_MEMRMP) in the SYSCFG controller). To get the maximum performance on SRAM1 execution, physical remap should be selected (boot or software selection).
Execution can be performed from SRAM2 with maximum performance without any remap thanks to access through ICode bus.
The SRAM2 is aliased at address 0x2003 0000 for STM32L4Rxxx and STM32L4Sxxx devices and at address 0x2002 0000 for STM32L4P5xx and STM32L4Q5xx devices,
offering a continuous address space with the SRAM1 and SRAM3.
2.4.1 SRAM2 parity check
The user can enable the SRAM2 parity check using the option bit SRAM2_PE in the user option byte (refer to Section 3.4.1: Option bytes description ).
The data bus width is 36 bits because 4 bits are available for parity check (1 bit per byte) in order to increase memory robustness, as required for instance by Class B or SIL norms.
The parity bits are computed and stored when writing into the SRAM2. Then, they are automatically checked when reading. If one bit fails, an NMI is generated. The same error can also be linked to the BRK_IN Break input of TIM1/TIM8/TIM15/TIM16/TIM17, with the SPL control bit in the SYSCFG configuration register 2 (SYSCFG_CFGR2) . The SRAM2 Parity Error flag (SPF) is available in the SYSCFG configuration register 2 (SYSCFG_CFGR2) .
Note: When enabling the RAM parity check, it is advised to initialize by software the whole RAM memory at the beginning of the code, to avoid getting parity errors when reading non-initialized locations.
2.4.2 SRAM2 Write protection
The SRAM2 can be write protected with a page granularity of 1 Kbyte.
Table 3. SRAM2 organization
| Page number | Start address | End address |
|---|---|---|
| Page 0 | 0x1000 0000 | 0x1000 03FF |
| Page 1 | 0x1000 0400 | 0x1000 07FF |
| Page 2 | 0x1000 0800 | 0x1000 0BFF |
| Page 3 | 0x1000 0C00 | 0x1000 0FFF |
| Page 4 | 0x1000 1000 | 0x1000 13FF |
| Page 5 | 0x1000 1400 | 0x1000 17FF |
| Page 6 | 0x1000 1800 | 0x1000 1BFF |
| Page 7 | 0x1000 1C00 | 0x1000 1FFF |
| Page 8 | 0x1000 2000 | 0x1000 23FF |
| Page 9 | 0x1000 2400 | 0x1000 27FF |
| Page 10 | 0x1000 2800 | 0x1000 2BFF |
| Page 11 | 0x1000 2C00 | 0x1000 2FFF |
| Page 12 | 0x1000 3000 | 0x1000 33FF |
| Page 13 | 0x1000 3400 | 0x1000 37FF |
| Page 14 | 0x1000 3800 | 0x1000 3BFF |
| Page 15 | 0x1000 3C00 | 0x1000 3FFF |
| Page 16 | 0x1000 4000 | 0x1000 43FF |
| Page 17 | 0x1000 4400 | 0x1000 47FF |
Table 3. SRAM2 organization (continued)
| Page number | Start address | End address |
|---|---|---|
| Page 18 | 0x1000 4800 | 0x1000 4BFF |
| Page 19 | 0x1000 4C00 | 0x1000 4FFF |
| Page 20 | 0x1000 5000 | 0x1000 53FF |
| Page 21 | 0x1000 5400 | 0x1000 57FF |
| Page 22 | 0x1000 5800 | 0x1000 5BFF |
| Page 23 | 0x1000 5C00 | 0x1000 5FFF |
| Page 24 | 0x1000 6000 | 0x1000 63FF |
| Page 25 | 0x1000 6400 | 0x1000 67FF |
| Page 26 | 0x1000 6800 | 0x1000 6BFF |
| Page 27 | 0x1000 6C00 | 0x1000 6FFF |
| Page 28 | 0x1000 7000 | 0x1000 73FF |
| Page 29 | 0x1000 7400 | 0x1000 77FF |
| Page 30 | 0x1000 7800 | 0x1000 7BFF |
| Page 31 | 0x1000 7C00 | 0x1000 7FFF |
| Page 32 | 0x1000 8000 | 0x1000 83FF |
| Page 33 | 0x1000 8400 | 0x1000 87FF |
| Page 34 | 0x1000 8800 | 0x1000 8BFF |
| Page 35 | 0x1000 8C00 | 0x1000 8FFF |
| Page 36 | 0x1000 9000 | 0x1000 93FF |
| Page 37 | 0x1000 9400 | 0x1000 97FF |
| Page 38 | 0x1000 9800 | 0x1000 9BFF |
| Page 39 | 0x1000 9C00 | 0x1000 9FFF |
| Page 40 | 0x1000 A000 | 0x1000 A3FF |
| Page 41 | 0x1000 A400 | 0x1000 A7FF |
| Page 42 | 0x1000 A800 | 0x1000 ABFF |
| Page 43 | 0x1000 AC00 | 0x1000 AFFF |
| Page 44 | 0x1000 B000 | 0x1000 B3FF |
| Page 45 | 0x1000 B400 | 0x1000 B7FF |
| Page 46 | 0x1000 B800 | 0x1000 BBFF |
| Page 47 | 0x1000 BC00 | 0x1000 BFFF |
| Page 48 | 0x1000 C000 | 0x1000 C3FF |
| Page 49 | 0x1000 C400 | 0x1000 C7FF |
| Page 50 | 0x1000 C800 | 0x1000 CBFF |
| Page 51 | 0x1000 CC00 | 0x1000 CFFF |
| Page 52 | 0x1000 D000 | 0x1000 D3FF |
| Page number | Start address | End address |
|---|---|---|
| Page 53 | 0x1000 D400 | 0x1000 D7FF |
| Page 54 | 0x1000 D800 | 0x1000 DBFF |
| Page 55 | 0x1000 DC00 | 0x1000 DFFF |
| Page 56 | 0x1000 E000 | 0x1000 E3FF |
| Page 57 | 0x1000 E400 | 0x1000 E7FF |
| Page 58 | 0x1000 E800 | 0x1000 EBFF |
| Page 59 | 0x1000 EC00 | 0x1000 EFFF |
| Page 60 | 0x1000 F000 | 0x1000 F3FF |
| Page 61 | 0x1000 F400 | 0x1000 F7FF |
| Page 62 | 0x1000 F800 | 0x1000 FBFF |
| Page 63 | 0x1000 FC00 | 0x1000 FFFF |
The write protection can be enabled in SYSCFG SRAM2 write protection register (SYSCFG_SWPR) in the SYSCFG block. This is a register with write '1' once mechanism, which means by writing '1' on a bit it will setup the write protection for that page of SRAM and it can be removed/cleared by a system reset only.
2.4.3 SRAM2 Read protection
The SRAM2 is protected with the Read protection (RDP). Refer to Section 3.5.1: Read protection (RDP) for more details.
2.4.4 SRAM2 Erase
The SRAM2 can be erased with a system reset using the option bit SRAM2_RST in the user option byte (refer to Section 3.4.1: Option bytes description ).
The SRAM2 erase can also be requested by software by setting the bit SRAM2ER in the SYSCFG SRAM2 control and status register (SYSCFG_SCSR) .
2.5 Flash memory overview
The Flash memory is composed of two distinct physical areas:
- • The main Flash memory block. It contains the application program and user data if necessary.
- • The information block. It is composed of three parts:
- – Option bytes for hardware and memory protection user configuration.
- – System memory that contains the ST proprietary code.
- – OTP (one-time programmable) area
The Flash interface implements instruction access and data access based on the AHB protocol. It also implements the logic necessary to carry out the Flash memory operations
(program/erase) controlled through the Flash registers Refer to Section 3: Embedded Flash memory (FLASH) for more details.
2.6 Boot configuration
2.6.1 Boot configuration
Three different boot modes can be selected through the BOOT0 pin or the nBOOT0 bit into the FLASH_OPTR register (if the nSWBOOT0 bit is cleared into the FLASH_OPTR register), and nBOOT1 bit in FLASH_OPTR register, as shown in the following table.
Table 4. Boot modes
| nBOOT1 FLASH_OPTR[23] | nBOOT0 FLASH_OPTR[27] | BOOT0 pin PH3 | nSWBOOT0 FLASH_OPTR[26] | Main Flash empty (1) | Boot Memory Space Alias |
|---|---|---|---|---|---|
| X | X | 0 | 1 | 0 | Main Flash memory is selected as boot area |
| X | X | 0 | 1 | 1 | System memory is selected as boot area |
| X | 1 | X | 0 | X | Main Flash memory is selected as boot area |
| 0 | X | 1 | 1 | X | Embedded SRAM1 is selected as boot area |
| 0 | 0 | X | 0 | X | Embedded SRAM1 is selected as boot area |
| 1 | X | 1 | 1 | X | System memory is selected as boot area |
| 1 | 0 | X | 0 | X | System memory is selected as boot area |
- 1. A Flash empty check mechanism is implemented to force the boot from system Flash if the first Flash memory location is not programmed (0xFFFF FFFF) and if the boot selection was configured to boot from the main Flash.
The values on both BOOT0 pin (coming from the pin or the option bit) and nBOOT1 bit are latched upon reset release. It is up to the user to set nBOOT1 and BOOT0 to select the required boot mode.
The BOOT0 pin or user option bit (depending on the nSWBOOT0 bit value in the FLASH_OPTR register), and nBOOT1 bit are also re-sampled when exiting from Standby mode. Consequently, they must be kept in the required Boot mode configuration in Standby mode. After this startup delay has elapsed, the CPU fetches the top-of-stack value from address 0x0000 0000, then starts code execution from the boot memory at 0x0000 0004.
Depending on the selected boot mode, main Flash memory, system memory or SRAM1 is accessible as follows:
- • Boot from main Flash memory: the main Flash memory is aliased in the boot memory space (0x0000 0000), but still accessible from its original memory space
(0x0800 0000). In other words, the Flash memory contents can be accessed starting from address 0x0000 0000 or 0x0800 0000.
- • Boot from system memory: the system memory is aliased in the boot memory space (0x0000 0000), but still accessible from its original memory space (0x1FFF 0000).
- • Boot from the embedded SRAM1: the SRAM1 is aliased in the boot memory space (0x0000 0000), but it is still accessible from its original memory space (0x2000 0000).
PH3/BOOT0 GPIO is configured in:
- • Input mode during the complete reset phase if the option bit nSWBOOT0 is set into the FLASH_OPTR register and then switches automatically in analog mode after reset is released (BOOT0 pin).
- • Input mode from the reset phase to the completion of the option byte loading if the bit nSWBOOT0 is cleared into the FLASH_OPTR register (BOOT0 value coming from the option bit). It switches then automatically to the analog mode even if the reset phase is not complete.
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. When booting from the main Flash memory, the application software can either boot from bank 1 or from bank 2. By default, boot from bank 1 is selected. To select boot from Flash memory bank 2, set the BFB2 bit in the user option bytes. When this bit is set and the boot pins are in the boot from main Flash memory configuration, the device boots from system memory, and the boot loader jumps to execute the user application programmed in Flash memory bank 2. For further details, please refer to AN2606.
Physical remap
Once the boot pins mode is 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 SYSCFG memory remap register (SYSCFG_MEMRMP) in the SYSCFG controller.
The following memories can thus be remapped:
- • Main Flash memory
- • System memory
- • Embedded SRAM1 (192 Kbytes for STM32L4Rxxx and STM32L4Sxxx devices and 128 Kbytes for STM32L4P5xx and STM32L4Q5xx devices)
- • FSMC bank 1 (NOR/PSRAM 1 and 2)
- • OctoSPI (OCTOSPI1 or OSCTOSPI2) memory
Table 5. Memory mapping versus boot mode/physical remap (1)
| Addresses | Boot/remap in main Flash memory | Boot/remap in embedded SRAM 1 | Boot/remap in system memory | Remap in FSMC | Remap in OCTOSPI |
|---|---|---|---|---|---|
| 0x2000 0000 - 0x2002 FFFF | SRAM1 | SRAM1 | SRAM1 | SRAM1 | SRAM1 |
| 0x1FFF 7000 - 0x1FFF FFFF | System memory/OTP/Options bytes | System memory/OTP/Options bytes | System memory/OTP/Options bytes | System memory/OTP/Options bytes | System memory/OTP/Options bytes |
| Addresses | Boot/remap in main Flash memory | Boot/remap in embedded SRAM 1 | Boot/remap in system memory | Remap in FSMC | Remap in OCTOSPI |
|---|---|---|---|---|---|
| 0x1000 8000 - 0x1FFE FFFF | Reserved | Reserved | Reserved | Reserved | Reserved |
| 0x1000 0000 - 0x1000 FFFF | SRAM2 | SRAM2 | SRAM2 | SRAM2 | SRAM2 |
| 0x0820 0000 - 0x0FFF FFFF | Reserved | Reserved | Reserved | Reserved | Reserved |
| 0x0800 0000 - 0x081F FFFF | Flash memory | Flash memory | Flash memory | Flash memory | Flash memory |
| 0x0400 0000 - 0x07FF FFFF | Reserved | Reserved | Reserved | FSMC bank 1 NOR/PSRAM 2 (128 Mbytes) Aliased | OCTOSPI bank (128 Mbytes) Aliased |
| 0x0010 0000 - 0x03FF FFFF | Reserved | Reserved | Reserved | FSMC bank 1 NOR/PSRAM 1 (128 Mbytes) Aliased | OCTOSPI bank (128 Mbytes) Aliased |
| 0x0000 0000 - 0x001F FFFF (2) (3) | Flash (2 Mbytes) (4) Aliased | SRAM1 (192 Kbytes) (5) Aliased | System memory (28 Kbytes) Aliased | FSMC bank 1 NOR/PSRAM 1 (128 Mbytes) Aliased | OCTOSPI bank (128 Mbytes) Aliased |
- 1. Reserved areas highlighted in gray.
- 2. When the FSMC is remapped at address 0x0000 0000, only the first two regions of bank 1 memory controller (bank 1 NOR/PSRAM 1 and NOR/PSRAM 2) can be remapped. When the OCTOSPI is remapped at address 0x0000 0000, only 128 Mbytes are remapped. In remap mode, the CPU can access the external memory via ICode bus instead of system bus, which boosts up the performance.
- 3. Even when aliased in the boot memory space, the related memory is still accessible at its original memory space.
- 4. 2 Mbytes for STM32L4Rxxx and STM32L4Sxxx devices and 1 Mbyte for STM32L4P5xx and STM32L4Q5xx devices.
- 5. 192 Kbytes for STM32L4Rxxx and STM32L4Sxxx devices and 128 Kbytes for STM32L4P5xx and STM32L4Q5xx devices.
Embedded boot loader
The embedded boot loader is located in the system memory, programmed by ST during production. Refer to AN2606 STM32 microcontroller system memory boot mode.