Content originally posted in LPCWare by Scieslik on Fri Apr 20 16:21:42 MST 2012
This is a great catch. I didn't realize that the driver software was doing this. It should definitely be brought to NXP's attention.. However, I managed to figure out my problem (after realizing that this wasn't it).
So, the original driver code looked like this:
<code>
void EMC_Init(void)
{
uint8_t i;
/* Enable clock for EMC */
//CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCEMC, ENABLE);
//LPC_EMC->Control = 0x00000001;
// LPC_EMC->Config = 0x00000000;
LPC_SC->PCONP |= 0x00000800;
LPC_SC->EMCDLYCTL = 0x00001010;
LPC_EMC->Control = 0x00000001;
LPC_EMC->Config = 0x00000000;
/* Pin configuration:
* P2.14 - /EMC_CS2
* P2.15 - /EMC_CS3
*
* P2.16 - /EMC_CAS
* P2.17 - /EMC_RAS
* P2.18 - EMC_CLK[0]
* P2.19 - EMC_CLK[1]
*
* P2.20 - EMC_DYCS0
* P2.21 - EMC_DYCS1
* P2.22 - EMC_DYCS2
* P2.23 - EMC_DYCS3
*
* P2.24 - EMC_CKE0
* P2.25 - EMC_CKE1
* P2.26 - EMC_CKE2
* P2.27 - EMC_CKE3
*
* P2.28 - EMC_DQM0
* P2.29 - EMC_DQM1
* P2.30 - EMC_DQM2
* P2.31 - EMC_DQM3
*
* P3.0-P3.31 - EMC_D[0-31]
* P4.0-P4.23 - EMC_A[0-23]
*
* P4.24 - /EMC_OE
* P4.25 - /EMC_WE
*
* P4.30 - /EMC_CS0
* P4.31 - /EMC_CS1
*/
PINSEL_ConfigPin(2,14,1);
PINSEL_ConfigPin(2,15,1);
PINSEL_ConfigPin(2,16,1);
PINSEL_ConfigPin(2,17,1);
PINSEL_ConfigPin(2,18,1);
PINSEL_ConfigPin(2,19,1);
PINSEL_ConfigPin(2,20,1);
PINSEL_ConfigPin(2,21,1);
PINSEL_ConfigPin(2,22,1);
PINSEL_ConfigPin(2,23,1);
PINSEL_ConfigPin(2,24,1);
PINSEL_ConfigPin(2,25,1);
PINSEL_ConfigPin(2,26,1);
PINSEL_ConfigPin(2,27,1);
PINSEL_ConfigPin(2,28,1);
PINSEL_ConfigPin(2,29,1);
PINSEL_ConfigPin(2,30,1);
PINSEL_ConfigPin(2,31,1);
for(i = 0; i < 32; i++)
{
PINSEL_ConfigPin(3,i,1);
PINSEL_ConfigPin(4,i,1);
}
}
</code>
I obviously didn't need all of these pins to access one EMC bank, especially when it was only a 16-bit SDRAM chip. So I altered the code to what I showed above. Turns out, when I was removing the excess address pins, I'm slightly embarrassed by this, but I forgot to re-enable the WE pin.
I appreciate all of the help, and you guys have definitely given me a better understanding of what's going on in the EMC controller. I'll definitely fix the PINSEL_ConfigPin function to perform properly... (seems like it should just be "*pPIN &= ~(0x00000007);//Clear function bits"
Again, you guys have been a great help to me in getting a better understanding of how this controller works. Thanks so much.