NOR/SRAM Controller functions.
More...
NOR/SRAM Controller functions.
===============================================================================
NOR/SRAM Controller functions
===============================================================================
The following sequence should be followed to configure the FSMC to interface with
SRAM, PSRAM, NOR or OneNAND memory connected to the NOR/SRAM Bank:
1. Enable the clock for the FSMC and associated GPIOs using the following functions:
RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOx, ENABLE);
2. FSMC pins configuration
- Connect the involved FSMC pins to AF12 using the following function
GPIO_PinAFConfig(GPIOx, GPIO_PinSourcex, GPIO_AF_FSMC);
- Configure these FSMC pins in alternate function mode by calling the function
GPIO_Init();
3. Declare a FSMC_NORSRAMInitTypeDef structure, for example:
FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
and fill the FSMC_NORSRAMInitStructure variable with the allowed values of
the structure member.
4. Initialize the NOR/SRAM Controller by calling the function
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
5. Then enable the NOR/SRAM Bank, for example:
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE);
6. At this stage you can read/write from/to the memory connected to the NOR/SRAM Bank.
void FSMC_NORSRAMCmd |
( |
uint32_t |
FSMC_Bank, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enables or disables the specified NOR/SRAM Memory Bank.
- Parameters
-
FSMC_Bank,: | specifies the FSMC Bank to be used This parameter can be one of the following values:
- FSMC_Bank1_NORSRAM1: FSMC Bank1 NOR/SRAM1
- FSMC_Bank1_NORSRAM2: FSMC Bank1 NOR/SRAM2
- FSMC_Bank1_NORSRAM3: FSMC Bank1 NOR/SRAM3
- FSMC_Bank1_NORSRAM4: FSMC Bank1 NOR/SRAM4
|
NewState,: | new state of the FSMC_Bank. This parameter can be: ENABLE or DISABLE. |
- Return values
-
void FSMC_NORSRAMDeInit |
( |
uint32_t |
FSMC_Bank | ) |
|
Deinitializes the FSMC NOR/SRAM Banks registers to their default reset values.
- Parameters
-
FSMC_Bank,: | specifies the FSMC Bank to be used This parameter can be one of the following values:
- FSMC_Bank1_NORSRAM1: FSMC Bank1 NOR/SRAM1
- FSMC_Bank1_NORSRAM2: FSMC Bank1 NOR/SRAM2
- FSMC_Bank1_NORSRAM3: FSMC Bank1 NOR/SRAM3
- FSMC_Bank1_NORSRAM4: FSMC Bank1 NOR/SRAM4
|
- Return values
-
Initializes the FSMC NOR/SRAM Banks according to the specified parameters in the FSMC_NORSRAMInitStruct.
- Parameters
-
FSMC_NORSRAMInitStruct | : pointer to a FSMC_NORSRAMInitTypeDef structure that contains the configuration information for the FSMC NOR/SRAM specified Banks. |
- Return values
-
Fills each FSMC_NORSRAMInitStruct member with its default value.
- Parameters
-
- Return values
-