| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 | 
							- /**
 
-   ******************************************************************************
 
-   * File Name          : FSMC.c
 
-   * Description        : This file provides code for the configuration
 
-   *                      of the FSMC peripheral.
 
-   ******************************************************************************
 
-   *
 
-   * COPYRIGHT(c) 2016 STMicroelectronics
 
-   *
 
-   * Redistribution and use in source and binary forms, with or without modification,
 
-   * are permitted provided that the following conditions are met:
 
-   *   1. Redistributions of source code must retain the above copyright notice,
 
-   *      this list of conditions and the following disclaimer.
 
-   *   2. Redistributions in binary form must reproduce the above copyright notice,
 
-   *      this list of conditions and the following disclaimer in the documentation
 
-   *      and/or other materials provided with the distribution.
 
-   *   3. Neither the name of STMicroelectronics nor the names of its contributors
 
-   *      may be used to endorse or promote products derived from this software
 
-   *      without specific prior written permission.
 
-   *
 
-   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
-   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
-   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
-   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 
-   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
-   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
-   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
-   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
-   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
-   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-   *
 
-   ******************************************************************************
 
-   */
 
- /* Includes ------------------------------------------------------------------*/
 
- #include "fsmc.h"
 
- #include "gpio.h"
 
- /* USER CODE BEGIN 0 */
 
- /* USER CODE END 0 */
 
- SRAM_HandleTypeDef hsram1;
 
- /* FSMC initialization function */
 
- void MX_FSMC_Init(void)
 
- {
 
-   FSMC_NORSRAM_TimingTypeDef Timing;
 
-   /** Perform the SRAM1 memory initialization sequence
 
-   */
 
-   hsram1.Instance = FSMC_NORSRAM_DEVICE;
 
-   hsram1.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
 
-   /* hsram1.Init */
 
-   hsram1.Init.NSBank = FSMC_NORSRAM_BANK1;
 
-   hsram1.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_ENABLE;
 
-   hsram1.Init.MemoryType = FSMC_MEMORY_TYPE_PSRAM;
 
-   hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_8;
 
-   hsram1.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
 
-   hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
 
-   hsram1.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
 
-   hsram1.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
 
-   hsram1.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
 
-   hsram1.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
 
-   hsram1.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
 
-   hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
 
-   hsram1.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE;
 
-   /* Timing */
 
- /*
 
-   Timing.AddressSetupTime = 3;
 
-   Timing.AddressHoldTime = 2;
 
-   Timing.DataSetupTime = 5;
 
- */
 
-   Timing.AddressSetupTime = 2;
 
-   Timing.AddressHoldTime = 1;
 
-   Timing.DataSetupTime = 4;
 
-   Timing.BusTurnAroundDuration = 0;
 
-   Timing.CLKDivision = 16;
 
-   Timing.DataLatency = 17;
 
-   Timing.AccessMode = FSMC_ACCESS_MODE_A;
 
-   /* ExtTiming */
 
-   HAL_SRAM_Init(&hsram1, &Timing, NULL);
 
- }
 
- static int FSMC_Initialized = 0;
 
- static void HAL_FSMC_MspInit(void){
 
-   /* USER CODE BEGIN FSMC_MspInit 0 */
 
-   /* USER CODE END FSMC_MspInit 0 */
 
-   GPIO_InitTypeDef GPIO_InitStruct;
 
-   if (FSMC_Initialized) {
 
-     return;
 
-   }
 
-   FSMC_Initialized = 1;
 
-   /* Peripheral clock enable */
 
-   __FSMC_CLK_ENABLE();
 
-   
 
-   /** FSMC GPIO Configuration  
 
-   PE7   ------> FSMC_DA4
 
-   PE8   ------> FSMC_DA5
 
-   PE9   ------> FSMC_DA6
 
-   PE10   ------> FSMC_DA7
 
-   PD14   ------> FSMC_DA0
 
-   PD15   ------> FSMC_DA1
 
-   PD0   ------> FSMC_DA2
 
-   PD1   ------> FSMC_DA3
 
-   PD4   ------> FSMC_NOE
 
-   PD5   ------> FSMC_NWE
 
-   PD7   ------> FSMC_NE1
 
-   PB7   ------> FSMC_NL
 
-   */
 
-   /* GPIO_InitStruct */
 
-   GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10;
 
-   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 
-   GPIO_InitStruct.Pull = GPIO_NOPULL;
 
-   GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
 
-   GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
 
-   HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
 
-   /* GPIO_InitStruct */
 
-   GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1 
 
-                           |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7;
 
-   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 
-   GPIO_InitStruct.Pull = GPIO_NOPULL;
 
-   GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
 
-   GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
 
-   HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
 
-   /* GPIO_InitStruct */
 
-   GPIO_InitStruct.Pin = GPIO_PIN_7;
 
-   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 
-   GPIO_InitStruct.Pull = GPIO_NOPULL;
 
-   GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
 
-   GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
 
-   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
-   /* USER CODE BEGIN FSMC_MspInit 1 */
 
-   /* USER CODE END FSMC_MspInit 1 */
 
- }
 
- void HAL_SRAM_MspInit(SRAM_HandleTypeDef* hsram){
 
-   /* USER CODE BEGIN SRAM_MspInit 0 */
 
-   /* USER CODE END SRAM_MspInit 0 */
 
-   HAL_FSMC_MspInit();
 
-   /* USER CODE BEGIN SRAM_MspInit 1 */
 
-   /* USER CODE END SRAM_MspInit 1 */
 
- }
 
- static int FSMC_DeInitialized = 0;
 
- static void HAL_FSMC_MspDeInit(void){
 
-   /* USER CODE BEGIN FSMC_MspDeInit 0 */
 
-   /* USER CODE END FSMC_MspDeInit 0 */
 
-   if (FSMC_DeInitialized) {
 
-     return;
 
-   }
 
-   FSMC_DeInitialized = 1;
 
-   /* Peripheral clock enable */
 
-   __FSMC_CLK_DISABLE();
 
-   
 
-   /** FSMC GPIO Configuration  
 
-   PE7   ------> FSMC_DA4
 
-   PE8   ------> FSMC_DA5
 
-   PE9   ------> FSMC_DA6
 
-   PE10   ------> FSMC_DA7
 
-   PD14   ------> FSMC_DA0
 
-   PD15   ------> FSMC_DA1
 
-   PD0   ------> FSMC_DA2
 
-   PD1   ------> FSMC_DA3
 
-   PD4   ------> FSMC_NOE
 
-   PD5   ------> FSMC_NWE
 
-   PD7   ------> FSMC_NE1
 
-   PB7   ------> FSMC_NL
 
-   */
 
-   HAL_GPIO_DeInit(GPIOE, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10);
 
-   HAL_GPIO_DeInit(GPIOD, GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1 
 
-                           |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7);
 
-   HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7);
 
-   /* USER CODE BEGIN FSMC_MspDeInit 1 */
 
-   /* USER CODE END FSMC_MspDeInit 1 */
 
- }
 
- void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* hsram){
 
-   /* USER CODE BEGIN SRAM_MspDeInit 0 */
 
-   /* USER CODE END SRAM_MspDeInit 0 */
 
-   HAL_FSMC_MspDeInit();
 
-   /* USER CODE BEGIN SRAM_MspDeInit 1 */
 
-   /* USER CODE END SRAM_MspDeInit 1 */
 
- }
 
- /**
 
-   * @}
 
-   */
 
- /**
 
-   * @}
 
-   */
 
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
 
 
  |