Content originally posted in LPCWare by Dave on Fri May 11 21:46:52 MST 2012
What type of test software are you using to determine how "perfectly" your SDRAM was working on your prototype?
Can you run a diagnostic on your original prototype and see how it performs?
I too just finished a prototype board, but I used the 208pin QFP. Also, in my layout, I length matched all of the signals to each other, and have an average length of 3.5" (all within 50 mils of each other), and my prototype functions fine at 120Mhz.
I use a delay constant of 0x00000C04 in LPC_SC->EMCDLYCTL...
Here is copy of the comprehensive memory test I used on my prototype:
<code>
void SDRAM_Test( void )
{
uint32_t register *uint32_t_ptr;
uint16_t register *uint16_t_ptr;
register uint32_t Mask32;
register uint16_t Mask16;
uint32_t i, k, Count, ErrorCount;
uint32_t RelativeTimer;
Count = 0;
ErrorCount = 0; // zero error count for this run...
ANSIsetcolor( BRIGHT, ANSI_WHITE, ANSI_BLUE ); // set Hyperterm colors
printf("COUNT BYTES CLR MEMSIZE16 WALKBIT16 ALTBIT16 SEQBIT16 MEMSIZE32 WALKBIT32 ALTBIT32 SEQBIT32 ERRORS EMCcal\r\n");
printf("----- ------- ----- --------- --------- -------- -------- --------- --------- -------- -------- ------ ------\r\n");
while( 1 )
{
ANSIsetcolor( BRIGHT, ANSI_YELLOW, ANSI_BLUE ); // set Hyperterm colors
printf("%05u ", Count++);
printf("%07u %03ums ",(uint32_t)(SDRAM_SIZE), ClearSDRAM()); // Clear content before 16 bit access test
ANSIsetcolor( BRIGHT, ANSI_WHITE, ANSI_BLUE ); // set Hyperterm colors
k = SDRAM_SIZE>>1; // size in bytes divided by 2 (16bit access)
printf("%09u ", k); // show memory size...
ANSIsetcolor( BRIGHT, ANSI_YELLOW, ANSI_BLUE ); // set Hyperterm colors
/* walking bit test 16-bit -------------------------------*/
RelativeTimer = SystemTimer;
for( Mask16=0x0001; Mask16; Mask16 <<= 1 )
{
uint16_t_ptr = (uint16_t *)(SDRAM_BASE_ADDR);
for( i=0; i<k; i++ )
{
*uint16_t_ptr = Mask16;
if( *uint16_t_ptr++ != Mask16 )
ErrorCount++;
}
}
RelativeTimer = SystemTimer - RelativeTimer;
printf( "%7ums ", RelativeTimer);
/* ------------------------------------------------------ */
/* alternate bit test 16-bit -----------------------------*/
RelativeTimer = SystemTimer;
for( Mask16=0x5555; Mask16!=0x5554; Mask16 <<= 1 )
{
uint16_t_ptr = (uint16_t *)(SDRAM_BASE_ADDR);
for( i=0; i<k; i++ )
{
*uint16_t_ptr = Mask16;
if( *uint16_t_ptr++ != Mask16 )
ErrorCount++;
}
}
RelativeTimer = SystemTimer - RelativeTimer;
printf( "%6ums ", RelativeTimer);
/* ------------------------------------------------------ */
/* unique value test 16-bit ----------------------------- */
uint16_t_ptr = (uint16_t *)(SDRAM_BASE_ADDR);
RelativeTimer = SystemTimer;
for( i=0; i<k; i++ )
*uint16_t_ptr++ = ( i%65536 );
uint16_t_ptr = (uint16_t *)(SDRAM_BASE_ADDR);
for( i=0; i<k; i++ )
{
if( *uint16_t_ptr++ != ( i%65536 ) )
ErrorCount++;
}
RelativeTimer = SystemTimer - RelativeTimer;
printf( "%6ums ", RelativeTimer);
/* ------------------------------------------------------ */
ANSIsetcolor( BRIGHT, ANSI_WHITE, ANSI_BLUE ); // set Hyperterm colors
k = SDRAM_SIZE>>2; // size in bytes divided by 4 (32bit access)
printf("%09u ", k); // show memory size...
ANSIsetcolor( BRIGHT, ANSI_YELLOW, ANSI_BLUE ); // set Hyperterm colors
/* walking bit test 32-bit -------------------------------*/
RelativeTimer = SystemTimer;
for( Mask32=0x00000001; Mask32; Mask32 <<= 1 )
{
uint32_t_ptr = (uint32_t *)(SDRAM_BASE_ADDR);
for( i=0; i<k; i++ )
{
*uint32_t_ptr = Mask32;
if( *uint32_t_ptr++ != Mask32 )
ErrorCount++;
}
}
RelativeTimer = SystemTimer - RelativeTimer;
printf( "%7ums ", RelativeTimer);
/* alternate bit test */
/* ------------------ */
RelativeTimer = SystemTimer;
for( Mask32=0x55555555; Mask32!=0x55555554; Mask32 <<= 1 )
{
uint32_t_ptr = (uint32_t *)(SDRAM_BASE_ADDR);
for( i=0; i<k; i++ )
{
*uint32_t_ptr = Mask32;
if( *uint32_t_ptr++ != Mask32 )
ErrorCount++;
}
}
RelativeTimer = SystemTimer - RelativeTimer;
printf( "%6ums ", RelativeTimer);
/* unique value test */
/* ----------------- */
uint32_t_ptr = (uint32_t *)(SDRAM_BASE_ADDR);
RelativeTimer = SystemTimer;
for( i=0; i<k; i++ )
*uint32_t_ptr++ = i;
uint32_t_ptr = (uint32_t *)(SDRAM_BASE_ADDR);
for( i=0; i<k; i++ )
{
if( *uint32_t_ptr++ != i )
ErrorCount++;
}
RelativeTimer = SystemTimer - RelativeTimer;
printf( "%6ums %6u ", RelativeTimer, ErrorCount);
printf( "%3d\r\n", Check_EMCCAL() );
}
}
</code>