初始化EMC代码<br /><br /> EMC_CTRL = 0x00000001;//Enable EMC<br /> PCONP |= 0x00000800; //set PIN's <br /> PINSEL4 = 0x50000000; //p2[14:15] selected as /CS2 cs3 function<br /> PINSEL6 = 0x55555555; //P3[0:15] selected as data bus function<br /> PINSEL8 = 0x55555555; //P4[0:15] selected as address bus function<br /> PINSEL9 = 0x50555555;//p4[20:23] selected as address bus,p4<br /> //[24:25] selected as /OE,/WE <br /> <br /> EMC_STA_CFG2 = 0x01; //select the memory config for /CS2<br /> EMC_STA_WAITWEN2 = 0x01;<br /> EMC_STA_WAITOEN2 = 0x01; /* delay 1cclk */<br /> EMC_STA_WAITRD2 = 0x1f; /* delay 33cclks */<br /> EMC_STA_WAITPAGE2 = 0x1f; /* delay 1cclk */<br /> EMC_STA_WAITTURN2 = 0x0F; /* bus idle 1cclk */<br /> EMC_STA_WAITWR2 = 0x1f;<br /><br />执行下面的代码<br /><br />while(1)<br />{ <br /> *(volatile unsigned short *)(0x82000000+i)=0x5555;<br /> *(volatile unsigned short *)(0x82000000+i)=0xaaaa;<br /> j= *(volatile unsigned short *)(0x82000000+i) ;<br />}<br /><br />用示波器观看写WE信号,一直是高电平。但是RD信号正常。片选信号正常。数据信号正常。为了担心WE pin坏了,用IO口方式操作WE对应的引脚。置高低都正常。<br /><br />郁闷了半天,不明白问题出在什么地方。用过的指点一下,先谢谢!<br /> |
|