高级会员
- 积分
- 600
- 金钱
- 600
- 注册时间
- 2015-9-7
- 在线时间
- 140 小时
|
1金钱
本帖最后由 wt13568089592 于 2023-11-5 18:09 编辑
移植H743 SDRAM程序到H723 不成功问题,H723程序先用CUBEMX生成,再移植H743的SDRAM 初始化,SDRAM不能读写,sdram_send_cmd返回都是失败1
H723和H743除了SDRAM物理IO口有所不同,还有其他不同吗?怎么排查?H723 配置CPU时钟为440M ,使用下面的程序,在0xC0000000 读写直接hard_fault
/** Perform the SDRAM1 memory initialization sequence
*/
hsdram1.Instance = FMC_SDRAM_DEVICE;
/* hsdram1.Init */
hsdram1.Init.SDBank = FMC_SDRAM_BANK1;
hsdram1.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9;
hsdram1.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13;
hsdram1.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16;
hsdram1.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
hsdram1.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_3;
hsdram1.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
hsdram1.Init.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2;
hsdram1.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE;
hsdram1.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_1;
/* SdramTiming */
SdramTiming.LoadToActiveDelay = 2;
SdramTiming.ExitSelfRefreshDelay = 8;
SdramTiming.SelfRefreshTime = 6;
SdramTiming.RowCycleDelay = 6;
SdramTiming.WriteRecoveryTime = 6;
SdramTiming.RPDelay = 2;
SdramTiming.RCDDelay = 2;
if (HAL_SDRAM_Init(&hsdram1, &SdramTiming) != HAL_OK)
{
Error_Handler( );
}
/* USER CODE BEGIN FMC_Init 2 */
sdram_initialization_sequence();
/**
* 刷新频率计数器(以SDCLK频率计数),计算方法:
* COUNT=SDRAM刷新周期/行数-20=SDRAM刷新周期(us)*SDCLK频率(Mhz)/行数
* 我们使用的SDRAM刷新周期为64ms,SDCLK=220/2=110Mhz,行数为8192(2^13).
* 所以,COUNT=64*1000*110/8192-20=839
*/
HAL_SDRAM_ProgramRefreshRate(&g_sdram_handle, 839);
|
|