11. Flexible memory controller (FMC)

11.1 Introduction

The flexible memory controller (FMC) includes one memory controller:

11.2 FSMC main features

The FSMC functional block makes the interface with: synchronous and asynchronous static memories. Its main purposes are:

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:

The Write FIFO is common to all memory controllers and consists of:

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 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 is connected to a 'Configuration registers' block and a 'NOR/PSRAM memory controller' block. The AHB interface receives 'From clock controller HCLK' and has 'FSMC interrupts to NVIC'. A double-headed arrow indicates data flow between the AHB interface and the internal blocks. On the right, the 'NOR/PSRAM memory controller' is connected to external signals: 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 diagram is labeled MSV39279V2.
Figure 31. FSMC block diagram. The diagram shows the internal structure of the FSMC. On the left, an AHB interface is connected to a 'Configuration registers' block and a 'NOR/PSRAM memory controller' block. The AHB interface receives 'From clock controller HCLK' and has 'FSMC interrupts to NVIC'. A double-headed arrow indicates data flow between the AHB interface and the internal blocks. On the right, the 'NOR/PSRAM memory controller' is connected to external signals: 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 diagram is labeled MSV39279V2.

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:

The effect of an 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.

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:

There is no issue in this case.

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.

The transfer may or not be consistent depending on the type of external device:

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.

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

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

AddressBankSupported memory type
0x6000 0000Bank 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
00Bank 1 - NOR/PSRAM 1
01Bank 1 - NOR/PSRAM 2
10Bank 1 - NOR/PSRAM 3
11Bank 1 - NOR/PSRAM 4
  1. 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 memoryMaximum memory capacity (bits)
8-bitHADDR[25:0]64 Mbytes x 8 = 512 Mbits
16-bitHADDR[25:1] >> 164 Mbytes/2 x 16 = 512 Mbits
  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, 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:

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:

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:

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
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
Bust turnDuration of the bus turnaround phaseAsynchronous and synchronous read / writeAHB clock cycle (HCLK)015
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

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

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 nameI/OFunction
CLKOClock (for synchronous access)
A[25:16]OAddress bus
AD[15:0]I/O16-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]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

The maximum capacity is 512 Mbits.

PSRAM/SRAM, non-multiplexed I/Os Table 47. Non-multiplexed 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 (CellularRAM™ i.e. CRAM))
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:0]OByte 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 nameI/OFunction
CLKOClock (for synchronous access)
A[25:16]OAddress bus

Table 48. 16-Bit multiplexed I/O PSRAM (continued)

FSMC signal nameI/OFunction
AD[15:0]I/O16-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]OChip select, x = 1..4 (called NCE by PSRAM (CellularRAM™ i.e. CRAM))
NOEOOutput enable
NWEOWrite enable
NL(= NADV)OAddress valid PSRAM input (memory signal name: NADV)
NWAITIPSRAM wait input signal to the FSMC
NBL[1:0]OByte 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

DeviceModeR/WAHB data sizeMemory data sizeAllowed/not allowedComments
NOR flash (muxed I/Os and nonmuxed I/Os)AsynchronousR816Y-
AsynchronousW816N-
AsynchronousR1616Y-
AsynchronousW1616Y-
AsynchronousR3216YSplit into 2 FSMC accesses
AsynchronousW3216YSplit into 2 FSMC accesses
Asynchronous pageR-16NMode is not supported
SynchronousR816N-
SynchronousR1616Y-
SynchronousR3216Y-
Table 49. NOR flash/PSRAM: example of supported memories and transactions (continued)
DeviceModeR/WAHB data sizeMemory data sizeAllowed/not allowedComments
PSRAM (multiplexed I/Os and non-multiplexed I/Os)AsynchronousR816Y-
AsynchronousW816YUse of byte lanes NBL[1:0]
AsynchronousR1616Y-
AsynchronousW1616Y-
AsynchronousR3216YSplit into 2 FSMC accesses
AsynchronousW3216YSplit into 2 FSMC accesses
Asynchronous pageR-16NMode is not supported
SynchronousR816N-
SynchronousR1616Y-
SynchronousR3216Y-
SynchronousW816YUse of byte lanes NBL[1:0]
SynchronousW16/3216Y-
SRAM and ROMAsynchronousR8 / 1616Y-
AsynchronousW8 / 1616YUse of byte lanes NBL[1:0]
AsynchronousR3216YSplit into 2 FSMC accesses
AsynchronousW3216YSplit into 2 FSMC accesses
Use of byte lanes NBL[1:0]

11.6.3 General timing rules

Signals synchronization

11.6.4 NOR flash/PSRAM controller asynchronous transactions

Asynchronous static memories (NOR flash, 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 33. Mode 1 read access waveforms

Timing diagram for Mode 1 read access waveforms showing address, bus cycle, and data signals over time.

The diagram illustrates the timing for a Mode 1 read access. It shows the following signals over time:

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

The total duration of the transaction is labeled "Memory transaction".

MS34477V1

Timing diagram for Mode 1 read access waveforms showing address, bus cycle, and data signals over time.

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 illustrates the 'Memory transaction' period, 'ADDSET' time in HCLK cycles, and the data drive period '(DATAST + 1)' in HCLK cycles. A single HCLK cycle is also indicated.

The diagram shows the timing for a Mode 1 write access. The signals are:

Key timing parameters:

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 illustrates the 'Memory transaction' period, 'ADDSET' time in HCLK cycles, and the data drive period '(DATAST + 1)' in HCLK cycles. A single HCLK cycle is also indicated.

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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLENAs needed
19CBURSTRW0x0 (no effect in Asynchronous mode)
18:16CPSIZE0x0 (no effect in Asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x0
13WAITEN0x0 (no effect in Asynchronous mode)
12WRENAs needed
11Reserved0x0
10Reserved0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCENDon't care
Table 50. FSMC_BCRx bitfields (mode 1) (continued)
Bit numberBit nameValue to set
5:4MWIDAs needed
3:2MTYPAs needed, exclude 0x2 (NOR flash memory)
1MUXE0x0
0MBKEN0x1
Table 51. FSMC_BTRx bitfields (mode 1)
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:0ADDSETDuration 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 a memory transaction with ADDSET and DATAST phases in HCLK cycles. Data is driven by memory during the DATAST phase.

The diagram illustrates the timing for a read access in Mode A. The signals shown are:

Timing parameters:

Reference: MS34479V1

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 a memory transaction with ADDSET and DATAST phases in HCLK cycles. Data is driven by memory during the DATAST phase.

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 a memory transaction with ADDSET and (DATAST + 1) phases in HCLK cycles. Data is driven by FSMC during the (DATAST + 1) phase.

The diagram illustrates the timing for a write access in Mode A. The signals shown are:

Timing parameters:

Reference: MS34480V1

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 a memory transaction with ADDSET and (DATAST + 1) phases in HCLK cycles. Data is driven by FSMC during the (DATAST + 1) phase.

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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLKENAs needed
19CBURSTRW0x0 (no effect in Asynchronous mode)
18:16CPSIZE0x0 (no effect in Asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x1
13WAITEN0x0 (no effect in Asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10Reserved0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCENDon't care
5:4MWIDAs needed
3:2MTYPAs needed, exclude 0x2 (NOR flash memory)
1MUXEN0x0
0MBKEN0x1

Table 53. FSMC_BTRx bitfields (mode A)

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:0ADDSETDuration 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 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 write accesses.
7:4ADDHLDDon't care
3:0ADDSETDuration 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, control signals, and data over time.

The diagram illustrates the timing for a read access in Mode 2 or Mode B. 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 its rising edge. The identifier 'MS34481V2' is located in the bottom right corner.

Timing diagram for Mode 2 and mode B read access waveforms showing address, control signals, and data over time.

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 like ADDSET, (DATAST + 1), and 1HCLK.

This timing diagram illustrates the signals and timing parameters for a Mode 2 write access. The signals shown are:

Timing parameters are defined as follows:

Reference code: MS34482V2

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 like ADDSET, (DATAST + 1), and 1HCLK.

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 like ADDSET, (DATAST + 1), and 1HCLK.

This timing diagram illustrates the signals and timing parameters for a Mode B write access. The signals shown are:

Timing parameters are defined as follows:

Reference code: MSV40114V1

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 like ADDSET, (DATAST + 1), and 1HCLK.

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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLKENAs needed
19CBURSTRW0x0 (no effect in Asynchronous mode)
18:16CPSIZE0x0 (no effect in 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 in Asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10Reserved0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCEN0x1
5:4MWIDAs needed
3:2MTYP0x2 (NOR flash memory)
1MUXEN0x0
0MBKEN0x1
Table 56. FSMC_BTRx bitfields (mode 2/B)
Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x1 if Extended mode is set
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK).
15:8DATASTDuration of the access second phase (DATAST HCLK cycles) for read accesses.
7:4ADDHLDDon't care
3:0ADDSETDuration 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 numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x1 if Extended mode is set
27:24DATLATDon't care
23:20CLKDIVDon't care
19:16BUSTURNTime between NEx high to NEx low (BUSTURN HCLK).
15:8DATASTDuration of the access second phase (DATAST HCLK cycles) for write accesses.
7:4ADDHLDDon't care
3:0ADDSETDuration 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 showing address (A[25:0]), NADV, NEx, NOE, NWE, and data (D[15:0]) signals over time. The diagram illustrates the 'Memory transaction' period, 'ADDSET HCLK cycles', and 'DATAST HCLK cycles'. Data is shown as 'data driven by memory' during the second phase.

The diagram shows the timing for a read access in Mode C. The address A[25:0] is stable during the entire 'Memory transaction'. NADV (Address Valid) goes low at the start and high at the end. NEx (External memory output control) goes low at the start and high at the end. NOE (Output Enable) goes low at the start and high at the end. NWE (Write Enable) remains high throughout. The data D[15:0] is driven by the memory during the second phase (DATAST HCLK cycles). The first phase is ADDSET HCLK cycles and the second is DATAST HCLK cycles.

Timing diagram for Mode C read access waveforms showing address (A[25:0]), NADV, NEx, NOE, NWE, and data (D[15:0]) signals over time. The diagram illustrates the 'Memory transaction' period, 'ADDSET HCLK cycles', and 'DATAST HCLK cycles'. Data is shown as 'data driven by memory' during the second phase.

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

The diagram shows the timing for a Mode C write access. The signals shown are address A[25:0], address valid (NADV), next external (NEx), output enable (NOE), write enable (NWE), and data D[15:0]. The 'Memory transaction' starts when A[25:0] is stable and NADV goes low. NEx goes low at the start and stays low until the end of the transaction. NOE goes low at the start and goes high at the end. NWE goes low at the start and goes high after the data is driven. D[15:0] is driven by the FSMC. The time from the start of the transaction to the start of data driving is 'ADDSET' HCLK cycles. The time from the start of data driving to the end of the transaction is '(DATAST + 1)' HCLK cycles. A '1HCLK' cycle is also indicated.

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

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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLKENAs needed
19CBURSTRW0x0 (no effect in Asynchronous mode)
18:16CPSIZE0x0 (no effect in Asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x1
13WAITEN0x0 (no effect in Asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10Reserved0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCEN0x1
5:4MWIDAs needed
Table 58. FSMC_BCRx bitfields (mode C) (continued)
Bit numberBit nameValue to set
3:2MTYP0x02 (NOR flash memory)
1MUXEN0x0
0MBKEN0x1
Table 59. FSMC_BTRx bitfields (mode C)
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:0ADDSETDuration of the first access phase (ADDSET HCLK cycles) for read accesses. Minimum value for ADDSET is 0.
Table 60. FSMC_BWTRx bitfields (mode C)
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 HCLK cycles) for write accesses.
7:4ADDHLDDon't care
3:0ADDSETDuration 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' period and timing parameters: ADDSET, ADDHLD, and DATAST in HCLK cycles. Data is driven by memory.

The diagram shows the timing for a read access in Mode D. The address A[25:0] is stable during the '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 to enable data output. NWE is high. Data D[15:0] is driven by memory. Timing parameters are defined as: ADDSET (HCLK cycles) from the start of the transaction to the start of data output; ADDHLD (HCLK cycles) from the start of data output to the end of the transaction; and DATAST (HCLK cycles) from the start of data output to the end of data output.

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' period and timing parameters: ADDSET, ADDHLD, and DATAST in HCLK cycles. Data is driven by memory.

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' period and timing parameters: ADDSET, ADDHLD, and (DATAST+ 1) in HCLK cycles. Data is driven by FSMC.

The diagram shows the timing for a write access in Mode D. The address A[25:0] is stable during the '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 to enable data input. Data D[15:0] is driven by FSMC. Timing parameters are defined as: ADDSET (HCLK cycles) from the start of the transaction to the start of data input; ADDHLD (HCLK cycles) from the start of data input to the end of the transaction; and (DATAST+ 1) (HCLK cycles) from the start of data input to the end of data input. A 1HCLK cycle is indicated between the end of data input and the end of the transaction.

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' period and timing parameters: ADDSET, ADDHLD, and (DATAST+ 1) in HCLK cycles. Data is driven by FSMC.

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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLKENAs needed
19CBURSTRW0x0 (no effect in Asynchronous mode)
18:16CPSIZE0x0 (no effect in Asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x1
13WAITEN0x0 (no effect in Asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10Reserved0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCENSet according to memory support
5:4MWIDAs needed
3:2MTYPAs needed
1MUXEN0x0
0MBKEN0x1

Table 62. FSMC_BTRx bitfields (mode D)

Bit numberBit 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:0ADDSETDuration 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 numberBit 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 + 1 HCLK cycles) for write accesses.
7:4ADDHLDDuration of the middle phase of the write access (ADDHLD HCLK cycles)
3:0ADDSETDuration 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 address, data, and control signals over time.

The diagram illustrates the timing for a read access in muxed mode. The signals shown are:

Timing parameters are defined as follows:

The total 'Memory transaction' duration is the sum of these three phases. The diagram is labeled with 'ai15568' in the bottom right corner.

Timing diagram for muxed read access waveforms showing address, data, and control signals over time.

Figure 45. Muxed write access waveforms

Timing diagram for Muxed write access waveforms showing signals A[25:16], NADV, NEx, NOE, NWE, and AD[15:0] over time. The diagram illustrates the sequence of address and data on the AD bus during a memory transaction, with timing parameters ADDSET, ADDHLD, and (DATAST + 1) in HCLK cycles. A 1HCLK cycle duration is also indicated.

The diagram shows the following signals and timing parameters:

MSV40112V2

Timing diagram for Muxed write access waveforms showing signals A[25:16], NADV, NEx, NOE, NWE, and AD[15:0] over time. The diagram illustrates the sequence of address and data on the AD bus during a memory transaction, with timing parameters ADDSET, ADDHLD, and (DATAST + 1) in HCLK cycles. A 1HCLK cycle duration is also indicated.

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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLKENAs needed
19CBURSTRW0x0 (no effect in Asynchronous mode)
18:16CPSIZE0x0 (no effect in Asynchronous mode)
15ASYNCWAITSet to 1 if the memory supports this feature. Otherwise keep at 0.
14EXTMOD0x0
13WAITEN0x0 (no effect in Asynchronous mode)
12WRENAs needed
11WAITCFGDon't care
10Reserved0x0
9WAITPOLMeaningful only if bit 15 is 1
8BURSTEN0x0
7Reserved0x1
6FACCEN0x1
5:4MWIDAs needed
Table 64. FSMC_BCRx bitfields (Muxed mode) (continued)
Bit numberBit nameValue to set
3:2MTYP0x2 (NOR flash memory) or 0x1(PSRAM)
1MUXEN0x1
0MBKEN0x1
Table 65. FSMC_BTRx bitfields (Muxed mode)
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 and DATAST+1 HCLK cycles for write accesses).
7:4ADDHLDDuration of the middle phase of the access (ADDHLD HCLK cycles).
3:0ADDSETDuration 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. 1. The memory asserts the WAIT signal aligned to NOE/NWE which toggles:

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

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

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

then:

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

otherwise

\[ \text{DATAST} \geq 4 \times \text{HCLK} \]

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 signals over time: A[25:0] (Address), NEx (Active-low memory address strobe), NWAIT (Active-low wait signal), NOE (Active-low output enable), and D[15:0] (Data bus). The 'Memory transaction' starts when A[25:0] is stable and NEx goes low. It is divided into 'address phase' (from NEx falling to NOE falling) and 'data setup phase' (from NOE falling to NEx rising). NWAIT is shown as 'don't care' before the address phase and after the data setup phase. During the data setup phase, NWAIT is asserted (goes low) and then released (goes high) before NOE goes high. Data D[15:0] is driven by memory starting from the falling edge of NOE. A '4HCLK' period is indicated from the falling edge of NOE to the rising edge of NEx.
Timing diagram for asynchronous wait during a read access. The diagram shows five signals over time: A[25:0] (Address), NEx (Active-low memory address strobe), NWAIT (Active-low wait signal), NOE (Active-low output enable), and D[15:0] (Data bus). The 'Memory transaction' starts when A[25:0] is stable and NEx goes low. It is divided into 'address phase' (from NEx falling to NOE falling) and 'data setup phase' (from NOE falling to NEx rising). NWAIT is shown as 'don't care' before the address phase and after the data setup phase. During the data setup phase, NWAIT is asserted (goes low) and then released (goes high) before NOE goes high. Data D[15:0] is driven by memory starting from the falling edge of NOE. A '4HCLK' period is indicated from the falling edge of NOE to the rising edge of NEx.
  1. 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 signals over time: A[25:0] (Address), NEx (Next), NWAIT (Wait), NWE (Write Enable), and D[15:0] (Data). The 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 FSMC during the data setup phase. The diagram also indicates the relationship between HCLK and 3HCLK.

The diagram illustrates the timing for an asynchronous write access with a wait state. The signals shown are:

The transaction is divided into two phases: address phase and data setup phase . The data setup phase is shown as a period where the data is driven by FSMC. The diagram also indicates the relationship between HCLK and 3HCLK.

MS30464V2

Timing diagram for asynchronous wait during a write access. The diagram shows five signals over time: A[25:0] (Address), NEx (Next), NWAIT (Wait), NWE (Write Enable), and D[15:0] (Data). The 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 FSMC during the data setup phase. The diagram also indicates the relationship between HCLK and 3HCLK.
  1. 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:

\[ \text{FSMC\_CLK divider ratio} = \max(\text{CLKDIV} + 1, \text{MWID}(\text{AHB data size})) \]

Whatever MWID size: 16 or 8-bit, the FSMC_CLK divider ratio is always defined by the programmed CLKDIV value.

Example:

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:

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 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 HCLK, CLK, A[25:16], NADV, NWAIT (WAITCFG = 0), NWAIT (WAITCFG = 1), and A/D[15:0] signals during a memory transaction. It illustrates the effect of inserting a wait state when WAITCFG is 1.

The diagram illustrates the timing of a memory transaction, defined as a burst of 4 half words. The signals shown are:

The diagram shows that when NWAIT (WAITCFG = 1) is sampled high between the second and third data phases, an inserted wait state occurs, delaying the third data transfer. Vertical dashed lines indicate clock edges for sampling.

Timing diagram showing HCLK, CLK, A[25:16], NADV, NWAIT (WAITCFG = 0), NWAIT (WAITCFG = 1), and A/D[15:0] signals during a memory transaction. It illustrates the effect of inserting a wait state when WAITCFG is 1.

ai15798c

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

Timing diagram for synchronous multiplexed read mode. It 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. The diagram illustrates a burst of 4 half-words (data1, data2, data3, data4) being read. Addressing starts with addr[25:16] and Add[15:0]. Data strobes are shown for the data outputs. The timing includes (DATLAT + 2) CLK cycles for data latency and an inserted wait state.

Memory transaction = burst of 4 half words

HCLK

CLK

A[25:16] addr[25:16]

NEx

NOE

NWE High

NADV

NWAIT (WAITCFG=0)

A/D[15:0] Add[15:0] data1 data1 data2 data3 data4

1 clock cycle 1 clock cycle

(DATLAT + 2) CLK cycles

inserted wait state

Data strobes

ai17723g

Timing diagram for synchronous multiplexed read mode. It 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. The diagram illustrates a burst of 4 half-words (data1, data2, data3, data4) being read. Addressing starts with addr[25:16] and Add[15:0]. Data strobes are shown for the data outputs. The timing includes (DATLAT + 2) CLK cycles for data latency and an inserted wait state.
  1. 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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLKENAs needed
19CBURSTRWNo effect on synchronous read
18:16CPSIZE0x0 (no effect in Asynchronous mode)
15ASYNCWAIT0x0
14EXTMOD0x0
13WAITENTo be set to 1 if the memory supports this feature, to be kept at 0 otherwise
12WRENNo effect on synchronous read
Table 66. FSMC_BCRx bitfields (Synchronous multiplexed read mode) (continued)
Bit numberBit nameValue to set
11WAITCFGTo be set according to memory
10Reserved0x0
9WAITPOLTo be set according to memory
8BURSTEN0x1
7Reserved0x1
6FACCENSet according to memory support (NOR flash memory)
5-4MWIDAs needed
3-2MTYP0x1 or 0x2
1MUXENAs needed
0MBKEN0x1
Table 67. FSMC_BTRx bitfields (Synchronous multiplexed read mode)
Bit numberBit nameValue to set
31:30Reserved0x0
29:28ACCMOD0x0
27-24DATLATData latency
27-24DATLATData latency
23-20CLKDIV0x0 to get CLK = HCLK
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-0ADDSETDon't care

Figure 50. Synchronous multiplexed write mode waveforms - 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], data1, data1, data2). A 'Memory transaction = burst of 2 half words' is indicated. Timing parameters include '(DATLAT + 2) CLK cycles' and 'inserted wait state'.

The diagram illustrates the timing for a synchronous multiplexed write mode transaction. HCLK is the system clock. CLK is the memory clock. A[25:16] provides the address (addr[25:16]). NEx is the active-low address and data strobe. NOE is active-low output enable, held high (Hi-Z). NWE is active-low write enable. NADV is active-low address valid. NWAIT is the active-low wait signal from the memory. A/D[15:0] is the bidirectional data bus, which outputs the address (Addr[15:0]) and then the data (data1, data1, data2). A 'Memory transaction = burst of 2 half words' is shown. The address is valid for 1 clock cycle. The data burst starts after (DATLAT + 2) CLK cycles. An 'inserted wait state' is shown between the two data1 outputs. The diagram is labeled ai14731g.

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], data1, data1, data2). A 'Memory transaction = burst of 2 half words' is indicated. Timing parameters include '(DATLAT + 2) CLK cycles' and 'inserted wait state'.
  1. 1. The memory must issue NWAIT signal one cycle in advance, accordingly WAITCFG must be programmed to 0.
  2. 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 numberBit nameValue to set
31:22Reserved0x000
21WFDISAs needed
20CCLKENAs needed
19CBURSTRW0x1
18:16CPSIZEAs needed (0x1 for CRAM 1.5)
15ASYNCWAIT0x0
14EXTMOD0x0
13WAITENTo be set to 1 if the memory supports this feature, to be kept at 0 otherwise.
Table 68. FSMC_BCRx bitfields (Synchronous multiplexed write mode) (continued)
Bit numberBit nameValue to set
12WREN0x1
11WAITCFG0x0
10Reserved0x0
9WAITPOLto be set according to memory
8BURSTENno effect on synchronous write
7Reserved0x1
6FACCENSet according to memory support
5-4MWIDAs needed
3-2MTYP0x1
1MUXENAs needed
0MBKEN0x1
Table 69. FSMC_BTRx bitfields (Synchronous multiplexed write mode)
Bit numberBit nameValue to set
31-30Reserved0x0
29:28ACCMOD0x0
27-24DATLATData latency
23-20CLKDIV0x0 to get CLK = HCLK
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-0ADDSETDon'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.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WFDISCCLK ENCBURST RWCPSIZE[2:0]
rwrwrwrwrwrw

1514131211109876543210
ASYNC WAITEXT MODWAIT ENWRENWAIT CFGRes.WAIT POLBURST ENRes.FACC ENMWID[1:0]MTYP[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

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 size

These 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 transfers

This 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 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 mode 1 or mode 2 as follows:

Bit 13 WAITEN : Wait enable bit

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 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 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 bit

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

31302928272625242322212019181716
Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BURSTN[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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] : (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.

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.

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:

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.

31302928272625242322212019181716
ResResACCMOD[1:0]ResResResResResResResResBUSTURN[3:0]
rwrwrwrwrwrw
1514131211109876543210
DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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:

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

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x00FSMC_BCR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WFDISCCLKENCBURSTRWCPSIZE [2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value00000000110001011011
0x08FSMC_BCR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CBURSTRWCPSIZE [2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value000000110001010010
0x10FSMC_BCR3Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CBURSTRWCPSIZE [2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value000000110001010010
0x18FSMC_BCR4Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CBURSTRWCPSIZE [2:0]ASYNCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value000000110001010010
0x04FSMC_BTR1Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111111111111
0x0CFSMC_BTR2Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111111111111
0x14FSMC_BTR3Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111111111111

Table 70. FSMC register map and reset values (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
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.
0x1CFSMC_BTR4ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value00111111111111111111111111111111
0x104FSMC_BWTR1ACCMOD[1:0]Res.Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111
0x10CFSMC_BWTR2ACCMOD[1:0]Res.Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111
0x114FSMC_BWTR3ACCMOD[1:0]Res.Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111
0x11CFSMC_BWTR4ACCMOD[1:0]Res.Res.BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111
Refer to Section 2.2 on page 57 for the register boundary addresses.