[X]关闭

Miz702开发板在Linux如何读写DDR3

文档创建者:lanejim
浏览次数:5503
最后更新:2016-07-15
本帖最后由 lanejim 于 2016-7-15 08:49 编辑

各位技术大牛:
   请教下,Miz702的ZYNQ开发板如何在Linux操作DDR3,开发板上有两片DDR3,在《Miz702 ZYNQ开发教程》的第十四章 ZYNQ DDR3 PS读写操作方案里面有简单的例子,有个问题不明白,因为开发板上有两片DDR3,如何知道操作的是哪一片DDR3?是通过DDR3的地址吗?通过地址如何看出是哪一片DDR3?地址定义如下
#define XPAR_DDR_MEM_BASEADDR 0x00000000U
#define XPAR_DDR_MEM_HIGHADDR 0x3FFFFFFFU

#define DDR_BASEARDDR XPAR_DDR_MEM_BASEADDR + 0x10000000
for(i=0; i<32; i++)
{
    Xil_Out32(DDR_BASEARDDR+i*4,i);
}
for(i=0; i<32; i++)
{
    rev = Xil_In32(DDR_BASEARDDR+i*4);
    xil_printf("the address at %x data is : %x \n\r" ,DDR_BASEARDDR+i*4, rev);
}
对于该实验,第一次完全按照实验来操作,实验结果如下
Hello World

the address at 10000000 data is : 0
the address at 10000004 data is : 1
the address at 10000008 data is : 2
the address at 1000000C data is : 3
the address at 10000010 data is : 4
the address at 10000014 data is : 5
the address at 10000018 data is : 6
the address at 1000001C data is : 7
the address at 10000020 data is : 8
the address at 10000024 data is : 9
the address at 10000028 data is : A
the address at 1000002C data is : B
the address at 10000030 data is : C
the address at 10000034 data is : D
the address at 10000038 data is : E
the address at 1000003C data is : F
the address at 10000040 data is : 10
the address at 10000044 data is : 11
the address at 10000048 data is : 12
the address at 1000004C data is : 13
the address at 10000050 data is : 14
the address at 10000054 data is : 15
the address at 10000058 data is : 16
the address at 1000005C data is : 17
the address at 10000060 data is : 18
the address at 10000064 data is : 19
the address at 10000068 data is : 1A
the address at 1000006C data is : 1B
the address at 10000070 data is : 1C
the address at 10000074 data is : 1D
the address at 10000078 data is : 1E
the address at 1000007C data is : 1F
第二次实验,屏蔽写操作,只进行读操作

//for(i=0; i<32; i++)
//{
    //Xil_Out32(DDR_BASEARDDR+i*4,i);
//}
for(i=0; i<32; i++)
{
    rev = Xil_In32(DDR_BASEARDDR+i*4);
    xil_printf("the address at %x data is : %x \n\r" ,DDR_BASEARDDR+i*4, rev);
}

得出来的结果如下:
Hello World

the address at 10000000 data is : 8BC6BE7F
the address at 10000004 data is : B3F8A2FF
the address at 10000008 data is : 288AC96B
the address at 1000000C data is : A8EAEF68
the address at 10000010 data is : FC9D7EEF
the address at 10000014 data is : B2DCC4DD
the address at 10000018 data is : 45D5CE6F
the address at 1000001C data is : 3AD3BFDE
the address at 10000020 data is : DD5232B3
the address at 10000024 data is : 5B6BFBBB
the address at 10000028 data is : 491FF4B9
the address at 1000002C data is : 7F70E2FB
the address at 10000030 data is : 7AAEA1FA
the address at 10000034 data is : 2E9BB28D
the address at 10000038 data is : BCDEE2EB
the address at 1000003C data is : AFD7E0AB
the address at 10000040 data is : ABBB6DD5
the address at 10000044 data is : EE4A39AC
the address at 10000048 data is : EE2B22C6
the address at 1000004C data is : DFADE99B
the address at 10000050 data is : BC8F98EA
the address at 10000054 data is : DF05A144
the address at 10000058 data is : F1BE43BF
the address at 1000005C data is : AD1DD97B
the address at 10000060 data is : 7CB6EFD8
the address at 10000064 data is : 9AEEF2B8
the address at 10000068 data is : CB2BEF13
the address at 1000006C data is : 86EFDFAC
the address at 10000070 data is : 9E1F43E9
the address at 10000074 data is : 33BB77DD
the address at 10000078 data is : B621EDEF
the address at 1000007C data is : A765231F

这是什么原因呢?难道两次读出来的不应该一样吗?
那么问题来了,
如何在Linux下操作DDR3呢?
望各位大牛指点下






发表评论已发布 2

osrc_fans

发表于 2016-7-15 09:19:55 | 显示全部楼层

2个DDR都是16位的,合起来是32位,而我们是32位操作的,所以是数据是一半写到一个DDR,另一半写到另一个DDR

lanejim

发表于 2016-7-15 11:27:32 | 显示全部楼层

多谢楼上指点
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则