old code test
This commit is contained in:
parent
22d0567449
commit
b7349c38af
@ -592,32 +592,32 @@ static void MX_FMC_Init(void)
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN FMC_Init 2 */
|
||||
FMC_SDRAM_CommandTypeDef Command;
|
||||
/* Step 1 and Step 2 already done in HAL_SDRAM_Init() */
|
||||
/* Step 3: Configure a clock configuration enable command */
|
||||
Command.CommandMode = FMC_SDRAM_CMD_CLK_ENABLE; /* Set MODE bits to "001" */
|
||||
Command.CommandTarget = (FMC_SDRAM_CMD_TARGET_BANK1); /* configure the Target Bank bits */
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
HAL_SDRAM_SendCommand(&hsdram1, &Command, 0xfff);
|
||||
HAL_Delay(1); /* Step 4: Insert 100 us minimum delay - Min HAL Delay is 1ms */
|
||||
/* Step 5: Configure a PALL (precharge all) command */
|
||||
Command.CommandMode = FMC_SDRAM_CMD_PALL; /* Set MODE bits to "010" */
|
||||
HAL_SDRAM_SendCommand(&hsdram1, &Command, 0xfff);
|
||||
/* Step 6: Configure an Auto Refresh command */
|
||||
Command.CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE; /* Set MODE bits to "011" */
|
||||
Command.AutoRefreshNumber = 4;
|
||||
HAL_SDRAM_SendCommand(&hsdram1, &Command, 0xfff);
|
||||
/* Step 7: Program the external memory mode register */
|
||||
Command.CommandMode = FMC_SDRAM_CMD_LOAD_MODE;/*set the MODE bits to "100" */
|
||||
Command.ModeRegisterDefinition = (uint32_t)0 | 0<<3 | 2<<4 | 0<<7 | 1<<9;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
HAL_SDRAM_SendCommand(&hsdram1, &Command, 0xfff);
|
||||
/* Step 8: Set the refresh rate counter - refer to section SDRAM refresh timer register in RM0455 */
|
||||
/* Set the device refresh rate
|
||||
* COUNT = [(SDRAM self refresh time / number of row) x SDRAM CLK] – 20
|
||||
= [(70ms/8138) * 200MHz] - 20 ~ 1700 */
|
||||
HAL_SDRAM_ProgramRefreshRate(&hsdram1, 1700);
|
||||
FMC_SDRAM_CommandTypeDef command;
|
||||
HAL_StatusTypeDef status;
|
||||
command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
|
||||
command.CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
|
||||
command.AutoRefreshNumber = 1;
|
||||
command.ModeRegisterDefinition = 0;
|
||||
status = HAL_SDRAM_SendCommand(&hsdram1, &command, 1000);
|
||||
HAL_Delay(1);
|
||||
|
||||
|
||||
command.CommandMode = FMC_SDRAM_CMD_PALL;
|
||||
command.AutoRefreshNumber = 8;
|
||||
command.ModeRegisterDefinition = 0;
|
||||
status = HAL_SDRAM_SendCommand(&hsdram1, &command, 1000);
|
||||
|
||||
command.CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
|
||||
command.AutoRefreshNumber = 1;
|
||||
command.ModeRegisterDefinition = 0x130;
|
||||
status = HAL_SDRAM_SendCommand(&hsdram1, &command, 1000);
|
||||
|
||||
command.CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
|
||||
command.AutoRefreshNumber = 8;
|
||||
command.ModeRegisterDefinition = 0;
|
||||
status = HAL_SDRAM_SendCommand(&hsdram1, &command, 1000);
|
||||
|
||||
status = HAL_SDRAM_ProgramRefreshRate(&hsdram1, 0x0595);
|
||||
/* USER CODE END FMC_Init 2 */
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user