stm32f429主频大于160MHz时,sdram数据不稳定

2019-07-20 18:27发布

stm32f429主频为180MHz, sdramz做lcd缓存时,刷完一帧图片,部分像素点颜 {MOD}发送了变化,如下图。但将主频设置为160MHz时图片显示又很稳定,后来测试了一下sdram,发现主频大于160M,并且随着主频的增大,sdram的数据越不稳定。而160M时数据又很稳定,有没有人遇到这样的问题呢?会不会是sdram的布线不好引起的?
sdram配置如下: [mw_shl_code=c,true]/* FMC SDRAM Bank configuration */ /* Timing configuration for 90 Mhz of SD clock frequency (180Mhz/2) */ /* TMRD: 2 Clock cycles */ FMC_SDRAMTimingInitStructure.FMC_LoadToActiveDelay = 2; /* TXSR: min=70ns (7x11.11ns) */ FMC_SDRAMTimingInitStructure.FMC_ExitSelfRefreshDelay = 7; /* TRAS: min=42ns (4x11.11ns) max=120k (ns) */ FMC_SDRAMTimingInitStructure.FMC_SelfRefreshTime = 4; /* TRC: min=70 (7x11.11ns) */ FMC_SDRAMTimingInitStructure.FMC_RowCycleDelay = 7; /* TWR: min=1+ 7ns (1+1x11.11ns) */ FMC_SDRAMTimingInitStructure.FMC_WriteRecoveryTime = 2; /* TRP: 20ns => 2x11.11ns */ FMC_SDRAMTimingInitStructure.FMC_RPDelay = 2; /* TRCD: 20ns => 2x11.11ns */ FMC_SDRAMTimingInitStructure.FMC_RCDDelay = 2; /* FMC SDRAM control configuration */ FMC_SDRAMInitStructure.FMC_Bank = FMC_Bank2_SDRAM; /* Row addressing: [7:0] */ FMC_SDRAMInitStructure.FMC_ColumnBitsNumber = FMC_ColumnBits_Number_8b; /* Column addressing: [11:0] */ FMC_SDRAMInitStructure.FMC_RowBitsNumber = FMC_RowBits_Number_12b; FMC_SDRAMInitStructure.FMC_SDMemoryDataWidth = SDRAM_MEMORY_WIDTH; FMC_SDRAMInitStructure.FMC_InternalBankNumber = FMC_InternalBank_Number_4; FMC_SDRAMInitStructure.FMC_CASLatency = SDRAM_CAS_LATENCY; FMC_SDRAMInitStructure.FMC_WriteProtection = FMC_Write_Protection_Disable; FMC_SDRAMInitStructure.FMC_SDClockPeriod = SDCLOCK_PERIOD; FMC_SDRAMInitStructure.FMC_ReadBurst = SDRAM_READBURST; FMC_SDRAMInitStructure.FMC_ReadPipeDelay = FMC_ReadPipe_Delay_1; FMC_SDRAMInitStructure.FMC_SDRAMTimingStruct = &FMC_SDRAMTimingInitStructure;[/mw_shl_code]





友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
30条回答
simms01
1楼-- · 2019-07-20 21:31
/*
 ******************************************************************************
 *函数:void SDRAM_Init(void)
 *输入:none
 *输出:none
 *描述:SDRAM 初始化。
 ******************************************************************************
 */
void SDRAM_Init(void)
{
  FMC_SDRAMInitTypeDef  FMC_SDRAMInitStructure;
  FMC_SDRAMTimingInitTypeDef  FMC_SDRAMTimingInitStructure; 

  SDRAM_GPIOInit();
   
  RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FMC, ENABLE);

  FMC_SDRAMTimingInitStructure.FMC_LoadToActiveDelay = 3;      
  FMC_SDRAMTimingInitStructure.FMC_ExitSelfRefreshDelay = 8;  
  FMC_SDRAMTimingInitStructure.FMC_SelfRefreshTime = 4; 
  FMC_SDRAMTimingInitStructure.FMC_RowCycleDelay = 7; 
  FMC_SDRAMTimingInitStructure.FMC_WriteRecoveryTime = 4;
  FMC_SDRAMTimingInitStructure.FMC_RPDelay = 3; 
  FMC_SDRAMTimingInitStructure.FMC_RCDDelay = 3; 


  FMC_SDRAMInitStructure.FMC_Bank = FMC_Bank2_SDRAM;
  FMC_SDRAMInitStructure.FMC_ColumnBitsNumber = FMC_ColumnBits_Number_9b;
  FMC_SDRAMInitStructure.FMC_RowBitsNumber = FMC_RowBits_Number_13b;
  FMC_SDRAMInitStructure.FMC_SDMemoryDataWidth = FMC_SDMemory_Width_16b;
  FMC_SDRAMInitStructure.FMC_InternalBankNumber = FMC_InternalBank_Number_4;
  
  FMC_SDRAMInitStructure.FMC_CASLatency = FMC_CAS_Latency_3; 
FMC_SDRAMInitStructure.FMC_WriteProtection = FMC_Write_Protection_Disable;
  FMC_SDRAMInitStructure.FMC_SDClockPeriod = FMC_SDClock_Period_2;  
  FMC_SDRAMInitStructure.FMC_ReadBurst = FMC_Read_Burst_Enable;
  FMC_SDRAMInitStructure.FMC_ReadPipeDelay = FMC_ReadPipe_Delay_0;
  FMC_SDRAMInitStructure.FMC_SDRAMTimingStruct = &FMC_SDRAMTimingInitStructure;
  FMC_SDRAMInit(&FMC_SDRAMInitStructure);

  SDRAM_Initsquence();

}
taizonglai
2楼-- · 2019-07-21 03:01
SDRAM走等长线了么?
wangxipeng
3楼-- · 2019-07-21 07:19
我也是这样,不过我的是在0xd0000000-0xD0070000处很正常,超过就和你一样了,我的数据线基本等长,差距不超过20mil,但地址线之间未等长,大概差了150mil
麦田稻草
4楼-- · 2019-07-21 12:54
 精彩回答 2  元偷偷看……
麦田稻草
5楼-- · 2019-07-21 17:37
回复【3楼】wangxipeng:
---------------------------------
你的降低主频就正常吗?
wangxipeng
6楼-- · 2019-07-21 21:04
回复【5楼】麦田稻草:
---------------------------------
这个没测试过,不过我是自己做的板子,sdram也不一样,所以我一直以为是没初始化好。

一周热门 更多>