敬请期待
2023/11/15 更新
DDR3的参数就这么多,我们来逐一解释一下每一条的含义
我们的板子是使用了三星的K4B1G1646G-BCH9,1Gbit,DDR3-1333,实际因为AM335x的ddr频率最多支持400Mhz,所以只能运行在DDR3-800的频率。下面的计算,也都是按照DDR3-800来计算的。
计算DDR3参数会使用到2个工具,
AM335x_DDR_register_calc_tool
AM335x DDR3 Software Leveling Program
直接给出运算结果
这个计算可以算出来TIM1,TIM2,TIM3三个参数
EMIF_SDCFG,是配置DDR3类型,x16,pagesize,row size等,芯片选定后,是固定的
EMIF_SDREG,控制DDR3数据刷新率,根据K4B1G1646G的手册,刷新率在低于85°时,为7.8us,85°到95°时减半为3.9us。根据400Mhz时钟频率,必须要0xc30个clock刷一次,才能保证数据的完整性。 400*7.8=3120。
User Guide For AM335x DDR3 Software Leveling Program MLO
方法可以参考这个帖子 http://www.deyisupport.com/question_answer/dsp_arm/sitara_arm/f/25/t/53263.aspx
另外,AM335x的DDR3 software leveling可以通过SD卡运行啦!
我们知道,在AM335x的设计中,如果使用的是DDR3、DDR3L,是必须要进行software leveling的。其目的在于根据当前板卡的实际布线情况,通过leveling算法优化当前的DDR3的参数配置。而针对这套算法,之前我们提供的方式略微繁琐,使用仿真器连接到板卡的JTAG口,修改GEL脚本进行初始化后,通过CCS工具将.out程序加载到AM335x上,执行参数优化算法。
现在,通过我们本地FAE的努力,已经将该算法移植到了bootloader中,也就是说你可以直接将本贴中的MLO拷贝到SD卡FAT32分区中,使用SD卡启动AM335x,即可通过串口进行参数的输入,得到优化的参数配置!这样一来,就可以避免仿真器、JTAG、CCS、改GEL脚本等一系列复杂的操作啦!
PS:目前,我们可以支持303MHz和400MHz两个频率,串口0作为调试串口,具体的使用方法可以参考User Guide。
截图如下:
结果:
-----------------------------------------------------------------------------------------------------------------------------------------
给出我们自己的板子的运算结果
//
// 自己的板子
//
AM335x DDR3 Software Leveling -- Version: Beta 3.0
-- Copyright: Texas Instruments China Local Team
*************************** Program Start********************************
Please input the AM335x EMIF Timing Configuration:
-- AM335x Default EMIF Timing configuration (for StarterKit EVM) --
DDR3_EMIF_SDRAM_TIM_1 : 0x0888A39B
DDR3_EMIF_SDRAM_TIM_2 : 0x26337FDA
DDR3_EMIF_SDRAM_TIM_3 : 0x501F830F
DDR3_EMIF_SDRAM_CONFIG : 0x61C04AB2
Your choice: 1. Use the default one; 2. Input your own one.
Please Choose The DDR3 Frequency: 1. 303MHz; 2. 400MHz.
AM335x DDR3 Software Leveling -- Version: Beta 3.0
-- Copyright: Texas Instruments China Local Team
*************************** Program Start********************************
Please input the AM335x EMIF Timing Configuration:
-- AM335x Default EMIF Timing configuration (for StarterKit EVM) --
DDR3_EMIF_SDRAM_TIM_1 : 0x0888A39B
DDR3_EMIF_SDRAM_TIM_2 : 0x26337FDA
DDR3_EMIF_SDRAM_TIM_3 : 0x501F830F
DDR3_EMIF_SDRAM_CONFIG : 0x61C04AB2
Your choice: 1. Use the default one; 2. Input your own one.
Please Choose The DDR3 Frequency: 1. 303MHz; 2. 400MHz.
DDR3 Frequency is Set at 400MHz!
Please input your DDR3_EMIF_SDRAM_TIM_1 conifguration (in Hex) :
0x0AAAE4E3
Please input your DDR3_EMIF_SDRAM_TIM_2 conifguration (in Hex) :
0x242F7FDA
Please input your DDR3_EMIF_SDRAM_TIM_3 conifguration (in Hex) :
0x501f82bf
Please input your DDR3_EMIF_SDRAM_CONFIG conifguration (in Hex) :
0x61c052b2
Your input EMIF Timing configuration --
DDR3_EMIF_SDRAM_TIM_1 : 0xAAAE4E3
DDR3_EMIF_SDRAM_TIM_2 : 0x242F7FDA
DDR3_EMIF_SDRAM_TIM_3 : 0x501F82BF
DDR3_EMIF_SDRAM_CONFIG : 0x61C052B2
Please Enter the PHY_INVERT_CLKOUT value (0 or 1) from the spreadsheet :
0
Please Enter the Seed RD_DQS_SLAVE_RATIO Value in Hex to search the RD DQS Ratio Window :
0x26
Please Enter the Seed FIFO_WE_SLAVE_RATIO Value in Hex to search the RD DQS Gate Window :
0x55
Please Enter the Seed WR_DQS_SLAVE_RATIO Write DQS Ratio Value in Hex to search the Write DQS Ratio Window :
0x36
Please Enter the Seed PHY_CTRL_SLAVE_RATIO Value in Hex :
0x80
The ratio seeds for the DDR3 Software Leveling :
invert_clkout = 0x0
RD_DQS_RATIO_VAL = 0x26
FIFO_WE_SLAVE_RATIO = 0x55
WR_DQS_SLAVE_RATIO = 0x36
PHY_CTRL_SLAVE_RATIO = 0x80
The Slave Ratio Search Program Values are...
***************************************************************
DATA_PHY_RD_DQS_SLAVE_RATIO is :0x3B
DATA_PHY_FIFO_WE_SLAVE_RATIO is : 0x8D
DATA_PHY_WR_DQS_SLAVE_RATIO is : 0x3C
DATA_PHY_WR_DATA_SLAVE_RATIO is : 0x6F
***************************************************************
rd_dqs_range = 59
fifo_we_range = 141
wr_dqs_range = 60
wr_data_range = 111
Optimal values not reached, rerunning program with new values...
The Slave Ratio Search Program Values are...
***************************************************************
DATA_PHY_RD_DQS_SLAVE_RATIO is :0x3B
DATA_PHY_FIFO_WE_SLAVE_RATIO is : 0x97
DATA_PHY_WR_DQS_SLAVE_RATIO is : 0x44
DATA_PHY_WR_DATA_SLAVE_RATIO is : 0x74
***************************************************************
rd_dqs_range = 0
fifo_we_range = 10
wr_dqs_range = 8
wr_data_range = 5
Optimal values not reached, rerunning program with new values...
The Slave Ratio Search Program Values are...
***************************************************************
DATA_PHY_RD_DQS_SLAVE_RATIO is :0x3B
DATA_PHY_FIFO_WE_SLAVE_RATIO is : 0x98
DATA_PHY_WR_DQS_SLAVE_RATIO is : 0x4B
DATA_PHY_WR_DATA_SLAVE_RATIO is : 0x7D
***************************************************************
rd_dqs_range = 0
fifo_we_range = 1
wr_dqs_range = 7
wr_data_range = 9
Optimal values not reached, rerunning program with new values...
The Slave Ratio Search Program Values are...
***************************************************************
DATA_PHY_RD_DQS_SLAVE_RATIO is :0x3B
DATA_PHY_FIFO_WE_SLAVE_RATIO is : 0x99
DATA_PHY_WR_DQS_SLAVE_RATIO is : 0x50
DATA_PHY_WR_DATA_SLAVE_RATIO is : 0x84
***************************************************************
rd_dqs_range = 0
fifo_we_range = 1
wr_dqs_range = 5
wr_data_range = 7
Optimal values not reached, rerunning program with new values...
The Slave Ratio Search Program Values are...
***************************************************************
DATA_PHY_RD_DQS_SLAVE_RATIO is :0x3B
DATA_PHY_FIFO_WE_SLAVE_RATIO is : 0x96
DATA_PHY_WR_DQS_SLAVE_RATIO is : 0x52
DATA_PHY_WR_DATA_SLAVE_RATIO is : 0x89
***************************************************************
rd_dqs_range = 0
fifo_we_range = 3
wr_dqs_range = 2
wr_data_range = 5
Optimal values not reached, rerunning program with new values...
The Slave Ratio Search Program Values are...
***************************************************************
DATA_PHY_RD_DQS_SLAVE_RATIO is :0x3B
DATA_PHY_FIFO_WE_SLAVE_RATIO is : 0x96
DATA_PHY_WR_DQS_SLAVE_RATIO is : 0x52
DATA_PHY_WR_DATA_SLAVE_RATIO is : 0x8B
***************************************************************
rd_dqs_range = 0
fifo_we_range = 0
wr_dqs_range = 0
wr_data_range = 2
Optimal values have been found!!
***************************************************************
DATA_PHY_RD_DQS_SLAVE_RATIO is :0x3B
DATA_PHY_FIFO_WE_SLAVE_RATIO is : 0x96
DATA_PHY_WR_DQS_SLAVE_RATIO is : 0x52
DATA_PHY_WR_DATA_SLAVE_RATIO is : 0x8B
***************************************************************
===== END OF TEST =====
DDR3 software leveling done!
这个就是我们最终的结果。按照这个参数设置DDR3即可。