|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2011-12-2 14:47:37
|
显示全部楼层
SDRAM还是那个SDRAM,EMC的寄存器大多是一样,多了个EMCDLYCTL的寄存器,我写了个0x00000808的值.
LPC_SC->PCONP |= 0x00000800;
LPC_SC->EMCDLYCTL = 0x00000808;
LPC_EMC->Control = 0x00000001;
LPC_EMC->Config = 0x00000000;
LPC_EMC->DynamicConfig0 = 0x680;
LPC_EMC->DynamicReadConfig = 0x00000001; /* Command delayed strategy, using EMCCLKDELAY */
LPC_EMC->DynamicRasCas0 = 0x303; // RAS=3 CCLKs,CAS=3 CCLKs
LPC_EMC->DynamicRP = 1;
LPC_EMC->DynamicRAS = 3;
LPC_EMC->DynamicSREX = 7;
LPC_EMC->DynamicAPR = 2;
LPC_EMC->DynamicDAL = 5;
LPC_EMC->DynamicWR = 1;
LPC_EMC->DynamicRC = 5;
LPC_EMC->DynamicRFC = 5;
LPC_EMC->DynamicXSR = 7;
LPC_EMC->DynamicRRD = 1;
LPC_EMC->DynamicMRD = 2;
delayMs(0, 200); /* wait 100ms */
LPC_EMC->DynamicControl = 0x00000183; /* Issue NOP command */
delayMs(0, 400); /* wait 200ms */
LPC_EMC->DynamicControl = 0x00000103; /* Issue PALL command */
LPC_EMC->DynamicRefresh = 0x00000002; /* ( n * 16 ) -> 32 clock cycles */
for(i = 0; i < 0x40; i++); /* wait 128 AHB clock cycles */
LPC_EMC->DynamicRefresh = 28;
LPC_EMC->DynamicControl = 0x00000083; /* Issue MODE command */
dwtemp = *((volatile unsigned int *)(SDRAM_BASE | (0x32<<(13))));
LPC_EMC->DynamicControl = 0x00000000; /* Issue NORMAL command */
LPC_EMC->DynamicConfig0 = 0x80680; |
|