完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
新手,最近在学习BF518的一个小的核心板,板上有一块SDRAM,型号为MT48LC32M16A2-75 ,想测试一下从SDRAM的读写。仿真器型号为HPUSE-ICE。以下是读写程序:
[size=10.0000pt]#include [size=10.0000pt] [size=10.0000pt]#include [size=10.0000pt] [size=10.0000pt]#include [size=10.0000pt] [size=10.0000pt]void [size=10.0000pt]Set_PLL[size=10.0000pt]([size=10.0000pt]unsigned [size=10.0000pt]int[size=10.0000pt] pmsel,[size=10.0000pt]unsigned [size=10.0000pt]int[size=10.0000pt] pssel) [size=10.0000pt]{ [size=10.0000pt]unsigned [size=10.0000pt]int[size=10.0000pt] new_PLL_CTL; [size=10.0000pt]*pPLL_DIV = pssel; [size=10.0000pt]asm[size=10.0000pt]([size=10.0000pt]"ssync;"[size=10.0000pt]); [size=10.0000pt]new_PLL_CTL = (pmsel & 0x3f) << 9; [size=10.0000pt]*pSIC_IWR |= 0xffffffff; [size=10.0000pt]if[size=10.0000pt] (new_PLL_CTL != *pPLL_CTL) [size=10.0000pt]{ [size=10.0000pt]*pPLL_CTL = new_PLL_CTL; [size=10.0000pt]asm[size=10.0000pt]([size=10.0000pt]"ssync;"[size=10.0000pt]); [size=10.0000pt]asm[size=10.0000pt]([size=10.0000pt]"idle;"[size=10.0000pt]); [size=10.0000pt]} [size=10.0000pt]} [size=10.0000pt]//EBIU配置 [size=10.0000pt]void [size=10.0000pt]Init_EBIU[size=10.0000pt]([size=10.0000pt]void[size=10.0000pt]) [size=10.0000pt]{ [size=10.0000pt]*pEBIU_AMBCTL0 [size=10.0000pt]= 0x7bb07bb0; [size=10.0000pt]*pEBIU_AMBCTL1 [size=10.0000pt]= 0xffc07bb0; [size=10.0000pt]*pEBIU_AMGCTL [size=10.0000pt]= 0x000f; [size=10.0000pt]//SRAM配置 [size=10.0000pt]} [size=10.0000pt]void [size=10.0000pt]Init_SDRAM[size=10.0000pt]([size=10.0000pt]void[size=10.0000pt]) [size=10.0000pt]{ [size=10.0000pt]*pEBIU_SDRRC = 0x0781; [size=10.0000pt]*pEBIU_SDBCTL = 0x0025; [size=10.0000pt]*pEBIU_SDGCTL = 0x0091998d; [size=10.0000pt] ssync(); //SDRAM配置 [size=10.0000pt]} [size=10.0000pt]/**************************************************************************** [size=10.0000pt]* 名称 : speed_w_test_2 [size=10.0000pt]* 功能 : 测试代码,对DDR内存作测试 [size=10.0000pt]* 入口参数 :无 [size=10.0000pt]* 返回值 :无 [size=10.0000pt]****************************************************************************/ [size=10.0000pt]void [size=10.0000pt]speed_w_test_2[size=10.0000pt]([size=10.0000pt]void[size=10.0000pt]) [size=10.0000pt]{ [size=10.0000pt]int[size=10.0000pt] i; [size=10.0000pt]volatile [size=10.0000pt]unsigned [size=10.0000pt]short[size=10.0000pt] * DDRdata; [size=10.0000pt]DDRdata = 0; [size=10.0000pt]for[size=10.0000pt](i=0;i<0x2000000;i++) [size=10.0000pt]{ [size=10.0000pt]if[size=10.0000pt](i%2) [size=10.0000pt]{ [size=10.0000pt]*DDRdata [size=10.0000pt]= [size=10.0000pt]0xaaaa; [size=10.0000pt]DDRdata++; [size=10.0000pt]} [size=10.0000pt]if[size=10.0000pt](!(i%2)) [size=10.0000pt]{ [size=10.0000pt]*DDRdata [size=10.0000pt]= [size=10.0000pt]0x5555; [size=10.0000pt]DDRdata++; [size=10.0000pt]} [size=10.0000pt]} [size=10.0000pt]} [size=10.0000pt]/**************************************************************************** [size=10.0000pt]* 名称 : speed_r_test_2 [size=10.0000pt]* 功能 : 测试代码,对DDR内存作测试 [size=10.0000pt]* 入口参数 :无 [size=10.0000pt]* 返回值 :无 [size=10.0000pt]****************************************************************************/ [size=10.0000pt]void [size=10.0000pt]speed_r_test_2[size=10.0000pt]([size=10.0000pt]void[size=10.0000pt]) [size=10.0000pt]{ [size=10.0000pt]int[size=10.0000pt] i,temp1; [size=10.0000pt]int[size=10.0000pt] error=0; [size=10.0000pt]volatile [size=10.0000pt]unsigned [size=10.0000pt]short[size=10.0000pt] * DDRdata; [size=10.0000pt]DDRdata = 0; [size=10.0000pt]for[size=10.0000pt](i=0;i<0x2000000;i++) [size=10.0000pt]{ [size=10.0000pt]if[size=10.0000pt](i%2) [size=10.0000pt]{ [size=10.0000pt]temp1 = *DDRdata; [size=10.0000pt]DDRdata++; [size=10.0000pt]if[size=10.0000pt](temp1 != 0xaaaa) [size=10.0000pt]{ [size=10.0000pt]error = 1; [size=10.0000pt]printf[size=10.0000pt]([size=10.0000pt]"error! [size=10.0000pt]i is %x, temp is %xn"[size=10.0000pt],i,temp1); [size=10.0000pt]break[size=10.0000pt]; [size=10.0000pt]} [size=10.0000pt]} [size=10.0000pt]if[size=10.0000pt](!(i%2)) [size=10.0000pt]{ [size=10.0000pt]temp1 = *DDRdata;; [size=10.0000pt]DDRdata++; [size=10.0000pt]if[size=10.0000pt](temp1 != 0x5555) [size=10.0000pt]{ [size=10.0000pt]error = 1; [size=10.0000pt]printf[size=10.0000pt]([size=10.0000pt]"error! [size=10.0000pt]i is %x, temp is %xn"[size=10.0000pt],i,temp1); [size=10.0000pt]break[size=10.0000pt]; [size=10.0000pt]} [size=10.0000pt]} [size=10.0000pt]} [size=10.0000pt]if[size=10.0000pt](!error) [size=10.0000pt]printf[size=10.0000pt]([size=10.0000pt]"Test Verify that the data is correctly.n"[size=10.0000pt]); [size=10.0000pt]else [size=10.0000pt]printf[size=10.0000pt]([size=10.0000pt]"Test Verify that the data is errors.n"[size=10.0000pt]); [size=10.0000pt]} [size=10.0000pt]void [size=10.0000pt]main[size=10.0000pt]([size=10.0000pt]void[size=10.0000pt]) [size=10.0000pt]{ [size=10.0000pt]Set_PLL(16,4); [size=10.0000pt] Init_EBIU(); [size=10.0000pt]Init_SDRAM(); [size=10.0000pt]printf[size=10.0000pt]([size=10.0000pt]"init ok"[size=10.0000pt]); [size=10.0000pt]printf[size=10.0000pt]([size=10.0000pt]"Start the test, please wait.n"[size=10.0000pt]); [size=10.0000pt] speed_w_test_2(); [size=10.0000pt] speed_r_test_2(); [size=10.0000pt]printf[size=10.0000pt]([size=10.0000pt]"End of the test.n"[size=10.0000pt]); [size=10.0000pt]} 该程序在VDSP++5.0下可编译,且最后检测无误。将该程序移植到CCES1.1.0下也可编译通过,但运行时出现如下: [size=10.0000pt]A fatal error or exception has occurred. [size=10.0000pt] Description: A data CPLB miss has occurred without a corresponding CPLB entry. [size=10.0000pt] General Type: RunTimeError [size=10.0000pt] Specific Type: DCPLBMissWithoutReplacement [size=10.0000pt] General Code: 0x8 [size=10.0000pt] Specific Code: 0x320 [size=10.0000pt] Error Value: 0x01000000 [size=10.0000pt] Error PC: 0xffa01d5e 没太理解其中的意思,望大家给予解释,或提供修改建议。 |
|
相关推荐
1个回答
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
918 浏览 2 评论
给ADUM4223 增加信号驱动15V电压就不正常, 波动很大会被烧是什么情况?
1328 浏览 2 评论
ADP5092 SYS端口为2.09V,但是REG_OUT为0是什么原因?
1917 浏览 1 评论
ad7193差分输入ain1与ain2差是正值时,读到电压与实际值误差小,但为负值值,误差就变的很大
4252 浏览 2 评论
9024 浏览 1 评论
ADC3442采集,分析数据出现有规则毛刺,请问是哪方面的问题啊?
1451浏览 3评论
AD7190状态寄存器一直是0x80,连续转换模式下RDY不拉低
1670浏览 2评论
924浏览 2评论
1647浏览 2评论
给ADUM4223 增加信号驱动15V电压就不正常, 波动很大会被烧是什么情况?
1331浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-5 09:40 , Processed in 0.842600 second(s), Total 78, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号