FSMC_SRAM Setup

<< Click to Display Table of Contents >>

Navigation:  STM32F4 Target > Block References > On-chip Peripherals > FSMC >

FSMC_SRAM Setup

Previous pageReturn to chapter overviewNext page

User Interface

How this block appears in a Simulink model?

fsmc_extram_setup_block

What can be configured?

fsmc_extram_setup_mask

Configuration item

Selectable option/ Value

Description

Use as main RAM

Checked | Unchecked

When this option is enabled:

1. Linker script will be modified (automatically) to use address and size of external RAM.

2. Start-up code will be modified (automatically) to initial FSMC.

3. Required custom file of Clock configuration (system_stm32f4xx.c).

4. Required define  -DDATA_IN_ExtSRAM in Compiler control string (Target Setup).

 

Note: For current release, this option support MDK-ARM and GNU-ARM compiler.

Memory address (Origin)

(Specify start address of external memory)

For STM32F4 Target, default memory address is: 0x64000000

Memory size (Length)

(Specify size of external memory)


Sample time (sec)



When to use this block?

In an application which require using external memory.

Use as main RAM

Follow below steps to configure external RAM, tell the compiler to use it as main memory.

1.Put FSMC_SRAM Setup block into model, enable option "Use as main RAM". Configure address and size (depending on Hardware).
2.Add define -DDATA_IN_ExtSRAM to Compiler control string.
a.GNU-ARM compiler

fsmc_extram_setup_mask3

b.MDK-ARM compiler

 fsmc_extram_setup_mask2

c.EWARM compiler (Support by later release)
3.Modify custom clock configuration file.
a.Open file system_stm32f4xx.c for edit, file located in directory: ..\waijung\targets\stm32f4_target\stm32f4\utils\STM32F4xx_AN3988_V1.0.1

 For FiO2 board

 In function SystemInit_ExtMemCtl(), configure timing to interface with external RAM (depending on SRAM speed).

 /*-- FSMC Configuration ------------------------------------------------------*/

 /* Enable the FSMC interface clock */

 RCC->AHB3ENR         = 0x00000001;

 

 /* Configure and enable Bank1_SRAM2 */

 FSMC_Bank1->BTCR[2]  = 0x00001015;

 FSMC_Bank1->BTCR[3]  = 0x00010806;

 FSMC_Bank1E->BWTR[2] = 0x0fffffff;

 

4. Make sure there is no other function using pins conflict with FSMC.