11. Flexible static memory controller (FSMC)

11.1 Introduction

The flexible static memory controller (FSMC) 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 connects to 'Configuration registers' and a 'NOR/PSRAM memory controller'. The AHB interface receives 'From clock controller HCLK' and sends 'FSMC interrupts to NVIC'. A double-headed arrow indicates bidirectional data flow between the AHB interface and the internal blocks. On the right, the 'NOR/PSRAM memory controller' outputs various signals to external devices: 'FSMC_NL (or NADV)' and 'FSMC_CLK' (labeled as NOR/PSRAM signals); 'FSMC_NBL[1:0]' (labeled as NOR / PSRAM / SRAM shared signals); 'FSMC_A[25:0]' and 'FSMC_D[15:0]' (labeled as Shared signals); and 'FSMC_NE[4:1]', 'FSMC_NOE', 'FSMC_NWE', and 'FSMC_NWAIT' (labeled as NOR / PSRAM / SRAM shared signals). The signal names are in small boxes with arrows pointing to them from the controller block. A reference code 'MSV39279V2' is in the bottom right corner.
Figure 31. FSMC block diagram. The diagram shows the internal structure of the FSMC. On the left, an AHB interface connects to 'Configuration registers' and a 'NOR/PSRAM memory controller'. The AHB interface receives 'From clock controller HCLK' and sends 'FSMC interrupts to NVIC'. A double-headed arrow indicates bidirectional data flow between the AHB interface and the internal blocks. On the right, the 'NOR/PSRAM memory controller' outputs various signals to external devices: 'FSMC_NL (or NADV)' and 'FSMC_CLK' (labeled as NOR/PSRAM signals); 'FSMC_NBL[1:0]' (labeled as NOR / PSRAM / SRAM shared signals); 'FSMC_A[25:0]' and 'FSMC_D[15:0]' (labeled as Shared signals); and 'FSMC_NE[4:1]', 'FSMC_NOE', 'FSMC_NWE', and 'FSMC_NWAIT' (labeled as NOR / PSRAM / SRAM shared signals). The signal names are in small boxes with arrows pointing to them from the controller block. A reference code 'MSV39279V2' is in the bottom right corner.

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

Diagram of FSMC memory banks showing address range 0x6000 0000 to 0x6FFF FFFF for Bank 1 (4 x 64 MB) supporting NOR/PSRAM/SRAM. Reference MS34476V1.
AddressBankSupported memory type
0x6000 0000Bank 1
4 x 64 MB
NOR/PSRAM/SRAM
0x6FFF FFFF

MS34476V1

Diagram of FSMC memory banks showing address range 0x6000 0000 to 0x6FFF FFFF for Bank 1 (4 x 64 MB) supporting NOR/PSRAM/SRAM. Reference 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. 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. CDRAM))
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, enable, 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:

A horizontal double-headed arrow at the top indicates the total "Memory transaction" duration. The identifier MS34477V1 is located in the bottom right corner.

Timing diagram for Mode 1 read access waveforms showing address, bus cycle, enable, 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 shows the relationship between address, data, and control signals during a write transaction, including setup and hold times relative to the HCLK signal.

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

Key timing parameters shown:The diagram shows the FSMC driving the address and data, and controlling the memory via NWE and NEx signals. The data is driven by the FSMC during the transaction.

Timing diagram for Mode 1 write access waveforms showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the relationship between address, data, and control signals during a write transaction, including setup and hold times relative to the HCLK signal.

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 the sequence of address, data, and control signals during a read operation, with ADDSET and DATAST timing parameters.

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

Timing parameters are defined as:

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 the sequence of address, data, and control signals during a read operation, with ADDSET and DATAST timing parameters.

Figure 36. Mode A write access waveforms

Timing diagram for Mode A write access waveforms showing signals A[25:0], NBL[1:0], NEx, NOE, NWE, and D[15:0] over time. The diagram shows the sequence of address, data, and control signals during a write operation, with ADDSET and (DATAST + 1) timing parameters.

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

Timing parameters are defined as:

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 the sequence of address, data, and control signals during a write operation, with ADDSET and (DATAST + 1) timing parameters.

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 (A[25:0]), NADV, NEx, NOE, NWE, and data (D[15:0]) signals over time. The diagram illustrates the ADDSET and DATAST phases in HCLK cycles.

The timing diagram shows the following signals and phases:

MS34481V2

Timing diagram for Mode 2 and mode B read access waveforms showing address (A[25:0]), NADV, NEx, NOE, NWE, and data (D[15:0]) signals over time. The diagram illustrates the ADDSET and DATAST phases in HCLK cycles.

Figure 38. Mode 2 write access waveforms

Timing diagram for Mode 2 write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over a memory transaction. The diagram includes timing parameters ADDSET, (DATAST + 1), and 1HCLK.

This timing diagram illustrates the Mode 2 write access waveforms. The signals shown are address lines A[25:0], address strobe NADV, next address signal NEx, output enable NOE, write enable NWE, and data lines D[15:0]. The memory transaction is divided into two phases: address setup (ADDSET HCLK cycles) and data drive (DATAST + 1 HCLK cycles). The data is driven by the FMC. The NWE signal is active-low and toggles. The NOE signal is active-low and remains high during the write transaction. The NEx signal is active-low and remains low throughout the transaction. The NADV signal is active-low and goes low at the start of the address setup phase and returns high at the start of the data drive phase. The address lines A[25:0] are stable during the address setup phase. The data lines D[15:0] are driven by the FMC during the data drive phase. The timing parameter 1HCLK represents one HCLK cycle.

Timing diagram for Mode 2 write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over a memory transaction. The diagram includes timing parameters ADDSET, (DATAST + 1), and 1HCLK.

MS34482V2

Figure 39. Mode B write access waveforms

Timing diagram for Mode B write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over a memory transaction. The diagram includes timing parameters ADDSET, (DATAST + 1), and 1HCLK.

This timing diagram illustrates the Mode B write access waveforms. The signals shown are address lines A[25:0], address strobe NADV, next address signal NEx, output enable NOE, write enable NWE, and data lines D[15:0]. The memory transaction is divided into two phases: address setup (ADDSET HCLK cycles) and data drive (DATAST + 1 HCLK cycles). The data is driven by the FSMC. The NWE signal is active-low and toggles. The NOE signal is active-low and remains high during the write transaction. The NEx signal is active-low and remains low throughout the transaction. The NADV signal is active-low and goes low at the start of the address setup phase and returns high at the start of the data drive phase. The address lines A[25:0] are stable during the address setup phase. The data lines D[15:0] are driven by the FSMC during the data drive phase. The timing parameter 1HCLK represents one HCLK cycle.

Timing diagram for Mode B write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over a memory transaction. The diagram includes timing parameters ADDSET, (DATAST + 1), and 1HCLK.

MSV40114V1

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

Table 55. FSMC_BCRx bitfields (mode 2/B)
Bit 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. The diagram shows the relationship between address (A[25:0]), address strobe (NADV), chip select (NEx), output enable (NOE), write enable (NWE), and data (D[15:0]) signals during a memory transaction. The transaction is divided into two phases: ADDSET (first phase) and DATAST (second phase), measured in HCLK cycles. The data is driven by memory during the DATAST phase.

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

The timing parameters are defined as:

Reference: MS34484V1

Timing diagram for Mode C read access waveforms. The diagram shows the relationship between address (A[25:0]), address strobe (NADV), chip select (NEx), output enable (NOE), write enable (NWE), and data (D[15:0]) signals during a memory transaction. The transaction is divided into two phases: ADDSET (first phase) and DATAST (second phase), measured in HCLK cycles. The data is driven by memory during the DATAST phase.

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 write access in Mode C. The signals shown are address A[25:0], address latch strobe NADV, external memory strobe NEx, output enable NOE, write enable NWE, and data D[15:0]. The 'Memory transaction' starts when A[25:0] is valid and NADV goes low, and ends when NEx goes high. ADDSET is the time from the start of the transaction to when data starts being driven. (DATAST + 1) is the duration for which data is driven. 1HCLK is one clock cycle.

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

The diagram shows the timing for a read access in Mode D. The address A[25:0] is stable during the entire memory transaction. NADV and NEx are active-low signals that go low at the start and high at the end of the transaction. NOE is active-low and goes low during the data read phase. NWE is high throughout. The data bus D[15:0] is driven by memory during the DATAST phase. The timing parameters are defined as follows:

MS34486V1

Timing diagram for Mode D read access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the memory transaction phases: ADDSET, ADDHLD, and DATAST in HCLK cycles. Data is driven by memory during the DATAST phase.

Figure 43. Mode D write access waveforms

Timing diagram for Mode D write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the memory transaction phases: ADDSET, ADDHLD, and (DATAST+ 1) in HCLK cycles. Data is driven by FSMC during the (DATAST+ 1) phase.

The diagram shows the timing for a write access in Mode D. The address A[25:0] is stable during the entire memory transaction. NADV and NEx are active-low signals that go low at the start and high at the end of the transaction. NOE is active-low and goes low at the start. NWE is active-low and goes low during the data write phase. The data bus D[15:0] is driven by FSMC during the (DATAST+ 1) phase. The timing parameters are defined as follows:

ai15567

Timing diagram for Mode D write access waveforms showing signals A[25:0], NADV, NEx, NOE, NWE, and D[15:0] over time. The diagram illustrates the memory transaction phases: ADDSET, ADDHLD, and (DATAST+ 1) in HCLK cycles. Data is driven by FSMC during the (DATAST+ 1) phase.

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 signals A[25:16], NADV, NEx, NOE, NWE, and AD[15:0] over time. The diagram illustrates the 'Memory transaction' period and the durations for ADDSET, ADDHLD, and DATAST in HCLK cycles. Address and data phases are labeled on the AD[15:0] signal line.

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

The timing parameters are defined as:The total 'Memory transaction' duration is the sum of these three phases.

Timing diagram for muxed read access waveforms showing signals A[25:16], NADV, NEx, NOE, NWE, and AD[15:0] over time. The diagram illustrates the 'Memory transaction' period and the durations for ADDSET, ADDHLD, and DATAST in HCLK cycles. Address and data phases are labeled on the AD[15:0] signal line.

Figure 45. Muxed write access waveforms

Timing diagram for Muxed write access waveforms. The diagram shows the relationship between address lines A[25:16], control signals NADV, NEx, NOE, NWE, and data lines AD[15:0] during a memory transaction. The transaction is divided into three phases: ADDSET (HCLK cycles), ADDHLD (HCLK cycles), and (DATAST + 1) (HCLK cycles). The AD[15:0] lines are used for 'Lower address' during ADDSET and 'data driven by FSMC' during the final phase. A 1HCLK cycle is indicated between the start of the data phase and the end of the transaction.
Timing diagram for Muxed write access waveforms. The diagram shows the relationship between address lines A[25:16], control signals NADV, NEx, NOE, NWE, and data lines AD[15:0] during a memory transaction. The transaction is divided into three phases: ADDSET (HCLK cycles), ADDHLD (HCLK cycles), and (DATAST + 1) (HCLK cycles). The AD[15:0] lines are used for 'Lower address' during ADDSET and 'data driven by FSMC' during the final phase. A 1HCLK cycle is indicated between the start of the data phase and the end of the transaction.

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 signal lines: A[25:0] (Address), NEx (Active-low Address Strobe), NWAIT (Active-low Wait signal), NOE (Active-low Output Enable), and D[15:0] (Data). The sequence starts with the address phase where A[25:0] is stable and NEx is asserted. Then the data setup phase begins, where NOE is asserted and data is driven by memory. The NWAIT signal is shown as 'don't care' during the address phase and becomes active (low) during the data setup phase. The data is driven by memory for a duration of 4HCLK cycles. The memory transaction ends when NEx is deasserted. The diagram is labeled MS30463V2.
Timing diagram for asynchronous wait during a read access. The diagram shows five signal lines: A[25:0] (Address), NEx (Active-low Address Strobe), NWAIT (Active-low Wait signal), NOE (Active-low Output Enable), and D[15:0] (Data). The sequence starts with the address phase where A[25:0] is stable and NEx is asserted. Then the data setup phase begins, where NOE is asserted and data is driven by memory. The NWAIT signal is shown as 'don't care' during the address phase and becomes active (low) during the data setup phase. The data is driven by memory for a duration of 4HCLK cycles. The memory transaction ends when NEx is deasserted. The diagram is labeled MS30463V2.
  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 signal waveforms over time: A[25:0] (Address), NEx (Next), NWAIT (Wait), NWE (Write Enable), and D[15:0] (Data). The 'Memory transaction' is divided into an 'address phase' and a 'data setup phase'. The NWAIT signal is shown as 'don't care' during the address phase and 'data setup phase'. The data is driven by the FSMC during the data setup phase. The diagram also indicates the relationship between HCLK and 3HCLK.

The diagram illustrates the timing for an asynchronous write access. The address A[25:0] is stable during the 'address phase'. The NEx signal is active low. The NWAIT signal is sampled during the 'data setup phase'. The NWE signal is active low. The data D[15:0] is driven by the FSMC during the 'data setup phase'. The HCLK signal is shown, and the 3HCLK period is indicated. The diagram is labeled MS30464V2.

Timing diagram for asynchronous wait during a write access. The diagram shows five signal waveforms over time: A[25:0] (Address), NEx (Next), NWAIT (Wait), NWE (Write Enable), and D[15:0] (Data). The 'Memory transaction' is divided into an 'address phase' and a 'data setup phase'. The NWAIT signal is shown as 'don't care' during the address phase and 'data setup phase'. The data is driven by the FSMC during the data setup phase. The diagram also indicates the relationship between HCLK and 3HCLK.
  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 wait configuration waveforms for HCLK, CLK, A[25:16], NADV, NWAIT (WAITCFG = 0), NWAIT (WAITCFG = 1), and A/D[15:0]. It illustrates a memory transaction burst of 4 half words with an inserted wait state.

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

An arrow labeled "inserted wait state" indicates the period between the first and second data words when WAITCFG is 1. The diagram is identified by the code ai15798c.

Timing diagram showing wait configuration waveforms for HCLK, CLK, A[25:16], NADV, NWAIT (WAITCFG = 0), NWAIT (WAITCFG = 1), and A/D[15:0]. It illustrates a memory transaction burst of 4 half words with an inserted wait state.

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

Timing diagram for synchronous multiplexed read mode. It shows signals HCLK, CLK, A[25:16], NEx, NOE, NWE, NADV, NWAIT, and A/D[15:0] over time. A memory transaction is shown as a burst of 4 half words (data1, data2, data3, data4). Addressing starts with addr[25:16] and Add[15:0]. Data strobes are indicated for each data word. An inserted wait state is shown between data1 and data2. The diagram is labeled ai17723g.
Timing diagram for synchronous multiplexed read mode. It shows signals HCLK, CLK, A[25:16], NEx, NOE, NWE, NADV, NWAIT, and A/D[15:0] over time. A memory transaction is shown as a burst of 4 half words (data1, data2, data3, data4). Addressing starts with addr[25:16] and Add[15:0]. Data strobes are indicated for each data word. An inserted wait state is shown between data1 and data2. The diagram is labeled ai17723g.
  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 waveforms. The diagram shows the relationship between HCLK, CLK, address lines A[25:16] and A/D[15:0], and control signals NEx, NOE, NWE, NADV, and NWAIT. A memory transaction is shown as a burst of 2 half words. The address is latched on the rising edge of CLK. Data1 and data2 are written on the rising edge of CLK. The NWAIT signal is used to insert a wait state. The diagram is labeled ai14731g.

Timing diagram showing waveforms for synchronous multiplexed write mode. The diagram illustrates the relationship between the host clock (HCLK), memory clock (CLK), address lines (A[25:16] and A/D[15:0]), and control signals (NEx, NOE, NWE, NADV, NWAIT). The memory transaction is defined as a burst of 2 half words. The address is latched on the rising edge of CLK. Data1 and data2 are written on the rising edge of CLK. The NWAIT signal is used to insert a wait state. The diagram is labeled ai14731g.

Timing diagram for synchronous multiplexed write mode waveforms. The diagram shows the relationship between HCLK, CLK, address lines A[25:16] and A/D[15:0], and control signals NEx, NOE, NWE, NADV, and NWAIT. A memory transaction is shown as a burst of 2 half words. The address is latched on the rising edge of CLK. Data1 and data2 are written on the rising edge of CLK. The NWAIT signal is used to insert a wait state. The diagram is labeled ai14731g.
  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]MUX ENMBK EN
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.

Bit 7 Reserved, must be kept at reset value.

Bit 6 FACCEN : Flash access enable

Enables NOR flash memory access operations.

Bits 5:4 MWID[1:0] : Memory data bus width

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

Bits 3:2 MTYP[1:0] : Memory type

Defines the type of external memory attached to the corresponding memory bank.

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:

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.

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]BURSTURN[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.

00: Access mode A

01: Access mode B

10: Access mode C

11: Access mode D

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

For synchronous access with read/write Burst mode enabled (BURSTEN / CBURSTRW bits set), defines the number of memory clock cycles (+2) to issue to the memory before reading/writing the first data:

This timing parameter is not expressed in HCLK periods, but in FSMC_CLK periods.

For asynchronous access, this value is don't care.

0000: Data latency of 2 CLK clock cycles for first burst access

1111: Data latency of 17 CLK clock cycles for first burst access (default value after reset)

Bits 23:20 CLKDIV[3:0] : Clock divide ratio (for FSMC_CLK signal)

Defines the period of FSMC_CLK clock output signal, expressed in number of HCLK cycles:

0000: FSMC_CLK period= 1x HCLK period

0001: FSMC_CLK period = 2 × HCLK periods

0010: FSMC_CLK period = 3 × HCLK periods

1111: FSMC_CLK period = 16 × HCLK periods (default value after reset)

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

Note: Refer to Section 11.6.5: Synchronous transactions for FSMC_CLK divider ratio formula

Bits 19:16 BUSTURN[3:0] : Bus turnaround phase duration

These bits are written by software to add a delay at the end of a write-to-read (and read-to-write) transaction. This delay enables to match the minimum time between consecutive transactions ( \( t_{\text{EHEL}} \) from NEx high to NEx low) and the maximum time needed by the memory to free the data bus after a read access ( \( t_{\text{EHQZ}} \) ). The programmed bus turnaround delay is inserted between an asynchronous read (muxed or mode D) or write transaction and any other asynchronous /synchronous read or write to or from a static bank. The bank can be the same or different in case of read, in case of write the bank can be different except for muxed or mode D.

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

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
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.
0x00FSMC_BCR1WFDISCCLKENCBURSTRWCPSIZE [2:0]ASYNCCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value00000000110001011011
0x08FSMC_BCR2CBURSTRWCPSIZE [2:0]ASYNCCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value000000110001010010
0x10FSMC_BCR3CBURSTRWCPSIZE [2:0]ASYNCCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value000000110001010010
0x18FSMC_BCR4CBURSTRWCPSIZE [2:0]ASYNCCWAITEXTMODWAITENWRENWAITCFGRes.WAITPOLBURSTENRes.FACCENMWID [1:0]MTYP [1:0]MUXENMBKEN
Reset value000000110001010010
0x04FSMC_BTR1ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111111111111
0x0CFSMC_BTR2ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value001111111111111111111111111111
0x14FSMC_BTR3ACCMOD[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
0x1CFSMC_BTR4Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value0 01 1 1 11 1 1 11 1 1 11 1 1 1 1 1 1 11 1 1 11 1 1 11 1 1 1
0x104FSMC_BWTR1Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value0 01 1 1 11 1 1 11 1 1 11 1 1 1 1 1 1 11 1 1 11 1 1 11 1 1 1
0x10CFSMC_BWTR2Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value0 01 1 1 11 1 1 11 1 1 11 1 1 1 1 1 1 11 1 1 11 1 1 11 1 1 1
0x114FSMC_BWTR3Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value0 01 1 1 11 1 1 11 1 1 11 1 1 1 1 1 1 11 1 1 11 1 1 11 1 1 1
0x11CFSMC_BWTR4Res.Res.ACCMOD[1:0]DATLAT[3:0]CLKDIV[3:0]BUSTURN[3:0]DATAST[7:0]ADDHLD[3:0]ADDSET[3:0]
Reset value0 01 1 1 11 1 1 11 1 1 11 1 1 1 1 1 1 11 1 1 11 1 1 11 1 1 1
Refer to Section 2.2 on page 49 for the register boundary addresses.