打印
[DSP编程]

EMIF中的SDRAM实验

[复制链接]
1101|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
yangmm11|  楼主 | 2014-11-14 16:07 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
/* This is an example for EMIF of C5509                                                                                  */
/*----------------------------------------------------------------------------*/
#include <csl.h>
#include <csl_pll.h>
#include <csl_emif.h>
#include <csl_chip.h>

/* Uint16 x; */
/* Uint32 y; */
CSLBool b;
unsigned int datacount = 0;
int databuffer[1000] ={0};
int *souraddr,*deminaddr;
/*锁相环的设置*/
PLL_Config  myConfig      = {
  0,    //IAI: the PLL locks using the same process that was underway
                //before the idle mode was entered
  1,    //IOB: If the PLL indicates a break in the phase lock,
                //it switches to its bypass mode and restarts the PLL phase-locking
                //sequence
  24,    //PLL multiply value; multiply 24 times
  1             //Divide by 2 PLL divide value; it can be either PLL divide value
                //(when PLL is enabled), or Bypass-mode divide value
                //(PLL in bypass mode, if PLL multiply value is set to 1)   CPU frequency = 144 MHz
};
/*SDRAM的EMIF设置*/
EMIF_Config emiffig = {
  0x221,         //EGCR  : the MEMFREQ = 001,the clock for the memory is 1/2 to cpu frequence
                          //                  the WPE = 0 ,forbiden the writing posting when we debug the EMIF
                          //        the MEMCEN = 1,the memory clock is reflected on the CLKMEM pin
                          //        the NOHOLD = 1,HOLD requests are not recognized by the EMIF
  0xFFFF,        //EMI_RST: any write to this register resets the EMIF state machine
  0x3FFF,        //CE0_1:  CE0 space control register 1
                          //        MTYPE = 011,Synchronous DRAM(SDRAM),16-bit data bus width
  0xFFFF,   //CE0_2:  CE0 space control register 2
  0x00FF,   //CE0_3:  CE0 space control register 3
                          //        TIMEOUT = 0xFF;
  0x7FFF,        //CE1_1:  CE1 space control register 1
  0xFFFF,        //CE1_2:  CE1 space control register 2
  0x00FF,        //CE1_3:  CE1 space control register 3

  0x7FFF,        //CE2_1:  CE2 space control register 1
  0xFFFF,        //CE2_2:  CE2 space control register 2
  0x00FF,        //CE2_3:  CE2 space control register 3

  0x7FFF,        //CE3_1:  CE3 space control register 1
  0xFFFF,        //CE3_2:  CE3 space control register 2
  0x00FF,        //CE3_3:  CE3 space control register 3

  0x2911,   //SDC1:   SDRAM control register 1
                          //                  TRC = 8
                          //        SDSIZE = 0;SDWID = 0
                          //        RFEN = 1
                          //        TRCD = 2
                          //        TRP  = 2
  0x0410,        //SDPER : SDRAM period register
                          //                  7ns *4096
  0x07FF,    //SDINIT: SDRAM initialization register
                          //        any write to this register to init the all CE spaces,
                          //        do it after hardware reset or power up the C55x device
  0x0131        //SDC2:          SDRAM control register 2
                          //        SDACC = 0;
                          //        TMRD = 01;
                          //        TRAS = 0101;
                          //        TACTV2ACTV = 0001;                                                               
  };
main()
{
        /*初始化CSL库*/       
    CSL_init();

    /*EMIF为全EMIF接口*/
    CHIP_RSET(XBSR,0x0a01);

    /*设置系统的运行速度为144MHz*/
    PLL_config(&myConfig);

    /*初始化DSP的外部SDRAM*/
    EMIF_config(&emiffig);
上述程序是外部存储器接口的SDRAM实验中,配置SDRAM的EMIF接口程序。
在TMS320VC5509的EMIF手册中提到  


1、在这个程序中,CPU频率为144MHz,MEMFREQ=001b,那从哪配置EBSR中的EMIFX2 bit?
2、main函数中,EMIF为全EMIF接口, CHIP_RSET(XBSR,0x0a01); XBSR这个寄存器中的各个位的含义是什么?没找到有关这个寄存器的介绍啊?


相关帖子

沙发
yangmm11|  楼主 | 2014-11-17 17:52 | 只看该作者
找了半天,原来XBSR寄存器就是EBSR寄存器啊,CHIP_RSET(XBSR,0x0a01); 就是对EBSR寄存器中位的配置。。。

但是就是不理解为啥要写成XBSR这个名字,也没找到相关的说明。。。。

使用特权

评论回复
板凳
zhangmangui| | 2014-11-18 22:30 | 只看该作者
yangmm11 发表于 2014-11-17 17:52
找了半天,原来XBSR寄存器就是EBSR寄存器啊,CHIP_RSET(XBSR,0x0a01); 就是对EBSR寄存器中位的配置。。。

...


这个不行就到工程下追查一下CSL的里面相关定义吧   
相关资料  分享
https://bbs.21ic.com/icview-689482-1-1.html

使用特权

评论回复
地板
yangmm11|  楼主 | 2014-11-19 09:06 | 只看该作者
zhangmangui 发表于 2014-11-18 22:30
这个不行就到工程下追查一下CSL的里面相关定义吧   
相关资料  分享
https://bbs.21ic.com/icview-689482- ...

非常感谢,我从CSL里面找到了相关的定义。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

10

主题

67

帖子

0

粉丝