lpcware

LPC1788 and SDRAM

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by marcolando on Fri Feb 12 11:58:15 MST 2016
Hy guys,
I think I've a problem with an SDRAM (Micron MT48LC4M32) connected to the processor.
After the initialization I run a very very simple test:
long EMC_Test(void)
{// test SDRAM

long * SDRAM_ptr = RAM_BASE;
long i, count;

count = 0;
for (i = 0; i < RAM_CELL; i++)
{// write data
*SDRAM_ptr = i;// write data to SDRAM
if(*SDRAM_ptr++ == i)
count++;
}
return (count >> 6);// return value in kByte
}

and doing so it works...
but if I do the same test splitting write to memory and read from memory in two separate loops the test fails...
long EMC_Test(void)
{// test SDRAM

long * SDRAM_ptr = RAM_BASE;
long i, count;

count = 0;
for (i = 0; i < RAM_CELL; i++)
{// write data
*SDRAM_ptr++ = i;// write data to SDRAM
}

SDRAM_ptr = RAM_BASE;

for (i = 0; i < RAM_CELL; i++)
{// read data
if(i == *SDRAM_ptr++)// read data from SDRAM
count++;
}

return (count >> 6);// return value in kByte
}

Any ideas to start my investigation?
Thank you very much in advance,
Marco.

Outcomes