stm32f469_gfx/src/hw/driver/sdram.c
uint8_t BSP_SDRAM_Init(void)
{
  static uint8_t sdramstatus = SDRAM_ERROR;

  /* SDRAM device configuration */
  sdramHandle.Instance = FMC_SDRAM_DEVICE;

  /* Timing configuration for 90 MHz as SD clock frequency (System clock is up to 180 MHz) */
  Timing.LoadToActiveDelay    = 2;
  Timing.ExitSelfRefreshDelay = 7;
  Timing.SelfRefreshTime      = 4;
  Timing.RowCycleDelay        = 7;
  Timing.WriteRecoveryTime    = 2;
  Timing.RPDelay              = 2;
  Timing.RCDDelay             = 2;

  sdramHandle.Init.SDBank             = FMC_SDRAM_BANK1;
  sdramHandle.Init.ColumnBitsNumber   = FMC_SDRAM_COLUMN_BITS_NUM_8;
  sdramHandle.Init.RowBitsNumber      = FMC_SDRAM_ROW_BITS_NUM_12;
  sdramHandle.Init.MemoryDataWidth    = SDRAM_MEMORY_WIDTH;
  sdramHandle.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
  sdramHandle.Init.CASLatency         = FMC_SDRAM_CAS_LATENCY_3;
  sdramHandle.Init.WriteProtection    = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
  sdramHandle.Init.SDClockPeriod      = SDCLOCK_PERIOD;
  sdramHandle.Init.ReadBurst          = FMC_SDRAM_RBURST_ENABLE;
  sdramHandle.Init.ReadPipeDelay      = FMC_SDRAM_RPIPE_DELAY_0;

  /* SDRAM controller initialization */
  /* __weak function can be surcharged by the application code */
  BSP_SDRAM_MspInit(&sdramHandle, (void *)NULL);
  if(HAL_SDRAM_Init(&sdramHandle, &Timing) != HAL_OK)
  {
    sdramstatus = SDRAM_ERROR;
  }
  else
  {
    sdramstatus = SDRAM_OK;
  }

  /* SDRAM initialization sequence */
  BSP_SDRAM_Initialization_sequence(REFRESH_COUNT);

  return sdramstatus;
}
/**
  * @brief  Initializes the SDRAM device.
  * @retval SDRAM status
  */
@brief  Initializes the SDRAM device.
@retval SDRAM status
@brief Initializes the SDRAM device . @retval SDRAM status
uint8_t BSP_SDRAM_Init(void)
{
  static uint8_t sdramstatus = SDRAM_ERROR;
  sdramHandle.Instance = FMC_SDRAM_DEVICE;
  Timing.LoadToActiveDelay    = 2;
  Timing.ExitSelfRefreshDelay = 7;
  Timing.SelfRefreshTime      = 4;
  Timing.RowCycleDelay        = 7;
  Timing.WriteRecoveryTime    = 2;
  Timing.RPDelay              = 2;
  Timing.RCDDelay             = 2;
  sdramHandle.Init.SDBank             = FMC_SDRAM_BANK1;
  sdramHandle.Init.ColumnBitsNumber   = FMC_SDRAM_COLUMN_BITS_NUM_8;
  sdramHandle.Init.RowBitsNumber      = FMC_SDRAM_ROW_BITS_NUM_12;
  sdramHandle.Init.MemoryDataWidth    = SDRAM_MEMORY_WIDTH;
  sdramHandle.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
  sdramHandle.Init.CASLatency         = FMC_SDRAM_CAS_LATENCY_3;
  sdramHandle.Init.WriteProtection    = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
  sdramHandle.Init.SDClockPeriod      = SDCLOCK_PERIOD;
  sdramHandle.Init.ReadBurst          = FMC_SDRAM_RBURST_ENABLE;
  sdramHandle.Init.ReadPipeDelay      = FMC_SDRAM_RPIPE_DELAY_0;
  BSP_SDRAM_MspInit(&sdramHandle, (void *)NULL);
  if(HAL_SDRAM_Init(&sdramHandle, &Timing) != HAL_OK)
  {
    sdramstatus = SDRAM_ERROR;
  }
  else
  {
    sdramstatus = SDRAM_OK;
  }
  BSP_SDRAM_Initialization_sequence(REFRESH_COUNT);
  return sdramstatus;
}
uint8_t BSP_SDRAM_Init ( void ) { static uint8_t sdramstatus = SDRAM_ERROR ; sdramHandle . Instance = FMC_SDRAM_DEVICE ; Timing . LoadToActiveDelay = 2 ; Timing . ExitSelfRefreshDelay = 7 ; Timing . SelfRefreshTime = 4 ; Timing . RowCycleDelay = 7 ; Timing . WriteRecoveryTime = 2 ; Timing . RPDelay = 2 ; Timing . RCDDelay = 2 ; sdramHandle . Init . SDBank = FMC_SDRAM_BANK1 ; sdramHandle . Init . ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_8 ; sdramHandle . Init . RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_12 ; sdramHandle . Init . MemoryDataWidth = SDRAM_MEMORY_WIDTH ; sdramHandle . Init . InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4 ; sdramHandle . Init . CASLatency = FMC_SDRAM_CAS_LATENCY_3 ; sdramHandle . Init . WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE ; sdramHandle . Init . SDClockPeriod = SDCLOCK_PERIOD ; sdramHandle . Init . ReadBurst = FMC_SDRAM_RBURST_ENABLE ; sdramHandle . Init . ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_0 ; BSP_SDRAM_MspInit ( & sdramHandle , ( void * ) NULL ) ; if ( HAL_SDRAM_Init ( & sdramHandle , & Timing ) != HAL_OK ) { sdramstatus = SDRAM_ERROR ; } else { sdramstatus = SDRAM_OK ; } BSP_SDRAM_Initialization_sequence ( REFRESH_COUNT ) ; return sdramstatus ; }
@brief  Initializes the SDRAM device.
@brief Initializes the SDRAM device .
/* SDRAM device configuration */ /* Timing configuration for 90 MHz as SD clock frequency (System clock is up to 180 MHz) */ /* SDRAM controller initialization */ /* __weak function can be surcharged by the application code */ /* SDRAM initialization sequence */