11. Flexible static memory controller (FSMC)
11.1 Introduction
The flexible static memory controller (FSMC) includes one memory controller:
- • The NOR/PSRAM memory controller
11.2 FSMC main features
The FSMC functional block makes the interface with: synchronous and asynchronous static memories. Its main purposes are:
- • to translate AHB transactions into the appropriate external device protocol
- • to meet the access time requirements of the external memory devices
All external memories share the addresses, data and control signals with the controller. Each external device is accessed by means of a unique chip select. The FSMC performs only one access at a time to an external device.
The main features of the FSMC controller are the following:
- • Interface with static-memory mapped devices including:
- – Static random access memory (SRAM)
- – NOR flash memory/OneNAND flash memory
- – PSRAM (4 memory banks)
- • Interface with parallel LCD modules, supporting Intel 8080 and Motorola 6800 modes.
- • Burst mode support for faster access to synchronous devices such as NOR flash memory, PSRAM)
- • Programmable continuous clock output for asynchronous and synchronous accesses
- • 8-,16-bit wide data bus
- • Independent chip select control for each memory bank
- • Independent configuration for each memory bank
- • Write enable and byte lane select outputs for use with PSRAM, SRAM devices
- • External asynchronous wait control
- • Write FIFO with 16 x32-bit depth
The Write FIFO is common to all memory controllers and consists of:
- • a Write Data FIFO which stores the AHB data to be written to the memory (up to 32 bits) plus one bit for the AHB transfer (burst or not sequential mode)
- • a Write Address FIFO which stores the AHB address (up to 28 bits) plus the AHB data size (up to 2 bits). When operating in burst mode, only the start address is stored except when crossing a page boundary (for PSRAM). In this case, the AHB burst is broken into two FIFO entries.
The Write FIFO can be disabled by setting the WFDIS bit in the FSMC_BCR1 register.
At startup the FSMC pins must be configured by the user application. The FSMC I/O pins which are not used by the application can be used for other purposes.
The FSMC registers that define the external device type and associated characteristics are usually set at boot time and do not change until the next reset or power-up. However, the settings can be changed at any time.
11.3 FMC block diagram
The FSMC consists of the following main blocks:
- • The AHB interface (including the FSMC configuration registers)
- • The NOR flash/PSRAM/SRAM controller
The block diagram is shown in the figure below.
Figure 31. FSMC block diagram
![Figure 31. FSMC block diagram. The diagram shows the internal structure of the FSMC. On the left, an AHB interface connects to 'Configuration registers' and a 'NOR/PSRAM memory controller'. The AHB interface receives 'From clock controller HCLK' and sends 'FSMC interrupts to NVIC'. A double-headed arrow indicates bidirectional data flow between the AHB interface and the internal blocks. On the right, the 'NOR/PSRAM memory controller' outputs various signals to external devices: 'FSMC_NL (or NADV)' and 'FSMC_CLK' (labeled as NOR/PSRAM signals); 'FSMC_NBL[1:0]' (labeled as NOR / PSRAM / SRAM shared signals); 'FSMC_A[25:0]' and 'FSMC_D[15:0]' (labeled as Shared signals); and 'FSMC_NE[4:1]', 'FSMC_NOE', 'FSMC_NWE', and 'FSMC_NWAIT' (labeled as NOR / PSRAM / SRAM shared signals). The signal names are in small boxes with arrows pointing to them from the controller block. A reference code 'MSV39279V2' is in the bottom right corner.](/RM0402-STM32F412/7c09b2c099146ec401150512fbd5e3b1_img.jpg)
11.4 AHB interface
The AHB slave interface allows internal CPUs and other bus master peripherals to access the external memories.
AHB transactions are translated into the external device protocol. In particular, if the selected external memory is 16- or 8-bit wide, 32-bit wide transactions on the AHB are split into consecutive 16- or 8-bit accesses. The FSMC chip select (FSMC_NEx) does not toggle between the consecutive accesses except in case of Access mode D when the Extended mode is enabled.
The FSMC generates an AHB error in the following conditions:
- • When reading or writing to a FSMC bank (Bank 1 to 4) which is not enabled.
- • When reading or writing to the NOR flash bank while the FACEN bit is reset in the FSMC_BCRx register.
The effect of an AHB error depends on the AHB master which has attempted the R/W access:
- • If the access has been attempted by the Cortex ® -M4 with FPU CPU, a hard fault interrupt is generated.
- • If the access has been performed by a DMA controller, a DMA transfer error is generated and the corresponding DMA channel is automatically disabled.
The AHB clock (HCLK) is the reference clock for the FSMC.
11.4.1 Supported memories and transactions
General transaction rules
The requested AHB transaction data size can be 8-, 16- or 32-bit wide whereas the accessed external device has a fixed data width. This may lead to inconsistent transfers.
Therefore, some simple transaction rules must be followed:
- • AHB transaction size and memory data size are equal
There is no issue in this case.
- • AHB transaction size is greater than the memory size:
In this case, the FSMC splits the AHB transaction into smaller consecutive memory accesses to meet the external data width. The FSMC chip select (FSMC_NEx) does not toggle between the consecutive accesses.
- • AHB transaction size is smaller than the memory size:
The transfer may or not be consistent depending on the type of external device:
- – Accesses to devices that have the byte select feature (SRAM, ROM, PSRAM)
In this case, the FSMC allows read/write transactions and accesses to the right data through its byte lanes NBL[1:0].
Bytes to be written are addressed by NBL[1:0].
All memory bytes are read (NBL[1:0] are driven low during read transaction) and the useless ones are discarded.
- – Accesses to devices that do not have the byte select feature (NOR)
This situation occurs when a byte access is requested to a 16-bit wide flash memory. Since the device cannot be accessed in Byte mode (only 16-bit words can be read/written from/to the flash memory), Write transactions and Read transactions are allowed (the controller reads the entire 16-bit memory word and uses only the required byte).
Wrap support for NOR flash/PSRAM
Wrap burst mode for synchronous memories is not supported. The memories must be configured in Linear burst mode of undefined length.
Configuration registers
The FSMC can be configured through a set of registers. Refer to Section 11.6.6 , for a detailed description of the NOR flash/PSRAM controller registers.
11.5 External device address mapping
From the FSMC point of view, the external memory is divided into fixed-size banks of 256 Mbytes each (see Figure 32 ):
- • Bank 1 used to address up to 4 NOR flash memory or PSRAM devices. This bank is split into 4 NOR/PSRAM subbanks with 4 dedicated chip selects, as follows:
- – Bank 1 - NOR/PSRAM 1
- – Bank 1 - NOR/PSRAM 2
- – Bank 1 - NOR/PSRAM 3
- – Bank 1 - NOR/PSRAM 4
- • Bank 3 used to address NAND flash memory devices. The MPU memory attribute for this space must be reconfigured by software to Device.
For each bank the type of memory to be used can be configured by the user application through the Configuration register.
Figure 32. FSMC memory banks

| Address | Bank | Supported memory type |
|---|---|---|
| 0x6000 0000 | Bank 1 4 x 64 MB | NOR/PSRAM/SRAM |
| 0x6FFF FFFF |
MS34476V1
11.5.1 NOR/PSRAM address mapping
HADDR[27:26] bits are used to select one of the four memory banks as shown in Table 42 .
Table 42. NOR/PSRAM bank selection
| HADDR[27:26] (1) | Selected bank |
|---|---|
| 00 | Bank 1 - NOR/PSRAM 1 |
| 01 | Bank 1 - NOR/PSRAM 2 |
| 10 | Bank 1 - NOR/PSRAM 3 |
| 11 | Bank 1 - NOR/PSRAM 4 |
1. HADDR are internal AHB address lines that are translated to external memory.
The HADDR[25:0] bits contain the external memory address. Since HADDR is a byte address whereas the memory is addressed at word level, the address actually issued to the memory varies according to the memory data width, as shown in the following table.
Table 43. NOR/PSRAM External memory address
| Memory width (1) | Data address issued to the memory | Maximum memory capacity (bits) |
|---|---|---|
| 8-bit | HADDR[25:0] | 64 Mbytes x 8 = 512 Mbits |
| 16-bit | HADDR[25:1] >> 1 | 64 Mbytes/2 x 16 = 512 Mbits |
- 1. In case of a 16-bit external memory width, the FSMC internally uses HADDR[25:1] to generate the address for external memory FSMC_A[24:0]. Whatever the external memory width, FSMC_A[0] must be connected to external memory address A[0].
11.6 NOR flash/PSRAM controller
The FSMC generates the appropriate signal timings to drive the following types of memories:
- • Asynchronous SRAM and ROM
- – 8 bits
- – 16 bits
- • PSRAM (CellularRAM™)
- – Asynchronous mode
- – Burst mode for synchronous accesses
- – Multiplexed or non-multiplexed
- • NOR flash memory
- – Asynchronous mode
- – Burst mode for synchronous accesses
- – Multiplexed or non-multiplexed
The FSMC outputs a unique chip select signal, NE[4:1], per bank. All the other signals (addresses, data and control) are shared.
The FSMC supports a wide range of devices through a programmable timings among which:
- • Programmable wait states (up to 15)
- • Programmable bus turnaround cycles (up to 15)
- • Programmable output enable and write enable delays (up to 15)
- • Independent read and write timings and protocol to support the widest variety of memories and timings
- • Programmable continuous clock (FSMC_CLK) output.
The FSMC Clock (FSMC_CLK) is a submultiple of the HCLK clock. It can be delivered to the selected external device either during synchronous accesses only or during asynchronous and synchronous accesses depending on the CCKEN bit configuration in the FSMC_BCR1 register:
- • If the CCKEN bit is reset, the FSMC generates the clock (CLK) only during synchronous accesses (Read/write transactions).
- • If the CCKEN bit is set, the FSMC generates a continuous clock during asynchronous and synchronous accesses. To generate the FSMC_CLK continuous clock, Bank 1 must be configured in Synchronous mode (see Section 11.6.6: NOR/PSRAM controller registers ). Since the same clock is used for all synchronous memories, when a continuous output clock is generated and synchronous accesses are performed, the AHB data size has to be the same as the memory data width (MWID) otherwise the FSMC_CLK frequency is changed depending on AHB data transaction (refer to Section 11.6.5: Synchronous transactions for FSMC_CLK divider ratio formula).
The size of each bank is fixed and equal to 64 Mbytes. Each bank is configured through dedicated registers (see Section 11.6.6: NOR/PSRAM controller registers ).
The programmable memory parameters include access times (see Table 44 ) and support for wait management (for PSRAM and NOR flash accessed in Burst mode).
Table 44. Programmable NOR/PSRAM access parameters
| Parameter | Function | Access mode | Unit | Min. | Max. |
|---|---|---|---|---|---|
| Address setup | Duration of the address setup phase | Asynchronous | AHB clock cycle (HCLK) | 0 | 15 |
| Address hold | Duration of the address hold phase | Asynchronous, muxed I/Os | AHB clock cycle (HCLK) | 1 | 15 |
| Data setup | Duration of the data setup phase | Asynchronous | AHB clock cycle (HCLK) | 1 | 256 |
| Bust turn | Duration of the bus turnaround phase | Asynchronous and synchronous read / write | AHB clock cycle (HCLK) | 0 | 15 |
| Clock divide ratio | Number of AHB clock cycles (HCLK) to build one memory clock cycle (CLK) | Synchronous | AHB clock cycle (HCLK) | 2 | 16 |
| Data latency | Number of clock cycles to issue to the memory before the first data of the burst | Synchronous | Memory clock cycle (CLK) | 2 | 17 |
11.6.1 External memory interface signals
Table 45 , Table 46 and Table 47 list the signals that are typically used to interface with NOR flash memory, SRAM and PSRAM.
Note: The prefix “N” identifies the signals that are active low.
NOR flash memory, non-multiplexed I/Os
Table 45. Non-multiplexed I/O NOR flash memory
| FSMC signal name | I/O | Function |
|---|---|---|
| CLK | O | Clock (for synchronous access) |
| A[25:0] | O | Address bus |
| D[15:0] | I/O | Bidirectional data bus |
| NE[x] | O | Chip select, x = 1..4 |
| NOE | O | Output enable |
| NWE | O | Write enable |
| NL(=NADV) | O | Latch enable (this signal is called address valid, NADV, by some NOR flash devices) |
| NWAIT | I | NOR flash wait input signal to the FSMC |
The maximum capacity is 512 Mbits (26 address lines).
NOR flash memory, 16-bit multiplexed I/Os Table 46. 16-bit multiplexed I/O NOR flash memory| FSMC signal name | I/O | Function |
|---|---|---|
| CLK | O | Clock (for synchronous access) |
| A[25:16] | O | Address bus |
| AD[15:0] | I/O | 16-bit multiplexed, bidirectional address/data bus (the 16-bit address A[15:0] and data D[15:0] are multiplexed on the databus) |
| NE[x] | O | Chip select, x = 1..4 |
| NOE | O | Output enable |
| NWE | O | Write enable |
| NL(=NADV) | O | Latch enable (this signal is called address valid, NADV, by some NOR flash devices) |
| NWAIT | I | NOR flash wait input signal to the FSMC |
The maximum capacity is 512 Mbits.
PSRAM/SRAM, non-multiplexed I/Os Table 47. Non-multiplexed I/Os PSRAM/SRAM| FSMC signal name | I/O | Function |
|---|---|---|
| CLK | O | Clock (only for PSRAM synchronous access) |
| A[25:0] | O | Address bus |
| D[15:0] | I/O | Data bidirectional bus |
| NE[x] | O | Chip select, x = 1..4 (called NCE by PSRAM (CellularRAM™ i.e. CRAM)) |
| NOE | O | Output enable |
| NWE | O | Write enable |
| NL(= NADV) | O | Address valid only for PSRAM input (memory signal name: NADV) |
| NWAIT | I | PSRAM wait input signal to the FSMC |
| NBL[1:0] | O | Byte lane output. Byte 0 and Byte 1 control (upper and lower byte enable) |
The maximum capacity is 512 Mbits.
PSRAM, 16-bit multiplexed I/Os Table 48. 16-Bit multiplexed I/O PSRAM| FSMC signal name | I/O | Function |
|---|---|---|
| CLK | O | Clock (for synchronous access) |
| A[25:16] | O | Address bus |
Table 48. 16-Bit multiplexed I/O PSRAM (continued)
| FSMC signal name | I/O | Function |
|---|---|---|
| AD[15:0] | I/O | 16-bit multiplexed, bidirectional address/data bus (the 16-bit address A[15:0] and data D[15:0] are multiplexed on the databus) |
| NE[x] | O | Chip select, x = 1..4 (called NCE by PSRAM (CellularRAM™ i.e. CDRAM)) |
| NOE | O | Output enable |
| NWE | O | Write enable |
| NL(= NADV) | O | Address valid PSRAM input (memory signal name: NADV) |
| NWAIT | I | PSRAM wait input signal to the FSMC |
| NBL[1:0] | O | Byte lane output. Byte 0 and Byte 1 control (upper and lower byte enable) |
The maximum capacity is 512 Mbits (26 address lines).
11.6.2 Supported memories and transactions
Table 49 below shows an example of the supported devices, access modes and transactions when the memory data bus is 16-bit wide for NOR flash memory, PSRAM and SRAM. The transactions not allowed (or not supported) by the FSMC are shown in gray in this example.
Table 49. NOR flash/PSRAM: example of supported memories and transactions
| Device | Mode | R/W | AHB data size | Memory data size | Allowed/not allowed | Comments |
|---|---|---|---|---|---|---|
| NOR flash (muxed I/Os and nonmuxed I/Os) | Asynchronous | R | 8 | 16 | Y | - |
| Asynchronous | W | 8 | 16 | N | - | |
| Asynchronous | R | 16 | 16 | Y | - | |
| Asynchronous | W | 16 | 16 | Y | - | |
| Asynchronous | R | 32 | 16 | Y | Split into 2 FSMC accesses | |
| Asynchronous | W | 32 | 16 | Y | Split into 2 FSMC accesses | |
| Asynchronous page | R | - | 16 | N | Mode is not supported | |
| Synchronous | R | 8 | 16 | N | - | |
| Synchronous | R | 16 | 16 | Y | - | |
| Synchronous | R | 32 | 16 | Y | - |
| Device | Mode | R/W | AHB data size | Memory data size | Allowed/not allowed | Comments |
|---|---|---|---|---|---|---|
| PSRAM (multiplexed I/Os and non-multiplexed I/Os) | Asynchronous | R | 8 | 16 | Y | - |
| Asynchronous | W | 8 | 16 | Y | Use of byte lanes NBL[1:0] | |
| Asynchronous | R | 16 | 16 | Y | - | |
| Asynchronous | W | 16 | 16 | Y | - | |
| Asynchronous | R | 32 | 16 | Y | Split into 2 FSMC accesses | |
| Asynchronous | W | 32 | 16 | Y | Split into 2 FSMC accesses | |
| Asynchronous page | R | - | 16 | N | Mode is not supported | |
| Synchronous | R | 8 | 16 | N | - | |
| Synchronous | R | 16 | 16 | Y | - | |
| Synchronous | R | 32 | 16 | Y | - | |
| Synchronous | W | 8 | 16 | Y | Use of byte lanes NBL[1:0] | |
| Synchronous | W | 16/32 | 16 | Y | - | |
| SRAM and ROM | Asynchronous | R | 8 / 16 | 16 | Y | - |
| Asynchronous | W | 8 / 16 | 16 | Y | Use of byte lanes NBL[1:0] | |
| Asynchronous | R | 32 | 16 | Y | Split into 2 FSMC accesses | |
| Asynchronous | W | 32 | 16 | Y | Split into 2 FSMC accesses Use of byte lanes NBL[1:0] |
11.6.3 General timing rules
Signals synchronization
- All controller output signals change on the rising edge of the internal clock (HCLK)
- In Synchronous mode (read or write), all output signals change on the rising edge of HCLK. Whatever the CLKDIV value, all outputs change as follows:
- NOEL/NWEL/ NEL/NADVL/ NADVH /NBLL/ Address valid outputs change on the falling edge of FSMC_CLK clock.
- NOEH/ NWEH / NEH/ NOEH/NBLH/ Address invalid outputs change on the rising edge of FSMC_CLK clock.
11.6.4 NOR flash/PSRAM controller asynchronous transactions
Asynchronous static memories (NOR flash, PSRAM, SRAM)
- Signals are synchronized by the internal clock HCLK. This clock is not issued to the memory
- • The FSMC always samples the data before de-asserting the NOE signal. This guarantees that the memory data hold timing constraint is met (minimum Chip Enable high to data transition is usually 0 ns)
- • If the Extended mode is enabled (EXTMOD bit is set in the FSMC_BCRx register), up to four extended modes (A, B, C and D) are available. It is possible to mix A, B, C and D modes for read and write operations. For example, read operation can be performed in mode A and write in mode B.
- • If the Extended mode is disabled (EXTMOD bit is reset in the FSMC_BCRx register), the FSMC can operate in mode 1 or mode 2 as follows:
- – Mode 1 is the default mode when SRAM/PSRAM memory type is selected (MTYP = 0x0 or 0x01 in the FSMC_BCRx register)
- – Mode 2 is the default mode when NOR memory type is selected (MTYP = 0x10 in the FSMC_BCRx register).
Mode 1 - SRAM/PSRAM (CRAM)
The next figures show the read and write transactions for the supported modes followed by the required configuration of FSMC_BCRx, and FSMC_BTRx/FSMC_BWTRx registers.
Figure 33. Mode 1 read access waveforms

The diagram illustrates the timing for a Mode 1 read access. It shows the following signals over time:
- A[25:0] : Address lines, which are stable during the memory transaction.
- NBL[1:0] : Non-Bound Cycle lines, which are active low and stable during the transaction.
- NEx : Chip Enable signal, which is active low and goes low at the start of the transaction and high at the end.
- NOE : Output Enable signal, which is active low and goes low at the start of the transaction and high at the end.
- NWE : Write Enable signal, which is high (inactive) during the read transaction.
- D[15:0] : Data lines, which are initially in a high-impedance state and become "data driven by memory" during the DATAST period.
The transaction is divided into two main phases by vertical dashed lines:
- ADDSET : Address setup time in HCLK cycles, from the start of the transaction to the start of the data phase.
- DATAST : Data setup time in HCLK cycles, from the start of the data phase to the end of the transaction.
A horizontal double-headed arrow at the top indicates the total "Memory transaction" duration. The identifier MS34477V1 is located in the bottom right corner.
Figure 34. Mode 1 write access waveforms
![Timing diagram for Mode 1 write access waveforms showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the relationship between address, data, and control signals during a write transaction, including setup and hold times relative to the HCLK signal.](/RM0402-STM32F412/a0e9aa286381635ec01af42942a05c89_img.jpg)
The diagram illustrates the timing for a Mode 1 write access. The signals shown are:
- A[25:0] : Address lines, stable during the transaction.
- NBL[1:0] : Byte Lane signals, active low.
- NEx : External memory write enable, active low.
- NOE : Output Enable, active low.
- NWE : Write Enable, active low. It is driven by the FSMC.
- D[15:0] : Data lines, driven by the FSMC.
- Memory transaction : The overall duration from the start of the address/data phase to the end of the data phase.
- ADDSET : Address and data setup time before the falling edge of NWE, measured in HCLK cycles.
- (DATAST + 1) : Data hold time after the rising edge of NWE, measured in HCLK cycles.
- 1HCLK : One system clock cycle.
The one HCLK cycle at the end of the write transaction helps guarantee the address and data hold time after the NWE rising edge. Due to the presence of this HCLK cycle, the DATAST value must be greater than zero (DATAST > 0).
Table 50. FSMC_BCRx bitfields (mode 1)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLEN | As needed |
| 19 | CBURSTRW | 0x0 (no effect in Asynchronous mode) |
| 18:16 | CPSIZE | 0x0 (no effect in Asynchronous mode) |
| 15 | ASYNCWAIT | Set to 1 if the memory supports this feature. Otherwise keep at 0. |
| 14 | EXTMOD | 0x0 |
| 13 | WAITEN | 0x0 (no effect in Asynchronous mode) |
| 12 | WREN | As needed |
| 11 | Reserved | 0x0 |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | Meaningful only if bit 15 is 1 |
| 8 | BURSTEN | 0x0 |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | Don't care |
| Bit number | Bit name | Value to set |
|---|---|---|
| 5:4 | MWID | As needed |
| 3:2 | MTYP | As needed, exclude 0x2 (NOR flash memory) |
| 1 | MUXE | 0x0 |
| 0 | MBKEN | 0x1 |
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | Don't care |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST+1 HCLK cycles for write accesses, DATAST HCLK cycles for read accesses). |
| 7:4 | ADDHLD | Don't care |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles). Minimum value for ADDSET is 0. |
Mode A - SRAM/PSRAM (CRAM) OE toggling
Figure 35. Mode A read access waveforms
![Timing diagram for Mode A read access waveforms showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the sequence of address, data, and control signals during a read operation, with ADDSET and DATAST timing parameters.](/RM0402-STM32F412/6ce0ee9d168302149dfd7dc96b5b0815_img.jpg)
The diagram illustrates the timing for a read access in Mode A. The signals shown are:
- A[25:0] : Address lines, stable during the transaction.
- NBL[1:0] : Byte Lane signals, driven low during the read access.
- NEx : Address Valid signal, goes low at the start and high at the end of the transaction.
- NOE : Output Enable signal, goes low to enable data output and high to disable it.
- NWE : Write Enable signal, held high during read access.
- D[15:0] : Data lines, driven by memory during the DATAST period.
Timing parameters are defined as:
- ADDSET : Number of HCLK cycles from the start of the transaction to the start of the data phase.
- DATAST : Number of HCLK cycles for which data is driven by memory.
Reference: MS34479V1
- 1. NBL[1:0] are driven low during the read access
Figure 36. Mode A write access waveforms
![Timing diagram for Mode A write access waveforms showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the sequence of address, data, and control signals during a write operation, with ADDSET and (DATAST + 1) timing parameters.](/RM0402-STM32F412/5aa1cd760b10be98b0d6209fe03d0af5_img.jpg)
The diagram illustrates the timing for a write access in Mode A. The signals shown are:
- A[25:0] : Address lines, stable during the transaction.
- NBL[1:0] : Byte Lane signals, driven low during the write access.
- NEx : Address Valid signal, goes low at the start and high at the end of the transaction.
- NOE : Output Enable signal, goes high at the start and low at the end of the transaction.
- NWE : Write Enable signal, goes low to enable data input and high to disable it.
- D[15:0] : Data lines, driven by FSMC during the (DATAST + 1) period.
Timing parameters are defined as:
- ADDSET : Number of HCLK cycles from the start of the transaction to the start of the data phase.
- (DATAST + 1) : Number of HCLK cycles for which data is driven by FSMC.
- 1HCLK : One HCLK cycle duration.
Reference: MS34480V1
The differences compared with Mode 1 are the toggling of NOE and the independent read and write timings.
Table 52. FSMC_BCRx bitfields (mode A)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLKEN | As needed |
| 19 | CBURSTRW | 0x0 (no effect in Asynchronous mode) |
| 18:16 | CPSIZE | 0x0 (no effect in Asynchronous mode) |
| 15 | ASYNCWAIT | Set to 1 if the memory supports this feature. Otherwise keep at 0. |
| 14 | EXTMOD | 0x1 |
| 13 | WAITEN | 0x0 (no effect in Asynchronous mode) |
| 12 | WREN | As needed |
| 11 | WAITCFG | Don't care |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | Meaningful only if bit 15 is 1 |
| 8 | BURSTEN | 0x0 |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | Don't care |
| 5:4 | MWID | As needed |
| 3:2 | MTYP | As needed, exclude 0x2 (NOR flash memory) |
| 1 | MUXEN | 0x0 |
| 0 | MBKEN | 0x1 |
Table 53. FSMC_BTRx bitfields (mode A)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x0 |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST HCLK cycles) for read accesses. |
| 7:4 | ADDHLD | Don't care |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles) for read accesses. Minimum value for ADDSET is 0. |
Table 54. FSMC_BWTRx bitfields (mode A)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x0 |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST HCLK cycles) for write accesses. |
| 7:4 | ADDHLD | Don't care |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles) for write accesses. Minimum value for ADDSET is 0. |
Mode 2/B - NOR flash
Figure 37. Mode 2 and mode B read access waveforms
![Timing diagram for Mode 2 and mode B read access waveforms showing address (A[25:0]), NADV, NEx, NOE, NWE, and data (D[15:0]) signals over time. The diagram illustrates the ADDSET and DATAST phases in HCLK cycles.](/RM0402-STM32F412/2541422d36942fe5cd5185568cd418b4_img.jpg)
The timing diagram shows the following signals and phases:
- A[25:0]: Address lines, stable during the memory transaction.
- NADV: Address Valid signal, goes low at the start and high at the end of the transaction.
- NEx: Address and data latching signal, goes low at the start and high at the end.
- NOE: Output Enable signal, goes low to enable data output and high to disable it.
- NWE: Write Enable signal, held high throughout the read transaction.
- D[15:0]: Data lines, which are tri-stated and then driven by memory during the DATAST phase.
- Memory transaction: The overall duration from the falling edge of NADV to the rising edge of NEx.
- ADDSET: The first access phase duration in HCLK cycles, from the falling edge of NADV to a vertical dashed line.
- DATAST: The second access phase duration in HCLK cycles, from the vertical dashed line to the rising edge of NEx.
MS34481V2
Figure 38. Mode 2 write access waveforms
![Timing diagram for Mode 2 write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over a memory transaction. The diagram includes timing parameters ADDSET, (DATAST + 1), and 1HCLK.](/RM0402-STM32F412/0d96711346633d5367c3937cf0cd29eb_img.jpg)
This timing diagram illustrates the Mode 2 write access waveforms. The signals shown are address lines A[25:0], address strobe NADV, next address signal NEx, output enable NOE, write enable NWE, and data lines D[15:0]. The memory transaction is divided into two phases: address setup (ADDSET HCLK cycles) and data drive (DATAST + 1 HCLK cycles). The data is driven by the FMC. The NWE signal is active-low and toggles. The NOE signal is active-low and remains high during the write transaction. The NEx signal is active-low and remains low throughout the transaction. The NADV signal is active-low and goes low at the start of the address setup phase and returns high at the start of the data drive phase. The address lines A[25:0] are stable during the address setup phase. The data lines D[15:0] are driven by the FMC during the data drive phase. The timing parameter 1HCLK represents one HCLK cycle.
MS34482V2
Figure 39. Mode B write access waveforms
![Timing diagram for Mode B write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over a memory transaction. The diagram includes timing parameters ADDSET, (DATAST + 1), and 1HCLK.](/RM0402-STM32F412/ec3035021c1ab7f0ace44ed0bf2fd00a_img.jpg)
This timing diagram illustrates the Mode B write access waveforms. The signals shown are address lines A[25:0], address strobe NADV, next address signal NEx, output enable NOE, write enable NWE, and data lines D[15:0]. The memory transaction is divided into two phases: address setup (ADDSET HCLK cycles) and data drive (DATAST + 1 HCLK cycles). The data is driven by the FSMC. The NWE signal is active-low and toggles. The NOE signal is active-low and remains high during the write transaction. The NEx signal is active-low and remains low throughout the transaction. The NADV signal is active-low and goes low at the start of the address setup phase and returns high at the start of the data drive phase. The address lines A[25:0] are stable during the address setup phase. The data lines D[15:0] are driven by the FSMC during the data drive phase. The timing parameter 1HCLK represents one HCLK cycle.
MSV40114V1
The differences with mode 1 are the toggling of NWE and the independent read and write timings when extended mode is set (mode B).
Table 55. FSMC_BCRx bitfields (mode 2/B)| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLKEN | As needed |
| 19 | CBURSTRW | 0x0 (no effect in Asynchronous mode) |
| 18:16 | CPSIZE | 0x0 (no effect in Asynchronous mode) |
| 15 | ASYNCWAIT | Set to 1 if the memory supports this feature. Otherwise keep at 0. |
| 14 | EXTMOD | 0x1 for mode B, 0x0 for mode 2 |
| 13 | WAITEN | 0x0 (no effect in Asynchronous mode) |
| 12 | WREN | As needed |
| 11 | WAITCFG | Don't care |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | Meaningful only if bit 15 is 1 |
| 8 | BURSTEN | 0x0 |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | 0x1 |
| 5:4 | MWID | As needed |
| 3:2 | MTYP | 0x2 (NOR flash memory) |
| 1 | MUXEN | 0x0 |
| 0 | MBKEN | 0x1 |
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x1 if Extended mode is set |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the access second phase (DATAST HCLK cycles) for read accesses. |
| 7:4 | ADDHLD | Don't care |
| 3:0 | ADDSET | Duration of the access first phase (ADDSET HCLK cycles) for read accesses. Minimum value for ADDSET is 0. |
Table 57. FSMC_BWTRx bitfields (mode 2/B)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x1 if Extended mode is set |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the access second phase (DATAST HCLK cycles) for write accesses. |
| 7:4 | ADDHLD | Don't care |
| 3:0 | ADDSET | Duration of the access first phase (ADDSET HCLK cycles) for write accesses. Minimum value for ADDSET is 0. |
Note: The FSMC_BWTRx register is valid only if the Extended mode is set (mode B), otherwise its content is don't care.
Mode C - NOR flash - OE toggling
Figure 40. Mode C read access waveforms
![Timing diagram for Mode C read access waveforms. The diagram shows the relationship between address (A[25:0]), address strobe (NADV), chip select (NEx), output enable (NOE), write enable (NWE), and data (D[15:0]) signals during a memory transaction. The transaction is divided into two phases: ADDSET (first phase) and DATAST (second phase), measured in HCLK cycles. The data is driven by memory during the DATAST phase.](/RM0402-STM32F412/87e8ed718d3e554105902a1e0938b767_img.jpg)
The diagram illustrates the timing for a Mode C read access. The signals shown are:
- A[25:0] : Address lines, stable during the memory transaction.
- NADV : Address Valid signal, active low, goes low at the start of the transaction and high at the end.
- NEx : Chip Select signal, active low, goes low at the start and high at the end.
- NOE : Output Enable signal, active low, goes low at the start of the DATAST phase and high at the end.
- NWE : Write Enable signal, active low, held high throughout the read transaction.
- D[15:0] : Data lines, which are high-impedance during the ADDSET phase and become "data driven by memory" during the DATAST phase.
The timing parameters are defined as:
- Memory transaction : The total duration from the falling edge of NADV to the rising edge of NADV.
- ADDSET (HCLK cycles) : The duration of the first phase, from the falling edge of NADV to the falling edge of NOE.
- DATAST (HCLK cycles) : The duration of the second phase, from the falling edge of NOE to the rising edge of NOE.
Reference: MS34484V1
Figure 41. Mode C write access waveforms
![Timing diagram for Mode C write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the 'Memory transaction' period, 'ADDSET' time in HCLK cycles, '(DATAST + 1)' time in HCLK cycles, and '1HCLK' cycle duration. Data is shown as 'data driven by FSMC'.](/RM0402-STM32F412/b0d23dcfdb50819a86d4d3087aae4efb_img.jpg)
The diagram shows the timing for a write access in Mode C. The signals shown are address A[25:0], address latch strobe NADV, external memory strobe NEx, output enable NOE, write enable NWE, and data D[15:0]. The 'Memory transaction' starts when A[25:0] is valid and NADV goes low, and ends when NEx goes high. ADDSET is the time from the start of the transaction to when data starts being driven. (DATAST + 1) is the duration for which data is driven. 1HCLK is one clock cycle.
The differences compared with mode 1 are the toggling of NOE and the independent read and write timings.
Table 58. FSMC_BCRx bitfields (mode C)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLKEN | As needed |
| 19 | CBURSTRW | 0x0 (no effect in Asynchronous mode) |
| 18:16 | CPSIZE | 0x0 (no effect in Asynchronous mode) |
| 15 | ASYNCWAIT | Set to 1 if the memory supports this feature. Otherwise keep at 0. |
| 14 | EXTMOD | 0x1 |
| 13 | WAITEN | 0x0 (no effect in Asynchronous mode) |
| 12 | WREN | As needed |
| 11 | WAITCFG | Don't care |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | Meaningful only if bit 15 is 1 |
| 8 | BURSTEN | 0x0 |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | 0x1 |
| 5:4 | MWID | As needed |
| Bit number | Bit name | Value to set |
|---|---|---|
| 3:2 | MTYP | 0x02 (NOR flash memory) |
| 1 | MUXEN | 0x0 |
| 0 | MBKEN | 0x1 |
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x2 |
| 27:24 | DATLAT | 0x0 |
| 23:20 | CLKDIV | 0x0 |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST HCLK cycles) for read accesses. |
| 7:4 | ADDHLD | Don't care |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles) for read accesses. Minimum value for ADDSET is 0. |
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x2 |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST HCLK cycles) for write accesses. |
| 7:4 | ADDHLD | Don't care |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles) for write accesses. Minimum value for ADDSET is 0. |
Mode D - asynchronous access with extended address
Figure 42. Mode D read access waveforms
![Timing diagram for Mode D read access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the memory transaction phases: ADDSET, ADDHLD, and DATAST in HCLK cycles. Data is driven by memory during the DATAST phase.](/RM0402-STM32F412/2a3ef3ec300a515aabd4872bf7a671de_img.jpg)
The diagram shows the timing for a read access in Mode D. The address A[25:0] is stable during the entire memory transaction. NADV and NEx are active-low signals that go low at the start and high at the end of the transaction. NOE is active-low and goes low during the data read phase. NWE is high throughout. The data bus D[15:0] is driven by memory during the DATAST phase. The timing parameters are defined as follows:
- ADDSET : HCLK cycles from the start of the transaction to the start of ADDHLD.
- ADDHLD : HCLK cycles from the start of ADDHLD to the start of DATAST.
- DATAST : HCLK cycles from the start of DATAST to the end of the transaction.
MS34486V1
Figure 43. Mode D write access waveforms
![Timing diagram for Mode D write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the memory transaction phases: ADDSET, ADDHLD, and (DATAST+ 1) in HCLK cycles. Data is driven by FSMC during the (DATAST+ 1) phase.](/RM0402-STM32F412/6a4fba05a6027d178e3450d5019c6ad3_img.jpg)
The diagram shows the timing for a write access in Mode D. The address A[25:0] is stable during the entire memory transaction. NADV and NEx are active-low signals that go low at the start and high at the end of the transaction. NOE is active-low and goes low at the start. NWE is active-low and goes low during the data write phase. The data bus D[15:0] is driven by FSMC during the (DATAST+ 1) phase. The timing parameters are defined as follows:
- ADDSET : HCLK cycles from the start of the transaction to the start of ADDHLD.
- ADDHLD : HCLK cycles from the start of ADDHLD to the start of (DATAST+ 1).
- (DATAST+ 1) : HCLK cycles from the start of (DATAST+ 1) to the end of the transaction.
- 1HCLK : One HCLK cycle duration, shown as the time from the start of (DATAST+ 1) to the start of the next phase.
ai15567
The differences with mode 1 are the toggling of NOE that goes on toggling after NADV changes and the independent read and write timings.
Table 61. FSMC_BCRx bitfields (mode D)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLKEN | As needed |
| 19 | CBURSTRW | 0x0 (no effect in Asynchronous mode) |
| 18:16 | CPSIZE | 0x0 (no effect in Asynchronous mode) |
| 15 | ASYNCWAIT | Set to 1 if the memory supports this feature. Otherwise keep at 0. |
| 14 | EXTMOD | 0x1 |
| 13 | WAITEN | 0x0 (no effect in Asynchronous mode) |
| 12 | WREN | As needed |
| 11 | WAITCFG | Don't care |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | Meaningful only if bit 15 is 1 |
| 8 | BURSTEN | 0x0 |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | Set according to memory support |
| 5:4 | MWID | As needed |
| 3:2 | MTYP | As needed |
| 1 | MUXEN | 0x0 |
| 0 | MBKEN | 0x1 |
Table 62. FSMC_BTRx bitfields (mode D)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x3 |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST HCLK cycles) for read accesses. |
| 7:4 | ADDHLD | Duration of the middle phase of the read access (ADDHLD HCLK cycles) |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles) for read accesses. Minimum value for ADDSET is 1. |
Table 63. FSMC_BWTRx bitfields (mode D)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x3 |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST + 1 HCLK cycles) for write accesses. |
| 7:4 | ADDHLD | Duration of the middle phase of the write access (ADDHLD HCLK cycles) |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles) for write accesses. Minimum value for ADDSET is 1. |
Muxed mode - multiplexed asynchronous access to NOR flash memory
Figure 44. Muxed read access waveforms
![Timing diagram for muxed read access waveforms showing signals A[25:16], NADV, NEx, NOE, NWE, and AD[15:0] over time. The diagram illustrates the 'Memory transaction' period and the durations for ADDSET, ADDHLD, and DATAST in HCLK cycles. Address and data phases are labeled on the AD[15:0] signal line.](/RM0402-STM32F412/f6c4b43ad31eff80ed2096da9b04f5a2_img.jpg)
The diagram shows the timing for a read access in muxed mode. The signals shown are:
- A[25:16] : Address lines, valid during the 'Lower address' phase.
- NADV : Address Valid signal, goes low to indicate valid address.
- NEx : Next address signal, goes low to indicate next address valid.
- NOE : Output Enable signal, goes low to enable data output from memory.
- NWE : Write Enable signal, held high (inactive) for this read access.
- AD[15:0] : Multiplexed address/data lines. They first carry the 'Lower address' and then become 'data driven by memory' when NOE is active.
- ADDSET : Duration of the first access phase in HCLK cycles.
- ADDHLD : Duration of the middle phase in HCLK cycles.
- DATAST : Duration of the second access phase in HCLK cycles.
Figure 45. Muxed write access waveforms
![Timing diagram for Muxed write access waveforms. The diagram shows the relationship between address lines A[25:16], control signals NADV, NEx, NOE, NWE, and data lines AD[15:0] during a memory transaction. The transaction is divided into three phases: ADDSET (HCLK cycles), ADDHLD (HCLK cycles), and (DATAST + 1) (HCLK cycles). The AD[15:0] lines are used for 'Lower address' during ADDSET and 'data driven by FSMC' during the final phase. A 1HCLK cycle is indicated between the start of the data phase and the end of the transaction.](/RM0402-STM32F412/98f85cd434ea3581abe1bf482f7cd1e4_img.jpg)
The difference with mode D is the drive of the lower address byte(s) on the data bus.
Table 64. FSMC_BCRx bitfields (Muxed mode)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLKEN | As needed |
| 19 | CBURSTRW | 0x0 (no effect in Asynchronous mode) |
| 18:16 | CPSIZE | 0x0 (no effect in Asynchronous mode) |
| 15 | ASYNCWAIT | Set to 1 if the memory supports this feature. Otherwise keep at 0. |
| 14 | EXTMOD | 0x0 |
| 13 | WAITEN | 0x0 (no effect in Asynchronous mode) |
| 12 | WREN | As needed |
| 11 | WAITCFG | Don't care |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | Meaningful only if bit 15 is 1 |
| 8 | BURSTEN | 0x0 |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | 0x1 |
| 5:4 | MWID | As needed |
| Bit number | Bit name | Value to set |
|---|---|---|
| 3:2 | MTYP | 0x2 (NOR flash memory) or 0x1(PSRAM) |
| 1 | MUXEN | 0x1 |
| 0 | MBKEN | 0x1 |
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x0 |
| 27:24 | DATLAT | Don't care |
| 23:20 | CLKDIV | Don't care |
| 19:16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15:8 | DATAST | Duration of the second access phase (DATAST HCLK cycles for read accesses and DATAST+1 HCLK cycles for write accesses). |
| 7:4 | ADDHLD | Duration of the middle phase of the access (ADDHLD HCLK cycles). |
| 3:0 | ADDSET | Duration of the first access phase (ADDSET HCLK cycles). Minimum value for ADDSET is 1. |
WAIT management in asynchronous accesses
If the asynchronous memory asserts the WAIT signal to indicate that it is not yet ready to accept or to provide data, the ASYNCWAIT bit has to be set in FSMC_BCRx register.
If the WAIT signal is active (high or low depending on the WAITPOL bit), the second access phase (Data setup phase), programmed by the DATAST bits, is extended until WAIT becomes inactive. Unlike the data setup phase, the first access phases (Address setup and Address hold phases), programmed by the ADDSET and ADDHLD bits, are not WAIT sensitive and so they are not prolonged.
The data setup phase must be programmed so that WAIT can be detected 4 HCLK cycles before the end of the memory transaction. The following cases must be considered:
- 1. The memory asserts the WAIT signal aligned to NOE/NWE which toggles:
- 2. The memory asserts the WAIT signal aligned to NEx (or NOE/NWE not toggling):
if
then:
otherwise
where \( \text{max\_wait\_assertion\_time} \) is the maximum time taken by the memory to assert the WAIT signal once NEx/NOE/NWE is low.
Figure 46 and Figure 47 show the number of HCLK clock cycles that are added to the memory access phase after WAIT is released by the asynchronous memory (independently of the above cases).
Figure 46. Asynchronous wait during a read access waveforms
![Timing diagram for asynchronous wait during a read access. The diagram shows five signal lines: A[25:0] (Address), NEx (Active-low Address Strobe), NWAIT (Active-low Wait signal), NOE (Active-low Output Enable), and D[15:0] (Data). The sequence starts with the address phase where A[25:0] is stable and NEx is asserted. Then the data setup phase begins, where NOE is asserted and data is driven by memory. The NWAIT signal is shown as 'don't care' during the address phase and becomes active (low) during the data setup phase. The data is driven by memory for a duration of 4HCLK cycles. The memory transaction ends when NEx is deasserted. The diagram is labeled MS30463V2.](/RM0402-STM32F412/efcb26b49bd10e98dfaa5a5b704f3ac9_img.jpg)
- 1. NWAIT polarity depends on WAITPOL bit setting in FSMC_BCRx register.
Figure 47. Asynchronous wait during a write access waveforms
![Timing diagram for asynchronous wait during a write access. The diagram shows five signal waveforms over time: A[25:0] (Address), NEx (Next), NWAIT (Wait), NWE (Write Enable), and D[15:0] (Data). The 'Memory transaction' is divided into an 'address phase' and a 'data setup phase'. The NWAIT signal is shown as 'don't care' during the address phase and 'data setup phase'. The data is driven by the FSMC during the data setup phase. The diagram also indicates the relationship between HCLK and 3HCLK.](/RM0402-STM32F412/d489a845358c38eeb263a2a2f09cbf87_img.jpg)
The diagram illustrates the timing for an asynchronous write access. The address A[25:0] is stable during the 'address phase'. The NEx signal is active low. The NWAIT signal is sampled during the 'data setup phase'. The NWE signal is active low. The data D[15:0] is driven by the FSMC during the 'data setup phase'. The HCLK signal is shown, and the 3HCLK period is indicated. The diagram is labeled MS30464V2.
- 1. NWAIT polarity depends on WAITPOL bit setting in FSMC_BCRx register.
11.6.5 Synchronous transactions
The memory clock, FSMC_CLK, is a submultiple of HCLK. It depends on the value of CLKDIV and the MWID/ AHB data size, following the formula given below:
Whatever MWID size: 16 or 8-bit, the FSMC_CLK divider ratio is always defined by the programmed CLKDIV value.
Example:
- • If CLKDIV=1, MWID = 16 bits, AHB data size=8 bits, FSMC_CLK=HCLK/2.
NOR flash memories specify a minimum time from NADV assertion to CLK high. To meet this constraint, the FSMC does not issue the clock to the memory during the first internal clock cycle of the synchronous access (before NADV assertion). This guarantees that the rising edge of the memory clock occurs in the middle of the NADV low pulse.
Data latency versus NOR memory latency
The data latency is the number of cycles to wait before sampling the data. The DATLAT value must be consistent with the latency value specified in the NOR flash configuration register. The FSMC does not include the clock cycle when NADV is low in the data latency count.
Caution: Some NOR flash memories include the NADV Low cycle in the data latency count, so that the exact relation between the NOR flash latency and the FSMC DATLAT parameter can be either:
- • NOR flash latency = (DATLAT + 2) CLK clock cycles
- • or NOR flash latency = (DATLAT + 3) CLK clock cycles
Some recent memories assert NWAIT during the latency phase. In such cases DATLAT can be set to its minimum value. As a result, the FSMC samples the data and waits long enough to evaluate if the data are valid. Thus the FSMC detects when the memory exits latency and real data are processed.
Other memories do not assert NWAIT during latency. In this case the latency must be set correctly for both the FSMC and the memory, otherwise invalid data are mistaken for good data, or valid data are lost in the initial phase of the memory access.
Single-burst transfer
When the selected bank is configured in Burst mode for synchronous accesses, if for example an AHB single-burst transaction is requested on 16-bit memories, the FSMC performs a burst transaction of length 1 (if the AHB transfer is 16 bits), or length 2 (if the AHB transfer is 32 bits) and de-assert the chip select signal when the last data is strobed.
Such transfers are not the most efficient in terms of cycles compared to asynchronous read operations. Nevertheless, a random asynchronous access would first require to re-program the memory access mode, which would altogether last longer.
Cross boundary page for CellularRAM™ 1.5
CellularRAM™ 1.5 does not allow burst access to cross the page boundary. The FSMC controller is used to split automatically the burst access when the memory page size is reached by configuring the CPSIZE bits in the FSMC_BCR1 register following the memory page size.
Wait management
For synchronous NOR flash memories, NWAIT is evaluated after the programmed latency period, which corresponds to (DATLAT+2) CLK clock cycles.
If NWAIT is active (low level when WAITPOL = 0, high level when WAITPOL = 1), wait states are inserted until NWAIT is inactive (high level when WAITPOL = 0, low level when WAITPOL = 1).
When NWAIT is inactive, the data is considered valid either immediately (bit WAITCFG = 1) or on the next clock edge (bit WAITCFG = 0).
During wait-state insertion via the NWAIT signal, the controller continues to send clock pulses to the memory, keeping the chip select and output enable signals valid. It does not consider the data as valid.
In Burst mode, there are two timing configurations for the NOR flash NWAIT signal:
- • The flash memory asserts the NWAIT signal one data cycle before the wait state (default after reset).
- • The flash memory asserts the NWAIT signal during the wait state
The FSMC supports both NOR flash wait state configurations, for each chip select, thanks to the WAITCFG bit in the FSMC_BCRx registers (x = 0..3).
Figure 48. Wait configuration waveforms
![Timing diagram showing wait configuration waveforms for HCLK, CLK, A[25:16], NADV, NWAIT (WAITCFG = 0), NWAIT (WAITCFG = 1), and A/D[15:0]. It illustrates a memory transaction burst of 4 half words with an inserted wait state.](/RM0402-STM32F412/bc8f32e35b54bcc95882d70107c3359b_img.jpg)
The diagram illustrates the timing for a memory transaction, defined as a burst of 4 half words. The signals shown are:
- HCLK : High-frequency system clock.
- CLK : Memory clock, derived from HCLK.
- A[25:16] : Address lines, showing addr[25:16] during the address phase.
- NADV : Address Valid signal, active low.
- NWAIT (WAITCFG = 0) : Wait signal when WAITCFG is 0. It goes low after the address is valid and returns high before the data burst begins.
- NWAIT (WAITCFG = 1) : Wait signal when WAITCFG is 1. It goes low after the address is valid and returns high after the first data word is transferred, effectively inserting a wait state.
- A/D[15:0] : Address/Data lines, showing addr[15:0] during the address phase and data during the data burst phases.
An arrow labeled "inserted wait state" indicates the period between the first and second data words when WAITCFG is 1. The diagram is identified by the code ai15798c.
Figure 49. Synchronous multiplexed read mode waveforms - NOR, PSRAM (CRAM)
![Timing diagram for synchronous multiplexed read mode. It shows signals HCLK, CLK, A[25:16], NEx, NOE, NWE, NADV, NWAIT, and A/D[15:0] over time. A memory transaction is shown as a burst of 4 half words (data1, data2, data3, data4). Addressing starts with addr[25:16] and Add[15:0]. Data strobes are indicated for each data word. An inserted wait state is shown between data1 and data2. The diagram is labeled ai17723g.](/RM0402-STM32F412/4553bcc42c53c361c2af905b5f48ed4c_img.jpg)
- 1. Byte lane outputs (NBL are not shown; for NOR access, they are held high, and, for PSRAM (CRAM) access, they are held low.
Table 66. FSMC_BCRx bitfields (Synchronous multiplexed read mode)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLKEN | As needed |
| 19 | CBURSTRW | No effect on synchronous read |
| 18:16 | CPSIZE | 0x0 (no effect in Asynchronous mode) |
| 15 | ASYNCWAIT | 0x0 |
| 14 | EXTMOD | 0x0 |
| 13 | WAITEN | To be set to 1 if the memory supports this feature, to be kept at 0 otherwise |
| 12 | WREN | No effect on synchronous read |
| Bit number | Bit name | Value to set |
|---|---|---|
| 11 | WAITCFG | To be set according to memory |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | To be set according to memory |
| 8 | BURSTEN | 0x1 |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | Set according to memory support (NOR flash memory) |
| 5-4 | MWID | As needed |
| 3-2 | MTYP | 0x1 or 0x2 |
| 1 | MUXEN | As needed |
| 0 | MBKEN | 0x1 |
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x0 |
| 27-24 | DATLAT | Data latency |
| 27-24 | DATLAT | Data latency |
| 23-20 | CLKDIV | 0x0 to get CLK = HCLK 0x1 to get CLK = 2 × HCLK .. |
| 19-16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15-8 | DATAST | Don't care |
| 7-4 | ADDHLD | Don't care |
| 3-0 | ADDSET | Don't care |
Figure 50. Synchronous multiplexed write mode waveforms - PSRAM (CRAM)
![Timing diagram for synchronous multiplexed write mode waveforms. The diagram shows the relationship between HCLK, CLK, address lines A[25:16] and A/D[15:0], and control signals NEx, NOE, NWE, NADV, and NWAIT. A memory transaction is shown as a burst of 2 half words. The address is latched on the rising edge of CLK. Data1 and data2 are written on the rising edge of CLK. The NWAIT signal is used to insert a wait state. The diagram is labeled ai14731g.](/RM0402-STM32F412/27ea7b167854cf3289bc489cbc1f02fa_img.jpg)
Timing diagram showing waveforms for synchronous multiplexed write mode. The diagram illustrates the relationship between the host clock (HCLK), memory clock (CLK), address lines (A[25:16] and A/D[15:0]), and control signals (NEx, NOE, NWE, NADV, NWAIT). The memory transaction is defined as a burst of 2 half words. The address is latched on the rising edge of CLK. Data1 and data2 are written on the rising edge of CLK. The NWAIT signal is used to insert a wait state. The diagram is labeled ai14731g.
- 1. The memory must issue NWAIT signal one cycle in advance, accordingly WAITCFG must be programmed to 0.
- 2. Byte Lane (NBL) outputs are not shown, they are held low while NEx is active.
Table 68. FSMC_BCRx bitfields (Synchronous multiplexed write mode)
| Bit number | Bit name | Value to set |
|---|---|---|
| 31:22 | Reserved | 0x000 |
| 21 | WFDIS | As needed |
| 20 | CCLKEN | As needed |
| 19 | CBURSTRW | 0x1 |
| 18:16 | CPSIZE | As needed (0x1 for CRAM 1.5) |
| 15 | ASYNCWAIT | 0x0 |
| 14 | EXTMOD | 0x0 |
| 13 | WAITEN | To be set to 1 if the memory supports this feature, to be kept at 0 otherwise. |
| Bit number | Bit name | Value to set |
|---|---|---|
| 12 | WREN | 0x1 |
| 11 | WAITCFG | 0x0 |
| 10 | Reserved | 0x0 |
| 9 | WAITPOL | to be set according to memory |
| 8 | BURSTEN | no effect on synchronous write |
| 7 | Reserved | 0x1 |
| 6 | FACCEN | Set according to memory support |
| 5-4 | MWID | As needed |
| 3-2 | MTYP | 0x1 |
| 1 | MUXEN | As needed |
| 0 | MBKEN | 0x1 |
| Bit number | Bit name | Value to set |
|---|---|---|
| 31-30 | Reserved | 0x0 |
| 29:28 | ACCMOD | 0x0 |
| 27-24 | DATLAT | Data latency |
| 23-20 | CLKDIV | 0x0 to get CLK = HCLK 0x1 to get CLK = 2 × HCLK |
| 19-16 | BUSTURN | Time between NEx high to NEx low (BUSTURN HCLK). |
| 15-8 | DATAST | Don't care |
| 7-4 | ADDHLD | Don't care |
| 3-0 | ADDSET | Don't care |
11.6.6 NOR/PSRAM controller registers
SRAM/NOR-flash chip-select control register for bank x (FSMC_BCRx)
Address offset: \( 0x00 + 0x8 * (x - 1) \) , ( \( x = 1 \) to \( 4 \) )
Reset value: 0x0000 30DB, 0x0000 30D2, 0x0000 30D2, 0x0000 30D2
This register contains the control information of each memory bank, used for SRAMs, PSRAM and NOR flash memories.
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | WFDIS | CCLK EN | CBURST RW | CPSIZE[2:0] | ||
| rw | rw | rw | rw | rw | rw | ||||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| ASYNC WAIT | EXT MOD | WAIT EN | WREN | WAIT CFG | Res. | WAIT POL | BURST EN | Res. | FACC EN | MWID[1:0] | MTYP[1:0] | MUX EN | MBK EN | ||
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | ||
Bits 31:22 Reserved, must be kept at reset value.
Bit 21 WFDIS: Write FIFO disable
This bit disables the Write FIFO used by the FSMC controller.
0: Write FIFO enabled (Default after reset)
1: Write FIFO disabled
Note: The WFDIS bit of the FSMC_BCR2..4 registers is don't care. It is only enabled through the FSMC_BCR1 register.
Bit 20 CCLKEN: Continuous clock enable
This bit enables the FSMC_CLK clock output to external memory devices.
0: The FSMC_CLK is only generated during the synchronous memory access (read/write transaction). The FSMC_CLK clock ratio is specified by the programmed CLKDIV value in the FSMC_BCRx register (default after reset).
1: The FSMC_CLK is generated continuously during asynchronous and synchronous access. The FSMC_CLK clock is activated when the CCLKEN is set.
Note: The CCLKEN bit of the FSMC_BCR2..4 registers is don't care. It is only enabled through the FSMC_BCR1 register. Bank 1 must be configured in Synchronous mode to generate the FSMC_CLK continuous clock.
Note: If CCLKEN bit is set, the FSMC_CLK clock ratio is specified by CLKDIV value in the FSMC_BTR1 register. CLKDIV in FSMC_BWTR1 is don't care.
Note: If the Synchronous mode is used and CCLKEN bit is set, the synchronous memories connected to other banks than Bank 1 are clocked by the same clock (the CLKDIV value in the FSMC_BTR2..4 and FSMC_BWTR2..4 registers for other banks has no effect.)
Bit 19 CBURSTRW: Write burst enable
For PSRAM (CRAM) operating in Burst mode, the bit enables synchronous accesses during write operations. The enable bit for synchronous read accesses is the BURSTEN bit in the FSMC_BCRx register.
0: Write operations are always performed in Asynchronous mode.
1: Write operations are performed in Synchronous mode.
Bits 18:16 CPSIZE[2:0] : CRAM page sizeThese are used for CellularRAM™ 1.5 which does not allow burst access to cross the address boundaries between pages. When these bits are configured, the FSMC controller splits automatically the burst access when the memory page size is reached (refer to memory datasheet for page size).
000: No burst split when crossing page boundary (default after reset)
001: 128 bytes
010: 256 bytes
011: 512 bytes
100: 1024 bytes
Others: Reserved, must not be used
Bit 15 ASYNCWAIT : Wait signal during asynchronous transfersThis bit enables/disables the FSMC to use the wait signal even during an asynchronous protocol.
0: NWAIT signal is not taken in to account when running an asynchronous protocol (default after reset).
1: NWAIT signal is taken in to account when running an asynchronous protocol.
Bit 14 EXTMOD : Extended mode enableThis bit enables the FSMC to program the write timings for non multiplexed asynchronous accesses inside the FSMC_BWTR register, thus resulting in different timings for read and write operations.
0: values inside FSMC_BWTR register are not taken into account (default after reset)
1: values inside FSMC_BWTR register are taken into account
Note: When the Extended mode is disabled, the FSMC can operate in mode 1 or mode 2 as follows:
- – Mode 1 is the default mode when the SRAM/PSRAM memory type is selected (MTYP = 0x0 or 0x01)
- – Mode 2 is the default mode when the NOR memory type is selected (MTYP = 0x10).
This bit enables/disables wait-state insertion via the NWAIT signal when accessing the memory in Synchronous mode.
0: NWAIT signal is disabled (its level not taken into account, no wait state inserted after the programmed flash latency period).
1: NWAIT signal is enabled (its level is taken into account after the programmed latency period to insert wait states if asserted) (default after reset).
Bit 12 WREN : Write enable bitThis bit indicates whether write operations are enabled/disabled in the bank by the FSMC.
0: Write operations are disabled in the bank by the FSMC, an AHB error is reported.
1: Write operations are enabled for the bank by the FSMC (default after reset).
Bit 11 WAITCFG : Wait timing configurationThe NWAIT signal indicates whether the data from the memory are valid or if a wait state must be inserted when accessing the memory in Synchronous mode. This configuration bit determines if NWAIT is asserted by the memory one clock cycle before the wait state or during the wait state:
0: NWAIT signal is active one data cycle before wait state (default after reset).
1: NWAIT signal is active during wait state (not used for PSRAM).
Bit 10 Reserved, must be kept at reset value.
Bit 9 WAITPOL : Wait signal polarity bitDefines the polarity of the wait signal from memory used for either in Synchronous or Asynchronous mode.
0: NWAIT active low (default after reset)
1: NWAIT active high
Bit 8 BURSTEN : Burst enable bit
This bit enables/disables synchronous accesses during read operations. It is valid only for synchronous memories operating in Burst mode.
- 0: Burst mode disabled (default after reset). Read accesses are performed in Asynchronous mode.
- 1: Burst mode enable. Read accesses are performed in Synchronous mode.
Bit 7 Reserved, must be kept at reset value.
Bit 6 FACCEN : Flash access enable
Enables NOR flash memory access operations.
- 0: Corresponding NOR flash memory access is disabled.
- 1: Corresponding NOR flash memory access is enabled (default after reset).
Bits 5:4 MWID[1:0] : Memory data bus width
Defines the external memory device width, valid for all type of memories.
- 00: 8 bits
- 01: 16 bits (default after reset)
- 10: reserved
- 11: reserved
Bits 3:2 MTYP[1:0] : Memory type
Defines the type of external memory attached to the corresponding memory bank.
- 00: SRAM (default after reset for Bank 2...4)
- 01: PSRAM (CRAM)
- 10: NOR flash/OneNAND flash (default after reset for Bank 1)
- 11: reserved
Bit 1 MUXEN : Address/data multiplexing enable bit
When this bit is set, the address and data values are multiplexed on the data bus, valid only with NOR and PSRAM memories:
- 0: Address/data non multiplexed
- 1: Address/data multiplexed on databus (default after reset)
Bit 0 MBKEN : Memory bank enable bit
Enables the memory bank. After reset Bank1 is enabled, all others are disabled. Accessing a disabled bank causes an ERROR on AHB bus.
- 0: Corresponding memory bank is disabled.
- 1: Corresponding memory bank is enabled.
SRAM/NOR-flash chip-select timing register for bank x (FSMC_BTRx)
Address offset: \( 0x04 + 0x8 * (x - 1) \) , ( \( x = 1 \) to \( 4 \) )
Reset value: 0x0FFF FFFF
This register contains the control information of each memory bank, used for SRAMs, PSRAM and NOR flash memories. If the EXTMOD bit is set in the FSMC_BCRx register, then this register is partitioned for write and read access, that is, 2 registers are available:
one to configure read accesses (this register) and one to configure write accesses (FSMC_BWTRx registers).
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Res. | Res. | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BURSTURN[3:0] | ||||||||||
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | ||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw |
Bits 31:30 Reserved, must be kept at reset value.
Bits 29:28 ACCMOD[1:0] : Access mode
Specifies the asynchronous access modes as shown in the timing diagrams. These bits are taken into account only when the EXTMOD bit in the FSMC_BCRx register is 1.
00: Access mode A
01: Access mode B
10: Access mode C
11: Access mode D
Bits 27:24 DATLAT[3:0] : (see note below bit descriptions): Data latency for synchronous memory
For synchronous access with read/write Burst mode enabled (BURSTEN / CBURSTRW bits set), defines the number of memory clock cycles (+2) to issue to the memory before reading/writing the first data:
This timing parameter is not expressed in HCLK periods, but in FSMC_CLK periods.
For asynchronous access, this value is don't care.
0000: Data latency of 2 CLK clock cycles for first burst access
1111: Data latency of 17 CLK clock cycles for first burst access (default value after reset)
Bits 23:20 CLKDIV[3:0] : Clock divide ratio (for FSMC_CLK signal)
Defines the period of FSMC_CLK clock output signal, expressed in number of HCLK cycles:
0000: FSMC_CLK period= 1x HCLK period
0001: FSMC_CLK period = 2 × HCLK periods
0010: FSMC_CLK period = 3 × HCLK periods
1111: FSMC_CLK period = 16 × HCLK periods (default value after reset)
In asynchronous NOR flash, SRAM or PSRAM accesses, this value is don't care.
Note: Refer to Section 11.6.5: Synchronous transactions for FSMC_CLK divider ratio formula
Bits 19:16 BUSTURN[3:0] : Bus turnaround phase duration
These bits are written by software to add a delay at the end of a write-to-read (and read-to-write) transaction. This delay enables to match the minimum time between consecutive transactions ( \( t_{\text{EHEL}} \) from NEx high to NEx low) and the maximum time needed by the memory to free the data bus after a read access ( \( t_{\text{EHQZ}} \) ). The programmed bus turnaround delay is inserted between an asynchronous read (muxed or mode D) or write transaction and any other asynchronous /synchronous read or write to or from a static bank. The bank can be the same or different in case of read, in case of write the bank can be different except for muxed or mode D.
In some cases, whatever the programmed BUSTURN values, the bus turnaround delay is fixed as follows:
- • The bus turnaround delay is not inserted between two consecutive asynchronous write transfers to the same static memory bank except for muxed mode and mode D.
- • There is a bus turnaround delay of 1 HCLK clock cycle between:
- – Two consecutive asynchronous read transfers to the same static memory bank except for muxed mode and mode D.
- – An asynchronous read to an asynchronous or synchronous write to any static bank or dynamic bank except for muxed mode and mode D.
- – An asynchronous (modes 1, 2, A, B or C) read and a read from another static bank.
- • There is a bus turnaround delay of 2 HCLK clock cycle between:
- – Two consecutive synchronous writes (burst or single) to the same bank.
- – A synchronous write (burst or single) access and an asynchronous write or read transfer to or from static memory bank (the bank can be the same or different for the case of read).
- – Two consecutive synchronous reads (burst or single) followed by any synchronous/asynchronous read or write from/to another static memory bank.
- • There is a bus turnaround delay of 3 HCLK clock cycle between:
- – Two consecutive synchronous writes (burst or single) to different static bank.
- – A synchronous write (burst or single) access and a synchronous read from the same or a different bank.
0000: BUSTURN phase duration = 0 HCLK clock cycle added
...
1111: BUSTURN phase duration = 15 x HCLK clock cycles added (default value after reset)
Bits 15:8 DATAST[7:0] : Data-phase duration
These bits are written by software to define the duration of the data phase (refer to Figure 33 to Figure 45 ), used in asynchronous accesses:
0000 0000: Reserved
0000 0001: DATAST phase duration = 1 × HCLK clock cycles
0000 0010: DATAST phase duration = 2 × HCLK clock cycles
...
1111 1111: DATAST phase duration = 255 × HCLK clock cycles (default value after reset)
For each memory type and access mode data-phase duration, refer to the respective figure ( Figure 33 to Figure 45 ).
Example: Mode 1, write access, DATAST=1: Data-phase duration= DATAST+1 = 2 HCLK clock cycles.
Note: In synchronous accesses, this value is don't care.
Bits 7:4 ADDHLD[3:0] : Address-hold phase duration
These bits are written by software to define the duration of the address hold phase (refer to Figure 33 to Figure 45 ), used in mode D or multiplexed accesses:
0000: Reserved
0001: ADDHLD phase duration = 1 × HCLK clock cycle
0010: ADDHLD phase duration = 2 × HCLK clock cycle
...
1111: ADDHLD phase duration = 15 × HCLK clock cycles (default value after reset)
For each access mode address-hold phase duration, refer to the respective figure ( Figure 33 to Figure 45 ).
Note: In synchronous accesses, this value is not used, the address hold phase is always 1 memory clock period duration.
Bits 3:0 ADDSET[3:0] : Address setup phase duration
These bits are written by software to define the duration of the address setup phase (refer to Figure 33 to Figure 45 ), used in SRAMs, ROMs, asynchronous NOR flash and PSRAM:
0000: ADDSET phase duration = 0 × HCLK clock cycle
...
1111: ADDSET phase duration = 15 × HCLK clock cycles (default value after reset)
For each access mode address setup phase duration, refer to the respective figure ( Figure 33 to Figure 45 ).
Note: In synchronous accesses, this value is don't care.
In Muxed mode or mode D, the minimum value for ADDSET is 1.
In mode 1 and PSRAM memory, the minimum value for ADDSET is 1.
Note: PSRAMs (CRAMs) have a variable latency due to internal refresh. Therefore these memories issue the NWAIT signal during the whole latency phase to prolong the latency as needed. With PSRAMs (CRAMs) the filled DATLAT must be set to 0, so that the FSMC exits its latency phase soon and starts sampling NWAIT from memory, then starts to read or write when the memory is ready. This method can be used also with the latest generation of synchronous flash memories that issue the NWAIT signal, unlike older flash memories (check the datasheet of the specific flash memory being used).
SRAM/NOR-flash write timing registers x (FSMC_BWTRx)
Address offset: 0x104 + 0x8 * (x - 1), (x = 1 to 4)
Reset value: 0x0FFF FFFF
This register contains the control information of each memory bank. It is used for SRAMs, PSRAMs and NOR flash memories. When the EXTMOD bit is set in the FSMC_BCRx register, then this register is active for write access.
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Res | Res | ACCMOD[1:0] | Res | Res | Res | Res | Res | Res | Res | Res | BUSTURN[3:0] | ||||
| rw | rw | rw | rw | rw | rw | ||||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw |
Bits 31:30 Reserved, must be kept at reset value.
Bits 29:28 ACCMOD[1:0] : Access mode.
Specifies the asynchronous access modes as shown in the next timing diagrams. These bits are taken into account only when the EXTMOD bit in the FSMC_BCRx register is 1.
00: Access mode A
01: Access mode B
10: Access mode C
11: Access mode D
Bits 27:20 Reserved, must be kept at reset value.
Bits 19:16 BUSTURN[3:0] : Bus turnaround phase duration
The programmed bus turnaround delay is inserted between an asynchronous write transfer and any other asynchronous /synchronous read or write transfer to or from a static bank. The bank can be the same or different in case of read, in case of write the bank can be different except for muxed or mode D.
In some cases, whatever the programmed BUSTURN values, the bus turnaround delay is fixed as follows:
- • The bus turnaround delay is not inserted between two consecutive asynchronous write transfers to the same static memory bank except for muxed and D modes.
- • There is a bus turnaround delay of 2 HCLK clock cycle between:
- –Two consecutive synchronous writes (burst or single) to the same bank.
- –A synchronous write (burst or single) transfer and an asynchronous write or read transfer to or from static memory bank.
- • There is a bus turnaround delay of 3 HCLK clock cycle between:
- –Two consecutive synchronous writes (burst or single) to different static bank.
- –A synchronous write (burst or single) transfer and a synchronous read from the same or a different bank.
0000: BUSTURN phase duration = 0 HCLK clock cycle added
...
1111: BUSTURN phase duration = 15 HCLK clock cycles added (default value after reset)
Bits 15:8 DATAST[7:0] : Data-phase duration.
These bits are written by software to define the duration of the data phase (refer to Figure 33 to Figure 45 ), used in asynchronous SRAM, PSRAM and NOR flash memory accesses:
0000 0000: Reserved
0000 0001: DATAST phase duration = 1 × HCLK clock cycles
0000 0010: DATAST phase duration = 2 × HCLK clock cycles
...
1111 1111: DATAST phase duration = 255 × HCLK clock cycles (default value after reset)
Bits 7:4 ADDHLD[3:0] : Address-hold phase duration.
These bits are written by software to define the duration of the address hold phase (refer to Figure 42 to Figure 45 ), used in asynchronous multiplexed accesses:
0000: Reserved
0001: ADDHLD phase duration = 1 × HCLK clock cycle
0010: ADDHLD phase duration = 2 × HCLK clock cycle
...
1111: ADDHLD phase duration = 15 × HCLK clock cycles (default value after reset)
Note: In synchronous NOR flash accesses, this value is not used, the address hold phase is always 1 flash clock period duration.
Bits 3:0 ADDSET[3:0] : Address setup phase duration.
These bits are written by software to define the duration of the address setup phase in HCLK cycles (refer to Figure 33 to Figure 45 ), used in asynchronous accesses:
0000: ADDSET phase duration = 0 × HCLK clock cycle
...
1111: ADDSET phase duration = 15 × HCLK clock cycles (default value after reset)
Note: In synchronous accesses, this value is not used, the address setup phase is always 1 flash clock period duration. In muxed mode, the minimum ADDSET value is 1.
11.6.7 FSMC register map
Table 70. FSMC register map and reset values
| Offset | Register name reset value | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | ||
| 0x00 | FSMC_BCR1 | WFDIS | CCLKEN | CBURSTRW | CPSIZE [2:0] | ASYNCCWAIT | EXTMOD | WAITEN | WREN | WAITCFG | Res. | WAITPOL | BURSTEN | Res. | FACCEN | MWID [1:0] | MTYP [1:0] | MUXEN | MBKEN | ||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | |||||||||||||
| 0x08 | FSMC_BCR2 | CBURSTRW | CPSIZE [2:0] | ASYNCCWAIT | EXTMOD | WAITEN | WREN | WAITCFG | Res. | WAITPOL | BURSTEN | Res. | FACCEN | MWID [1:0] | MTYP [1:0] | MUXEN | MBKEN | ||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | |||||||||||||||
| 0x10 | FSMC_BCR3 | CBURSTRW | CPSIZE [2:0] | ASYNCCWAIT | EXTMOD | WAITEN | WREN | WAITCFG | Res. | WAITPOL | BURSTEN | Res. | FACCEN | MWID [1:0] | MTYP [1:0] | MUXEN | MBKEN | ||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | |||||||||||||||
| 0x18 | FSMC_BCR4 | CBURSTRW | CPSIZE [2:0] | ASYNCCWAIT | EXTMOD | WAITEN | WREN | WAITCFG | Res. | WAITPOL | BURSTEN | Res. | FACCEN | MWID [1:0] | MTYP [1:0] | MUXEN | MBKEN | ||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | |||||||||||||||
| 0x04 | FSMC_BTR1 | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||||
| Reset value | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||
| 0x0C | FSMC_BTR2 | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||||
| Reset value | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||
| 0x14 | FSMC_BTR3 | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||||
| Reset value | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||
Table 70. FSMC register map and reset values (continued)
| Offset | Register name reset value | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x1C | FSMC_BTR4 | Res. | Res. | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||
| Reset value | 0 0 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | |||||||||||||||||||||||||
| 0x104 | FSMC_BWTR1 | Res. | Res. | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||
| Reset value | 0 0 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | |||||||||||||||||||||||||
| 0x10C | FSMC_BWTR2 | Res. | Res. | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||
| Reset value | 0 0 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | |||||||||||||||||||||||||
| 0x114 | FSMC_BWTR3 | Res. | Res. | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||
| Reset value | 0 0 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | |||||||||||||||||||||||||
| 0x11C | FSMC_BWTR4 | Res. | Res. | ACCMOD[1:0] | DATLAT[3:0] | CLKDIV[3:0] | BUSTURN[3:0] | DATAST[7:0] | ADDHLD[3:0] | ADDSET[3:0] | |||||||||||||||||||||||
| Reset value | 0 0 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | |||||||||||||||||||||||||