Hello Community,
i have the problem, that i have no idea how i could initialize the SDRAM with the HAL-Functions for STM32F42xx.
The correct chip is STM32F427-IGH6. My problem is that i could not initialize the external SDRAM with the HAL Functions. What did i wrong?
int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); //Configure the System clock to have a frequency of 180 MHz SystemClock_Config(); //Initialize OS OS_IncDI(); // Initially disable interrupts OS_InitKern(); // Initialize OS OS_InitHW(); // Initialize Hardware for OS OS_DecRI(); // Enable interrupts Trace_Init(); // Initialize embOS-Trace //initialize peripherals InitPeripherals(); FMC_SDRAM_InitTypeDef ini; ini.SDBank = FMC_SDRAM_BANK2; ini.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_8; ini.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_12; ini.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16; ini.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4; ini.CASLatency = FMC_SDRAM_CAS_LATENCY_3; ini.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE; ini.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2; ini.ReadBurst = FMC_SDRAM_RBURST_DISABLE; ini.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_1; FMC_SDRAM_Init(FMC_Bank5_6,&ini);
I think after the FMC_SDRAM_Init - the SDRAM should work? I did a SDRAM Sample without the HAL-Functions and it worked fine - but now i would use this Functions and i have no idea which kind of functions i should call and use. I also have no idea about the First-Parameter of FMC_SDRAM_Init - There should be FMC_Bank5_6_TypeDef, but with which configuration?
I changed the code. Is this correct now? I'm not sure about the initialization with the HAL Functions
SDRAM_HandleTypeDef hdsram; hdsram.Init.SDBank = FMC_SDRAM_BANK2; hdsram.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_8; hdsram.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_12; hdsram.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16; hdsram.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4; hdsram.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_3; hdsram.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE; hdsram.Init.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2; hdsram.Init.ReadBurst = FMC_SDRAM_RBURST_DISABLE; hdsram.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_1; hdsram.Instance = FMC_SDRAM_DEVICE; FMC_SDRAM_TimingTypeDef timing; timing.LoadToActiveDelay = 2; timing.ExitSelfRefreshDelay = 7; timing.SelfRefreshTime = 4; timing.RowCycleDelay =7; timing.WriteRecoveryTime = 2; timing.RPDelay = 2; timing.RCDDelay = 2; HAL_SDRAM_Init(&hdsram,&timing);
Greetings