20. Flexible static memory controller (FSMC)

Low-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 16 and 32 Kbytes.

Medium-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 64 and 128 Kbytes.

High-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 256 and 512 Kbytes.

This section applies to high-density value line devices only.

20.1 FSMC main features

The FSMC block is able to interface with synchronous and asynchronous memories. Its main purpose is to:

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 FSMC has the following main features:

operation is in progress, the FIFO is drained. The FSMC inserts wait states until the current memory access is complete.

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, it is possible to change the settings at any time.

20.2 Block diagram

The FSMC consists of four main blocks:

The block diagram is shown in Figure 202 .

Figure 202. FSMC block diagram. The diagram shows the internal structure of the FSMC. On the left, an 'AHB bus' is connected to a 'Configuration registers' block and a 'NOR/PSRAM memory controller' block. Above the FSMC, an 'FSMC interrupt to NVIC' is shown. To the right, a list of signals is shown, grouped by a bracket as 'NOR/PSRAM signals': FSMC_NE[4:1], FSMC_NL (or NADV), FSMC_NBL[1:0], FSMC_CLK, FSMC_A[25:0], FSMC_D[15:0], FSMC_NOE, FSMC_NWE, and FSMC_NWAIT. The signal FSMC_NL (or NADV) is also labeled as 'From clock controller' and 'HCLK'. The diagram is labeled 'ai18305b' in the bottom right corner.

Figure 202. FSMC block diagram

Figure 202. FSMC block diagram. The diagram shows the internal structure of the FSMC. On the left, an 'AHB bus' is connected to a 'Configuration registers' block and a 'NOR/PSRAM memory controller' block. Above the FSMC, an 'FSMC interrupt to NVIC' is shown. To the right, a list of signals is shown, grouped by a bracket as 'NOR/PSRAM signals': FSMC_NE[4:1], FSMC_NL (or NADV), FSMC_NBL[1:0], FSMC_CLK, FSMC_A[25:0], FSMC_D[15:0], FSMC_NOE, FSMC_NWE, and FSMC_NWAIT. The signal FSMC_NL (or NADV) is also labeled as 'From clock controller' and 'HCLK'. The diagram is labeled 'ai18305b' in the bottom right corner.

20.3 AHB interface

The AHB slave interface enables internal CPUs and other bus master peripherals to access the external static memories.

AHB transactions are translated into the external device protocol. In particular, if the selected external memory is 16 or 8 bits 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 consecutive accesses except when performing accesses in mode D with the extended mode enabled.

The FSMC generates an AHB error in the following conditions:

The effect of this AHB error depends on the AHB master which has attempted the R/W access:

The AHB clock (HCLK) is the reference clock for the FSMC.

20.3.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:

Configuration registers

The FSMC can be configured using a register set. See Section 20.5.6 , for a detailed description of the NOR flash/PSRAM control registers.

20.4 External device address mapping

From the FSMC point of view, the external memory is composed of a single fixed size bank of 256 Mbytes (Refer to Figure 203 ):

For each bank the type of memory to be used is user-defined in the Configuration register.

Figure 203. FSMC memory banks

Diagram of FSMC memory banks showing address range, bank structure, and supported memory type.

The diagram illustrates the memory bank structure. It shows an address range from 6000 0000h to 6FFF FFF Fh. A central box represents 'Bank 1', which is further divided into '4 x 64 MB' subbanks. To the right, the 'Supported memory type' is listed as 'NOR / PSRAM'. A small code 'ai18306' is visible in the bottom right corner.

Diagram of FSMC memory banks showing address range, bank structure, and supported memory type.

20.4.1 NOR/PSRAM address mapping

HADDR[27:26] bits are used to select one of the four memory banks as shown in Table 90 .

Table 90. NOR/PSRAM bank selection

HADDR[27:26] (1)Selected bank
00Bank 1 - NOR/PSRAM 1
01Bank 1 - NOR/PSRAM 2
10Bank 1 - NOR/PSRAM 3
11Bank 1 - NOR/PSRAM 4

1. HADDR are internal AHB address lines that are translated to external memory.

HADDR[25:0] contain the external memory address. Since HADDR is a byte address whereas the memory is addressed in words, the address actually issued to the memory varies according to the memory data width, as shown in the following table.

Table 91. External memory address

Memory width (1)Data address issued to the memoryMaximum memory capacity (bits)
8-bitHADDR[25:0]64 Mbyte x 8 = 512 Mbit
16-bitHADDR[25:1] >> 164 Mbyte/2 x 16 = 512 Mbit
  1. 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 (16-bit or 8-bit), FSMC_A[0] should be connected to external memory address A[0].

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.

20.5 NOR flash/PSRAM controller

The FSMC generates the appropriate signal timings to drive the following types of memories:

The FSMC outputs a unique chip select signal NE[4:1] per bank. All the other signals (addresses, data and control) are shared.

For synchronous accesses, the FSMC issues the clock (CLK) to the selected external device only during the read/write transactions. This clock is a submultiple of the HCLK clock. The size of each bank is fixed and equal to 64 Mbytes.

Each bank is configured by means of dedicated registers (see Section 20.5.6 ).

The programmable memory parameters include access timings (see Table 92 ) and support for wait management (for PSRAM and NOR flash accessed in burst mode).

Table 92. Programmable NOR/PSRAM access parameters

ParameterFunctionAccess modeUnitMin.Max.
Address setupDuration of the address setup phaseAsynchronousAHB clock cycle (HCLK)015
Address holdDuration of the address hold phaseAsynchronous, muxed I/OsAHB clock cycle (HCLK)115
Data setupDuration of the data setup phaseAsynchronousAHB clock cycle (HCLK)1256
Bus turnDuration of the bus turnaround phaseAsynchronous and synchronous read/writeAHB clock cycle (HCLK)015
Table 92. Programmable NOR/PSRAM access parameters (continued)
ParameterFunctionAccess modeUnitMin.Max.
Clock divide ratioNumber of AHB clock cycles (HCLK) to build one memory clock cycle (CLK)SynchronousAHB clock cycle (HCLK)216
Data latencyNumber of clock cycles to issue to the memory before the first data of the burstSynchronousMemory clock cycle (CLK)217

20.5.1 External memory interface signals

Table 93 , Table 94 and Table 95 list the signals that are typically used to interface NOR flash, SRAM and PSRAM.

Note: Prefix “N”. specifies the associated signal as active low.

NOR flash, nonmultiplexed I/Os

Table 93. Nonmultiplexed I/O NOR flash
FSMC signal nameI/OFunction
CLKOClock (for synchronous access)
A[25:0]OAddress bus
D[15:0]I/OBidirectional data bus
NE[x]OChip select, x = 1..4
NOEOOutput enable
NWEOWrite enable
NL(=NADV)OLatch enable (this signal is called address valid, NADV, by some NOR flash devices)
NWAITINOR flash wait input signal to the FSMC

NOR flash memories are addressed in 16-bit words. The maximum capacity is 512 Mbit (26 address lines).

NOR flash, multiplexed I/Os

Table 94. Multiplexed I/O NOR flash
FSMC signal nameI/OFunction
CLKOClock (for synchronous access)
A[25:16]OAddress bus
AD[15:0]I/O16-bit multiplexed, bidirectional address/data bus
NE[x]OChip select, x = 1..4
NOEOOutput enable
NWEOWrite enable
Table 94. Multiplexed I/O NOR flash (continued)
FSMC signal nameI/OFunction
NL(=NADV)OLatch enable (this signal is called address valid, NADV, by some NOR flash devices)
NWAITINOR flash wait input signal to the FSMC

NOR-flash memories are addressed in 16-bit words. The maximum capacity is 512 Mbit (26 address lines).

PSRAM/SRAM, nonmultiplexed I/Os

Table 95. Nonmultiplexed I/Os PSRAM/SRAM
FSMC signal nameI/OFunction
CLKOClock (only for PSRAM synchronous access)
A[25:0]OAddress bus
D[15:0]I/OData bidirectional bus
NE[x]OChip select, x = 1..4 (called NCE by PSRAM (Cellular RAM i.e. CDRAM))
NOEOOutput enable
NWEOWrite enable
NL(= NADV)OAddress valid only for PSRAM input (memory signal name: NADV)
NWAITIPSRAM wait input signal to the FSMC
NBL[1]OUpper byte enable (memory signal name: NUB)
NBL[0]OLowed byte enable (memory signal name: NLB)

PSRAM memories are addressed in 16-bit words. The maximum capacity is 512 Mbit (26 address lines).

PSRAM, multiplexed I/Os

Table 96. Multiplexed I/O PSRAM
FSMC signal nameI/OFunction
CLKOClock (for synchronous access)
A[25:16]OAddress bus
AD[15:0]I/O16-bit multiplexed, bidirectional address/data bus
NE[x]OChip select, x = 1..4 (called NCE by PSRAM (Cellular RAM i.e. CDRAM))
NOEOOutput enable
NWEOWrite enable
NL(= NADV)OAddress valid PSRAM input (memory signal name: NADV)
NWAITIPSRAM wait input signal to the FSMC

Table 96. Multiplexed I/O PSRAM (continued)

FSMC signal nameI/OFunction
NBL[1]OUpper byte enable (memory signal name: NUB)
NBL[0]OLowed byte enable (memory signal name: NLB)

PSRAM memories are addressed in 16-bit words. The maximum capacity is 512 Mbit (26 address lines).

20.5.2 Supported memories and transactions

Table 97 below displays an example of the supported devices, access modes and transactions when the memory data bus is 16-bit for NOR, PSRAM and SRAM. Transactions not allowed (or not supported) by the FSMC in this example appear in gray.

Table 97. NOR flash/PSRAM controller: example of supported memories and transactions

DeviceModeR/WAHB data sizeMemory data sizeAllowed/not allowedComments
NOR flash
(muxed I/Os and nonmuxed I/Os)
AsynchronousR816Y-
AsynchronousW816N-
AsynchronousR1616Y-
AsynchronousW1616Y-
AsynchronousR3216YSplit into two FSMC accesses
AsynchronousW3216YSplit into two FSMC accesses
Asynchronous pageR-16NMode is not supported
SynchronousR816N-
SynchronousR1616Y-
SynchronousR3216Y-
PSRAM
(multiplexed and nonmultiplexed I/Os)
AsynchronousR816Y-
AsynchronousW816YUse of byte lanes NBL[1:0]
AsynchronousR1616Y-
AsynchronousW1616Y-
AsynchronousR3216YSplit into two FSMC accesses
AsynchronousW3216YSplit into two FSMC accesses
Asynchronous pageR-16NMode is not supported
SynchronousR816N-
SynchronousR1616Y-
SynchronousR3216Y-
SynchronousW816YUse of byte lanes NBL[1:0]
SynchronousW16 / 3216Y-

Table 97. NOR flash/PSRAM controller: example of supported memories and transactions

DeviceModeR/WAHB data sizeMemory data sizeAllowed/not allowedComments
SRAM and ROMAsynchronousR8 / 1616Y-
AsynchronousW8 / 1616YUse of byte lanes NBL[1:0]
AsynchronousR3216YSplit into two FSMC accesses
AsynchronousW3216YSplit into two FSMC accesses. Use of byte lanes NBL[1:0]

20.5.3 General timing rules

Signals synchronization

20.5.4 NOR flash/PSRAM controller asynchronous transactions

Asynchronous static memories (NOR flash memory, PSRAM, SRAM)

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 204. Mode1 read accesses

Timing diagram for Mode1 read accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows a memory transaction starting with address and control signals, followed by data being driven by memory. ADDSET and DATAST are measured in HCLK cycles.

The diagram illustrates the timing for a Mode1 read access. The signals shown are:

Timing parameters are defined as:

ai15557

Timing diagram for Mode1 read accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows a memory transaction starting with address and control signals, followed by data being driven by memory. ADDSET and DATAST are measured in HCLK cycles.
  1. 1. NBL[1:0] are driven low during read access.

Figure 205. Mode1 write accesses

Timing diagram for Mode1 write accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows a memory transaction starting with address and control signals, followed by data being driven by FSMC. ADDSET and (DATAST + 1) are measured in HCLK cycles.

The diagram illustrates the timing for a Mode1 write access. The signals shown are:

Timing parameters are defined as:

ai15558

Timing diagram for Mode1 write accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows a memory transaction starting with address and control signals, followed by data being driven by FSMC. ADDSET and (DATAST + 1) are measured in HCLK cycles.

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 one HCLK cycle, the DATAST value must be greater than zero (DATAST > 0).

Table 98. FSMC_BCRx bit fields
Bit numberBit nameValue to set
31:20Reserved0x000
19CBURSTRW0x0 (no effect on asynchronous mode)
18:16CPSIZE0x0 (no effect on asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x0
13WAITEN0x0 (no effect on asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10WRAPMOD0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCENDon't care
5:4MWIDAs needed
3:2MTYP[0:1]As needed, exclude 0x2 (NOR flash)
1MUXE0x0
0MBKEN0x1
Table 99. FSMC_BTRx bit fields
Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMODDon't care
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST+1 HCLK cycles for write accesses, DATAST HCLK cycles for read accesses).
7:4ADDHLDDon't care
3:0ADDSET[3:0]Duration of the first access phase (ADDSET HCLK cycles).
Minimum value for ADDSET is 0.

Mode A - SRAM/PSRAM (CRAM) OE toggling

Figure 206. ModeA read accesses

Timing diagram for Mode A read accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the setup (ADDSET) and data (DATAST) phases in HCLK cycles. NOE is toggled to enable data output from memory. NBL[1:0] are driven low during the read access. NWE is held high.

Timing diagram for Mode A read accesses. The diagram shows the following signals and timing parameters:

ai15559

Timing diagram for Mode A read accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the setup (ADDSET) and data (DATAST) phases in HCLK cycles. NOE is toggled to enable data output from memory. NBL[1:0] are driven low during the read access. NWE is held high.
  1. 1. NBL[1:0] are driven low during read access.

Figure 207. ModeA write accesses

Timing diagram for Mode A write accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the setup (ADDSET) and data (DATAST + 1) phases in HCLK cycles. NOE is toggled to enable data input to memory. NBL[1:0] are driven low during the write access. NWE is toggled to enable data input to memory.

Timing diagram for Mode A write accesses. The diagram shows the following signals and timing parameters:

ai15560

Timing diagram for Mode A write accesses showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the setup (ADDSET) and data (DATAST + 1) phases in HCLK cycles. NOE is toggled to enable data input to memory. NBL[1:0] are driven low during the write access. NWE is toggled to enable data input to memory.

The differences compared with mode1 are the toggling of NOE and the independent read and write timings.

Table 100. FSMC_BCRx bit fields

Bit numberBit nameValue to set
31-20Reserved0x000
19CBURSTRW0x0 (no effect on asynchronous mode)
18:16CPSIZE0x0 (no effect on asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x1
13WAITEN0x0 (no effect on asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10WRAPMOD0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCENDon't care
5-4MWIDAs needed
3-2MTYP[0:1]As needed, exclude 0x2 (NOR flash)
1MUXEN0x0
0MBKEN0x1

Table 101. FSMC_BTRx bit fields

Bit numberBit nameValue to set
31:30Reserved0x0
29-28ACCMOD0x0
27-24DATLATDon't care
23-20CLKDIVDon't care
19-16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15-8DATASTDuration of the second access phase (DATAST HCLK cycles) for read accesses.
7-4ADDHLDDon't care
3-0ADDSET[3:0]Duration of the first access phase (ADDSET HCLK cycles) for read accesses.
Minimum value for ADDSET is 0.

Table 102. FSMC_BWTRx bit fields

Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x0
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST+1 HCLK cycles for write accesses,
7-4ADDHLDDon't care
3-0ADDSET[3:0]Duration of the first access phase (ADDSET HCLK cycles) for write accesses.
Minimum value for ADDSET is 0.

Mode 2/B - NOR flash

Figure 208. Mode2 and mode B read accesses

Timing diagram for Mode 2 and Mode B read accesses showing address, control signals, and data bus over time.

The diagram illustrates the timing for Mode 2 and Mode B read accesses. The signals shown are:

The transaction is divided into two phases by vertical dashed lines:

A horizontal double-headed arrow at the top indicates the total 'Memory transaction' duration from the falling edge of NADV to the rising edge of NADV.

Timing diagram for Mode 2 and Mode B read accesses showing address, control signals, and data bus over time.

ai15561

Figure 209. Mode2 write accesses

Timing diagram for Mode2 write accesses showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the memory transaction phases: address setup (ADDSET), data drive (DATAST), and clock cycle (1HCLK).

This timing diagram illustrates Mode2 write accesses. The signals shown are A[25:0] (address), NADV (address valid), NEx (external memory write enable), NOE (output enable), NWE (write enable), and D[15:0] (data). The timing parameters are defined as follows:

The diagram shows the following sequence of events:

  1. The address A[25:0] is driven and NADV goes low.
  2. After a delay of ADDSET HCLK cycles, the data D[15:0] is driven by the FSMC.
  3. Simultaneously, NWE goes low to initiate the write.
  4. The data remains driven for a duration of (DATAST + 1) HCLK cycles.
  5. At the end of the data drive, NWE goes high and NOE goes low.
  6. The signals return to their initial states after another 1HCLK cycle.

ai15562

Timing diagram for Mode2 write accesses showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the memory transaction phases: address setup (ADDSET), data drive (DATAST), and clock cycle (1HCLK).

Figure 210. Mode B write accesses

Timing diagram for Mode B write accesses, similar to Figure 209 but with different signal toggling and timing parameters.

This timing diagram illustrates Mode B write accesses. The signals and timing parameters are identical to Figure 209, but the sequence of events differs:

  1. The address A[25:0] is driven and NADV goes low.
  2. After a delay of ADDSET HCLK cycles, the data D[15:0] is driven by the FSMC.
  3. Simultaneously, NWE goes low to initiate the write.
  4. The data remains driven for a duration of (DATAST + 1) HCLK cycles.
  5. At the end of the data drive, NWE goes high and NOE goes low.
  6. The signals return to their initial states after another 1HCLK cycle.

ai15563

Timing diagram for Mode B write accesses, similar to Figure 209 but with different signal toggling and timing parameters.

The differences with mode1 are the toggling of NWE and the independent read and write timings when extended mode is set (Mode B).

Table 103. FSMC_BCRx bit fields

Bit numberBit nameValue to set
31-20Reserved0x000
19CBURSTRW0x0 (no effect on asynchronous mode)
18:16Reserved0x0 (no effect on asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x1 for mode B, 0x0 for mode 2
13WAITEN0x0 (no effect on asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10WRAPMOD0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCEN0x1
5-4MWIDAs needed
3-2MTYP[0:1]0x2 (NOR flash memory)
1MUXEN0x0
0MBKEN0x1

Table 104. FSMC_BTRx bit fields

Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x1
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST HCLK cycles) for read accesses.
7-4ADDHLDDon't care
3-0ADDSET[3:0]Duration of the first access phase (ADDSET HCLK cycles) for read accesses.
Minimum value for ADDSET is 0.

Table 105. FSMC_BWTRx bit fields

Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x1
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST+1 HCLK cycles for write accesses,
7:4ADDHLDDon't care
3:0ADDSET[3:0]Duration of the first access phase (ADDSET HCLK cycles) for write accesses.
Minimum value for ADDSET is 0.

Note: The FSMC_BWTRx register is valid only if extended mode is set (mode B), otherwise all its content is don't care.

Mode C - NOR flash - OE toggling

Figure 211. Mode C read accesses

Timing diagram for Mode C read accesses showing address, control signals, and data over time.

The diagram illustrates the timing for Mode C read accesses. It shows the following signals over time:

The transaction is divided into two phases by vertical dashed lines:

A horizontal double-headed arrow at the top indicates the entire duration as the "Memory transaction". The data on the D[15:0] lines is labeled "data driven by memory" during the active phases.

Timing diagram for Mode C read accesses showing address, control signals, and data over time.

ai15564

Figure 212. Mode C write accesses

Timing diagram for Mode C write accesses showing address (A[25:0]), NADV, NEx, NOE, NWE, and data (D[15:0]) signals over time. The diagram illustrates the memory transaction duration, ADDSET time, and (DATAST + 1) time in HCLK cycles. Data is driven by the FSMC.

The diagram shows the timing for Mode C write accesses. The signals shown are A[25:0], NADV, NEx, NOE, NWE, and D[15:0]. The memory transaction starts when A[25:0] is valid and NADV goes low. It ends when NADV goes high. NEx is low during the transaction. NOE is high during the transaction. NWE is low during the data write phase. D[15:0] is driven by the FSMC during the data write phase. The ADDSET time is the duration from the start of the transaction to the start of the data write phase, measured in HCLK cycles. The (DATAST + 1) time is the duration of the data write phase, measured in HCLK cycles. A 1HCLK cycle is also indicated.

Timing diagram for Mode C write accesses showing address (A[25:0]), NADV, NEx, NOE, NWE, and data (D[15:0]) signals over time. The diagram illustrates the memory transaction duration, ADDSET time, and (DATAST + 1) time in HCLK cycles. Data is driven by the FSMC.

The differences compared with mode1 are the toggling of NOE and the independent read and write timings.

Table 106. FSMC_BCRx bit fields

Bit No.Bit nameValue to set
31-20Reserved0x000
19CBURSTRW0x0 (no effect on asynchronous mode)
18:16CPSIZE0x0 (no effect on asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x1
13WAITEN0x0 (no effect on asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10WRAPMOD0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCEN0x1
5-4MWIDAs needed
3-2MTYP[0:1]0x2 (NOR flash memory)
Table 106. FSMC_BCRx bit fields (continued)
Bit No.Bit nameValue to set
1MUXEN0x0
0MBKEN0x1
Table 107. FSMC_BTRx bit fields
Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x2
27:24DATLAT0x0
23:20CLKDIV0x0
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST HCLK cycles) for read accesses.
7:4ADDHLDDon't care
3:0ADDSET[3:0]Duration of the first access phase (ADDSET HCLK cycles) for read accesses.
Minimum value for ADDSET is 0.
Table 108. FSMC_BWTRx bit fields
Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x2
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST+1 HCLK cycles for write accesses,
7:4ADDHLDDon't care
3:0ADDSET[3:0]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 213. Mode D read accesses

Timing diagram for Mode D read accesses showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. It details the memory transaction phases: ADDSET, ADDHLD, and DATAST in HCLK cycles.

This timing diagram illustrates a read access in Mode D. The signals shown are address lines A[25:0], address valid (NADV), next address (NEx), output enable (NOE), write enable (NWE), and data lines D[15:0]. The NWE signal remains high throughout the transaction. The memory transaction is divided into three phases measured in HCLK cycles: ADDSET (from the falling edge of NADV to the rising edge of NADV), ADDHLD (from the rising edge of NADV to the falling edge of NOE), and DATAST (from the falling edge of NOE to the rising edge of NEx). During the DATAST phase, the data is driven by the memory. Reference code ai15566 is present in the bottom right.

Timing diagram for Mode D read accesses showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. It details the memory transaction phases: ADDSET, ADDHLD, and DATAST in HCLK cycles.

Figure 214. Mode D write accesses

Timing diagram for Mode D write accesses showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. It details the memory transaction phases: ADDSET, ADDHLD, and (DATAST+ 1) in HCLK cycles, with data driven by FSMC.

This timing diagram illustrates a write access in Mode D. The signals shown are address lines A[25:0], address valid (NADV), next address (NEx), output enable (NOE), write enable (NWE), and data lines D[15:0]. The NOE signal remains high throughout the transaction. The memory transaction is divided into three phases measured in HCLK cycles: ADDSET (from the falling edge of NADV to the rising edge of NADV), ADDHLD (from the rising edge of NADV to the falling edge of NWE), and (DATAST+ 1) (from the falling edge of NWE to the rising edge of NEx). During the (DATAST+ 1) phase, the data is driven by the FSMC. A 1HCLK cycle is indicated between the falling edge of NWE and the rising edge of NEx. Reference code ai15567 is present in the bottom right.

Timing diagram for Mode D write accesses showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. It details the memory transaction phases: ADDSET, ADDHLD, and (DATAST+ 1) in HCLK cycles, with data driven by FSMC.

The differences with mode1 are the toggling of NOE that goes on toggling after NADV changes and the independent read and write timings.

Table 109. FSMC_BCRx bit fields

Bit No.Bit nameValue to set
31:20Reserved0x000
19CBURSTRW0x0 (no effect on asynchronous mode)
18:16CPSIZE0x0 (no effect on asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x1
13WAITEN0x0 (no effect on asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10WRAPMOD0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCENSet according to memory support
5:4MWIDAs needed
3:2MTYP[0:1]As needed
1MUXEN0x0
0MBKEN0x1

Table 110. FSMC_BTRx bit fields

Bit No.Bit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x3
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST HCLK cycles) for read accesses.
7:4ADDHLDDuration of the middle phase of the read access (ADDHLD HCLK cycles)
3:0ADDSET[3:0]Duration of the first access phase (ADDSET HCLK cycles) for read accesses. Minimum value for ADDSET is 1.

Table 111. FSMC_BWTRx bit fields

Bit No.Bit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x3
27:24DATLAT0x0
23:20CLKDIV0x0
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase
7:4ADDHLDDuration of the middle phase of the write access (ADDHLD HCLK cycles)
3:0ADDSET[3:0]Duration of the first access phase . Minimum value for ADDSET is 1.

Muxed mode - multiplexed asynchronous access to NOR flash memory

Figure 215. Multiplexed read accesses

Timing diagram for multiplexed read accesses in NOR flash memory. The diagram shows the relationship between address lines A[25:16], control signals NADV, NEx, NOE, NWE, and data lines AD[15:0] over time. The address lines are active during the first access phase (ADDSET). The data lines are driven by memory during the second access phase (DATAST). The middle phase (ADDHLD) is the duration of the middle phase of the write access. The memory transaction is shown as a sequence of these three phases.

The timing diagram illustrates the multiplexed read access sequence. The address lines A[25:16] are active during the first access phase (ADDSET). The data lines AD[15:0] are driven by memory during the second access phase (DATAST). The middle phase (ADDHLD) is the duration of the middle phase of the write access. The memory transaction is shown as a sequence of these three phases.

Key signals and phases shown:

ai15568

Timing diagram for multiplexed read accesses in NOR flash memory. The diagram shows the relationship between address lines A[25:16], control signals NADV, NEx, NOE, NWE, and data lines AD[15:0] over time. The address lines are active during the first access phase (ADDSET). The data lines are driven by memory during the second access phase (DATAST). The middle phase (ADDHLD) is the duration of the middle phase of the write access. The memory transaction is shown as a sequence of these three phases.

Figure 216. Multiplexed write accesses

Timing diagram for multiplexed write accesses showing address, data, and control signals over time. The diagram includes signals A[25:16], NADV, NEx, NOE, NWE, and AD[15:0]. The AD[15:0] signal is shown in two phases: 'Lower address' and 'data driven by FSMC'. Timing parameters include ADDSET, ADDHLD, and (DATAST + 1) in HCLK cycles. A 1HCLK cycle is also indicated.

The diagram illustrates the timing for multiplexed write accesses. The address lines A[25:16] are active during the 'Lower address' phase of the AD[15:0] signal. The NADV signal is active low during the address phase. The NEx signal is active low throughout the transaction. The NOE signal is active low during the data phase. The NWE signal is active low during the data phase. The AD[15:0] signal drives the lower address bytes during the first phase and data during the second phase. The timing parameters are defined as follows: ADDSET is the time from the start of the address phase to the start of the data phase; ADDHLD is the time from the start of the data phase to the start of the next phase; (DATAST + 1) is the duration of the data phase. A 1HCLK cycle is shown as a reference.

Timing diagram for multiplexed write accesses showing address, data, and control signals over time. The diagram includes signals A[25:16], NADV, NEx, NOE, NWE, and AD[15:0]. The AD[15:0] signal is shown in two phases: 'Lower address' and 'data driven by FSMC'. Timing parameters include ADDSET, ADDHLD, and (DATAST + 1) in HCLK cycles. A 1HCLK cycle is also indicated.

The difference with mode D is the drive of the lower address byte(s) on the databus.

Table 112. FSMC_BCRx bit fields

Bit No.Bit nameValue to set
31-21Reserved0x000
19CBURSTRW0x0 (no effect on asynchronous mode)
18:16CPSIZE0x0 (no effect on asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x0
13WAITEN0x0 (no effect on asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10WRAPMOD0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCEN0x1
5-4MWIDAs needed
3-2MTYP[0:1]0x2 (NOR flash memory)
Table 112. FSMC_BCRx bit fields (continued)
Bit No.Bit nameValue to set
1MUXEN0x1
0MBKEN0x1
Table 113. FSMC_BTRx bit fields
Bit No.Bit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x0
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15:8DATASTDuration of the second access phase (DATAST HCLK cycles for read accesses and DATAST+1 HCLK cycles for write accesses).
7:4ADDHLDDuration of the middle phase of the access (ADDHLD HCLK cycles).
3:0ADDSET[3:0]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 a 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[3:0] and ADDHLD bits, are not WAIT sensitive and so they are not prolonged.

The data setup phase (DATAST in the FSMC_BTRx register) must be programmed so that WAIT can be detected 4 HCLK cycles before the end of memory transaction. The following cases must be considered:

  1. 1. DATAST in FSMC_BTRx register) Memory asserts the WAIT signal aligned to NOE/NWE which toggles:

\[ DATAST \geq (4 \times HCLK) + max\_wait\_assertion\_time \]

  1. 2. Memory asserts the WAIT signal aligned to NEx (or NOE/NWE not toggling):
    if

\[ max\_wait\_assertion\_time > address\_phase + hold\_phase \]

then

\[ DATAST \geq (4 \times HCLK) + (max\_wait\_assertion\_time - address\_phase - hold\_phase) \]

otherwise

\[ DATAST \geq 4 \times HCLK \]

where max_wait_assertion_time is the maximum time taken by the memory to assert the WAIT signal once NEx/NOE/NWE is low.

Figure 217 and Figure 218 show the number of HCLK clock cycles that are added to the memory access after WAIT is released by the asynchronous memory (independently of the above cases).

Figure 217. Asynchronous wait during a read access

Timing diagram for asynchronous wait during a read access. It shows signals A[25:0], NEx, NWAIT, NOE, and D[15:0] over time. The diagram is divided into 'address phase' and 'data setup phase'. NWAIT is shown as 'don't care' in the address phase and active in the data setup phase. Data is driven by memory for 4HCLK cycles.

The timing diagram illustrates the sequence of signals during a read access with an asynchronous wait state.
- A[25:0] : Address lines, stable during the address phase and high-impedance during the data setup phase.
- NEx : Address Status signal, goes low at the start of the address phase and returns high at the start of the data setup phase.
- NWAIT : Wait signal, its polarity is 'don't care' during the address phase. In the data setup phase, it is shown as active-low (going low) and then returning high before the data is driven.
- NOE : Output Enable signal, goes low at the start of the data setup phase and returns high after the data is driven.
- D[15:0] : Data lines, which are high-impedance until the 'data driven by memory' period begins. This period lasts for 4HCLK clock cycles.
The entire sequence is labeled as a 'Memory transaction'.

Timing diagram for asynchronous wait during a read access. It shows signals A[25:0], NEx, NWAIT, NOE, and D[15:0] over time. The diagram is divided into 'address phase' and 'data setup phase'. NWAIT is shown as 'don't care' in the address phase and active in the data setup phase. Data is driven by memory for 4HCLK cycles.
  1. 1. NWAIT polarity depends on WAITPOL bit setting in FSMC_BCRx register.

Figure 218. Asynchronous wait during a write access

Timing diagram for asynchronous wait during a write access. It shows signals A[25:0], NEx, NWAIT, NWE, and D[15:0] over time. The diagram is divided into 'address phase' and 'data setup phase'. NWAIT is shown as 'don't care' in both phases. D[15:0] is 'data driven by FSMC' during the data setup phase. Timing markers include 1HCLK and 3HCLK.

The timing diagram illustrates the signal states during a write access with an asynchronous wait. The signals shown are:

The memory transaction is divided into two phases: address phase and data setup phase . The data setup phase duration is marked as 3HCLK . A 1HCLK period is also indicated. The diagram is labeled with ai15797c in the bottom right corner.

Timing diagram for asynchronous wait during a write access. It shows signals A[25:0], NEx, NWAIT, NWE, and D[15:0] over time. The diagram is divided into 'address phase' and 'data setup phase'. NWAIT is shown as 'don't care' in both phases. D[15:0] is 'data driven by FSMC' during the data setup phase. Timing markers include 1HCLK and 3HCLK.

20.5.5 Synchronous transactions

The memory clock, CLK, is a submultiple of HCLK according to the value of parameter CLKDIV.

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 flash 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 the exact relation between the latency and the FSMC DATLAT parameter can be either of:

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 taken.

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-bit), or length 2 (if the AHB transfer is 32-bit) and de-assert the chip select signal when the last data is strobed.

Clearly, such a transfer is not the most efficient in terms of cycles (compared to an asynchronous read). Nevertheless, a random asynchronous access would first require to re-program the memory access mode, which would altogether last longer.

Cross boundary page for Cellular RAM 1.5

Cellular RAM 1.5 does not allow burst access to cross the page boundary. The FSMC controller allows 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, (DATLAT+2) CLK clock cycles.

If NWAIT is sensed active (low level when WAITPOL = 0, high level when WAITPOL = 1), wait states are inserted until NWAIT is sensed 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, and does not consider the data valid.

There are two timing configurations for the NOR flash NWAIT signal in burst mode:

These two NOR flash wait state configurations are supported by the FSMC, individually for each chip select, thanks to the WAITCFG bit in the FSMC_BCRx registers (x = 0..3).

Figure 219. Wait configurations

Timing diagram for Figure 219. Wait configurations. The diagram shows a memory transaction as a burst of 4 half words. It includes signal waveforms for HCLK, CLK, A[25:16], NADV, NWAIT (WAITCFG = 0), NWAIT (WAITCFG = 1), and A/D[15:0]. The address aaddr[25:16] is shown on the A[25:16] line. The data lines A/D[15:0] show aaddr[15:0] followed by three data cycles. The first data cycle is followed by an 'inserted wait state' indicated by a double-width box. The NWAIT signal is shown in two states: WAITCFG = 0, where it is active (low) during the first data cycle and inactive (high) during the wait state; and WAITCFG = 1, where it is active (low) during the wait state and inactive (high) during the first data cycle. The diagram is labeled ai15798b.

Timing diagram illustrating wait configurations for a memory transaction (burst of 4 half words). The diagram shows the relationship between HCLK, CLK, Address (A[25:16]), NADV, NWAIT (WAITCFG = 0 and WAITCFG = 1), and Data (A/D[15:0]).

The address is labeled aaddr[25:16]. The data is labeled aaddr[15:0] and data i .

The inserted wait state is indicated by a double-width box in the data sequence.

ai15798b

Timing diagram for Figure 219. Wait configurations. The diagram shows a memory transaction as a burst of 4 half words. It includes signal waveforms for HCLK, CLK, A[25:16], NADV, NWAIT (WAITCFG = 0), NWAIT (WAITCFG = 1), and A/D[15:0]. The address aaddr[25:16] is shown on the A[25:16] line. The data lines A/D[15:0] show aaddr[15:0] followed by three data cycles. The first data cycle is followed by an 'inserted wait state' indicated by a double-width box. The NWAIT signal is shown in two states: WAITCFG = 0, where it is active (low) during the first data cycle and inactive (high) during the wait state; and WAITCFG = 1, where it is active (low) during the wait state and inactive (high) during the first data cycle. The diagram is labeled ai15798b.

Figure 220. Synchronous multiplexed read mode - NOR, PSRAM (CRAM)

Timing diagram for synchronous multiplexed read mode. It shows signals HCLK, CLK, A[25:16] (addr[25:16]), NEx, NOE, NWE (High), NADV, NWAIT (WAITCFG=0), and A/D[15:0] (Addr[15:0], data). The diagram illustrates the sequence of address, data, and wait states over clock cycles. A memory transaction is defined as a burst of 4 half words. The address is valid for 1 clock cycle, followed by data for 1 clock cycle. The interval between address and data is (DATLAT + 2) CLK cycles. An inserted wait state is shown between the second and third data cycles. Data strobes are indicated for each data cycle. The diagram is labeled ai17723f.
Timing diagram for synchronous multiplexed read mode. It shows signals HCLK, CLK, A[25:16] (addr[25:16]), NEx, NOE, NWE (High), NADV, NWAIT (WAITCFG=0), and A/D[15:0] (Addr[15:0], data). The diagram illustrates the sequence of address, data, and wait states over clock cycles. A memory transaction is defined as a burst of 4 half words. The address is valid for 1 clock cycle, followed by data for 1 clock cycle. The interval between address and data is (DATLAT + 2) CLK cycles. An inserted wait state is shown between the second and third data cycles. Data strobes are indicated for each data cycle. The diagram is labeled ai17723f.
  1. 1. Byte lane outputs BL are not shown; for NOR access, they are held high, and, for PSRAM (CRAM) access, they are held low.
  2. 2. NWAIT polarity is set to 0.

Table 114. FSMC_BCRx bit fields

Bit No.Bit nameValue to set
31-20Reserved0x000
19CBURSTRWNo effect on synchronous read
18-16CPSIZEAs needed (0x1 for CRAM 1.5)
15ASCYWAIT0x0
14EXTMOD0x0
13WAITENSet to 1 if the memory supports this feature, otherwise keep at 0.
12WRENno effect on synchronous read
11WAITCFGto be set according to memory
10WRAPMOD0x0
9WAITPOLto be set according to memory
8BURSTEN0x1
7Reserved0x1
6FACCENSet according to memory support (NOR flash memory)
5-4MWIDAs needed
Table 114. FSMC_BCRx bit fields (continued)
Bit No.Bit nameValue to set
3-2MTYP[0:1]0x1 or 0x2
1MUXENAs needed
0MBKEN0x1
Table 115. FSMC_BTRx bit fields
Bit No.Bit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x0
27-24DATLATData latency
23-20CLKDIV0x0 to get CLK = HCLK (not supported)
0x1 to get CLK = 2 × HCLK
..
19-16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15-8DATASTDon't care
7-4ADDHLDDon't care
3-0ADDSET[3:0]Don't care

Figure 221. Synchronous multiplexed write mode - PSRAM (CRAM)

Timing diagram for synchronous multiplexed write mode. It shows signals HCLK, CLK, A[25:16] (addr[25:16]), NEx, NOE (Hi-Z), NWE, NADV, NWAIT (WAITCFG = 0), and A/D[15:0] (Addr[15:0], data). The diagram illustrates a memory transaction as a burst of 2 half words. The address is latched on the rising edge of CLK. Data is written on the falling edge of CLK. The NWAIT signal is used to insert a wait state. The diagram is labeled ai14731f.
Timing diagram for synchronous multiplexed write mode. It shows signals HCLK, CLK, A[25:16] (addr[25:16]), NEx, NOE (Hi-Z), NWE, NADV, NWAIT (WAITCFG = 0), and A/D[15:0] (Addr[15:0], data). The diagram illustrates a memory transaction as a burst of 2 half words. The address is latched on the rising edge of CLK. Data is written on the falling edge of CLK. The NWAIT signal is used to insert a wait state. The diagram is labeled ai14731f.
  1. 1. Memory must issue NWAIT signal one cycle in advance, accordingly WAITCFG must be programmed to 0.
  2. 2. NWAIT polarity is set to 0.
  3. 3. Byte Lane (NBL) outputs are not shown, they are held low while NEx is active.

Table 116. FSMC_BCRx bit fields

Bit No.Bit nameValue to set
31-20Reserved0x000
19CBURSTRW0x1
18-16CPSIZEAs needed (0x1 for CRAM 1.5)
15ASYNCWAIT0x0
14EXTMOD0x0
13WAITENSet to 1 if the memory supports this feature, otherwise keep at 0.
12WREN0x1
11WAITCFG0x0
10WRAPMOD0x0
Table 116. FSMC_BCRx bit fields (continued)
Bit No.Bit nameValue to set
9WAITPOLto be set according to memory
8BURSTENno effect on synchronous write
7Reserved0x1
6FACCENSet according to memory support
5-4MWIDAs needed
3-2MTYP[0:1]0x1
1MUXENAs needed
0MBKEN0x1
Table 117. FSMC_BTRx bit fields
Bit No.Bit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x0
27-24DATLATData latency
23-20CLKDIV0x0 to get CLK = HCLK (not supported)
0x1 to get CLK = 2 × HCLK
19-16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK)
15-8DATASTDon't care
7-4ADDHLDDon't care
3-0ADDSET[3:0]Don't care

20.5.6 NOR/PSRAM control registers

The NOR/PSRAM control registers have to be accessed by words (32 bits).

SRAM/NOR-flash chip-select control registers 1..4 (FSMC_BCR1..4)

Address offset: \( 0xA000\ 0000 + 8 * (x - 1) \) , \( x = 1..4 \)

Reset value: 0x0000 30DB for Bank1 and 0x0000 30D2 for Bank 2 to 4

This register contains the control information of each memory bank, used for SRAMs, PSRAM and NOR flash memories.

313029282726252423222120191817161514131211109876543210
ReservedCBURSTRWCPSIZE[2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGWRAPMODWAITPOLBURSTENReservedFACCENMWID[1:0]MTYP[1:0]MUXENMBKEN
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31: 20 Reserved, must be kept at reset value.

Bit 19 CBURSTRW : Write burst enable.

For Cellular RAM (PSRAM) memories, this bit enables the synchronous burst protocol 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 size.

These are used for Cellular RAM 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.

Bit 15 ASYNCWAIT : Wait signal during asynchronous transfers

This bit enables/disables the FSMC to use the wait signal even during an asynchronous protocol.

0: NWAIT signal is not taken into account when running an asynchronous protocol (default after reset)

1: NWAIT signal is taken into account when running an asynchronous protocol

Bit 14 EXTMOD: Extended mode enable.

This 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 Mode1 or Mode2 as follows:

Bit 13 WAITEN: Wait enable bit.

This bit enables/disables wait-state insertion via the NWAIT signal when accessing the flash 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 flash latency period to insert wait states if asserted) (default after reset)

Bit 12 WREN: Write enable bit.

This 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 configuration.

The NWAIT signal indicates whether the data from the memory are valid or if a wait state must be inserted when accessing the flash 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 PRAM).

Bit 10 WRAPMOD: Wrapped burst mode support.

Defines whether the controller splits or not an AHB burst wrap access into two linear accesses. Valid only when accessing memories in burst mode

0: Direct wrapped burst is not enabled (default after reset),

1: Direct wrapped burst is enabled.

Note: This bit has no effect as the CPU and DMA cannot generate wrapping burst transfers.

Bit 9 WAITPOL: Wait signal polarity bit.

Defines the polarity of the wait signal from memory. Valid only when accessing the memory in burst 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 databus width.

Defines the external memory device width, valid for all type of memories.

00: 8 bits,

01: 16 bits (default after reset),

10: reserved, do not use,

11: reserved, do not use.

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 databus, valid only with NOR and PSRAM memories:

0: Address/Data nonmultiplexed

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 registers 1..4 (FSMC_BTR1..4)

Address offset: \( 0xA000\ 0000 + 0x04 + 8 * (x - 1) \) , \( x = 1..4 \)

Reset value: 0x0FFF FFFF

FSMC_BTRx bits are written by software to add a delay at the end of a read /write transaction. This delay allows matching the minimum time between consecutive transactions ( \( t_{EHEL} \) from NEx high to FSMC_NEx low) and the maximum time required by the memory to free the data bus after a read access ( \( t_{EHQZ} \) ).

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).

313029282726252423222120191817161514131211109876543210
ReservedACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BURSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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.

Bits 27:24 DATLAT[3:0] : Data latency for synchronous NOR flash memory (see note below bit description table)

For synchronous NOR flash memory with burst mode enabled, 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. In case of PSRAM (CRAM), this field must be set to 0. In asynchronous NOR flash or SRAM or PSRAM, this value is don't care.

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:

In asynchronous NOR flash, SRAM or PSRAM accesses, this value is don't care.

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. The programmed bus turnaround delay is inserted between an asynchronous read (muxed or D mode) or a write transaction and any other asynchronous/synchronous read or write to/from a static bank (for a read operation, the bank can be the same or a different one; for a write operation, the bank can be different except in muxed or D mode).

In some cases, the bus turnaround delay is fixed, whatever the programmed BUSTURN values:

0000: BUSTURN phase duration = 0 HCLK clock cycle added

...

1111: BUSTURN phase duration = 15 × HCLK clock cycles (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 204 to Figure 216 ), 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 204 to Figure 216 ).

Example: Mode1, 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 213 to Figure 216 ), used in mode D and 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 213 to Figure 216 ).

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 204 to Figure 216 ), used in SRAMs, ROMs and asynchronous NOR flash and PSRAM accesses:

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 (refer to Figure 204 to Figure 216 ).

Note: In synchronous NOR flash and PSRAM accesses, this value is don't care.

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 DATLAT field 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 1..4 (FSMC_BWTR1..4)

Address offset: \( 0xA000\ 0000 + 0x104 + 8 * (x - 1) \) , \( x = 1 \dots 4 \)

Reset value: 0x0FFF FFFF

This register contains the control information of each memory bank, used for SRAMs, PSRAMs and NOR flash memories. This register is active for write asynchronous access only when the EXTMOD bit is set in the FSMC_BCRx register.

313029282726252423222120191817161514131211109876543210
Res.ACCM OD[2:0]ReservedBUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:30 Reserved, must be kept at reset value.

Bits 29:28 ACCMOD[2: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/from a static bank (for a read operation, the bank can be the same or a different one; for a write operation, the bank can be different except in r muxed or D mode).

In some cases, the bus turnaround delay is fixed, whatever the programmed BUSTURN values:

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 204 to Figure 216 ), 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)

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 213 to Figure 216 ), 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 213 to Figure 216 ), used in asynchronous accessed:

0000: ADDSET phase duration = 0 × HCLK clock cycle

...

1111: ADDSET phase duration = 15 × HCLK clock cycles (default value after reset)

Note: In synchronous NOR flash and PSRAM accesses, this value is don't care.

20.5.7 FSMC register map

The following table summarizes the FSMC registers.

Table 118. FSMC register map

OffsetRegister313029282726252423222120191817161514131211109876543210
0000FSMC_BCR1ReservedCBURSTRWCPSIZE[2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGWRAPMODWAITPOLBURSTENReservedFACCENMWID[1:0]MTYP[0:1]MUXENMBKEN
0008FSMC_BCR2ReservedCBURSTRWCPSIZE[2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGWRAPMODWAITPOLBURSTENReservedFACCENMWID[1:0]MTYP[0:1]MUXENMBKEN
0010FSMC_BCR3ReservedCBURSTRWCPSIZE[2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGWRAPMODWAITPOLBURSTENReservedFACCENMWID[1:0]MTYP[0:1]MUXENMBKEN
0018FSMC_BCR4ReservedCBURSTRWCPSIZE[2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGWRAPMODWAITPOLBURSTENReservedFACCENMWID[1:0]MTYP[0:1]MUXENMBKEN
0004FSMC_BTR1Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
000CFSMC_BTR2Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
0014FSMC_BTR3Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
001CFSMC_BTR4Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
0104FSMC_BWTR 1Res.ACCMOD[1:0]Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
010CFSMC_BWTR 2Res.ACCMOD[1:0]Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]

Table 118. FSMC register map (continued)

OffsetRegister313029282726252423222120191817161514131211109876543210
0114FSMC_BWTR 3Res.ACC
MOD
[1:0]
Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
011CFSMC_BWTR 4Res.ACC
MOD
[1:0]
Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]

Refer to for the register boundary addresses.