2016-04-20 09:08 AM
Hi
I use current stm32cubemx & cubef4 1.11i set in cubemx pins , clock & SDRAM config and generate codewhen i see sdram initialize code seems it not set auto refresh commandsthen configuration of sdram in cubemx not generate all configuration need by sdram such as refresh ? #scram-cubemx2016-04-21 09:50 AM
Hi navahan.maziar.001,
/* FMC initialization function */
void
MX_FMC_Init(
void
)
{
FMC_SDRAM_TimingTypeDef SdramTiming;
…
/* SdramTiming */
SdramTiming.LoadToActiveDelay = 16;
SdramTiming.ExitSelfRefreshDelay = 16;
SdramTiming.SelfRefreshTime = 16;
SdramTiming.RowCycleDelay = 16;
SdramTiming.WriteRecoveryTime = 16;
SdramTiming.RPDelay = 16;
SdramTiming.RCDDelay = 16;
…
}
These parameters initialize the SDRAM timing Interface such us Self Refresh period, delay between a Load Mode Register command and an active or Refresh command. These parameters can be a value between Min_Data = 1 and Max_Data = 16 configurable from the FMC configuration window.
2016-04-21 07:55 PM
yes it generate :
simple setting of mcu sdram section But really after it sdram work ? it forget set internal sdram refresh command :Command.CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
Command.AutoRefreshNumber = 1;
Command.ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
/* Step 2: Insert 100 us minimum delay */
/* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
HAL_Delay(1);
/* Step 3: Configure a PALL (precharge all) command */
Command.CommandMode = FMC_SDRAM_CMD_PALL;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
Command.AutoRefreshNumber = 1;
Command.ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
/* Step 4: Configure an Auto Refresh command */
Command.CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
Command.AutoRefreshNumber = 4;
Command.ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
/* Step 5: Program the external memory mode register */
tmpmrd = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_2 |
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |
SDRAM_MODEREG_CAS_LATENCY_3 |
SDRAM_MODEREG_OPERATING_MODE_STANDARD |
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;
Command.CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
Command.AutoRefreshNumber = 1;
Command.ModeRegisterDefinition = tmpmrd;
/* Send the command */
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
/* Step 6: Set the refresh rate counter */
/* Set the device refresh rate */
HAL_SDRAM_ProgramRefreshRate(&SdramHandle, RefreshCount);
1. minimum if user must do it manual it must notify it
2. also i confused with
DATA_IN_ExtSRAM in
system_stm32f4xx.c
if try use
DATA_IN_ExtSRAM
what happen for my HAL setting ??
and must manually set config GPIO & sdram config in
system_stm32f4xx.c
again ???? why st driver not used same value in HAL & CMSIS ???