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