Hello,
before an Embedded Wizard GUI application is running on a custom specific hardware, it is essential that the entire hardware including SDRAM is working properly. The SDRAM timing and refresh parameter have to be set carefully according the datasheet of the memory.
In order to verify that the SDRAM of a custom specific hardware is working correctly, the following memory test is helpful. Please put the following code snippet into your ewmain.c file and call the test function just before the initialization of the memory manager:
void TestSDRAM( void )
{
unsigned char* ptr;
unsigned char data;
unsigned int count;
unsigned int delay = 1;
EwPrint( "Check memory at address 0x%08X with size 0x%08X\r\n", EW_MEMORY_POOL_ADDR, EW_MEMORY_POOL_SIZE );
EwPrint( "Write test pattern to SDRAM... " );
ptr = (unsigned char*)( EW_MEMORY_POOL_ADDR );
data = 0x00;
count = EW_MEMORY_POOL_SIZE;
while ( count-- )
{
*ptr++ = data++;
if ( data >= 253 )
data = 0;
}
EwPrint( "[OK]\r\n" );
while ( delay < 256 )
{
EwPrint( "Read test pattern from SDRAM... " );
ptr = (unsigned char*)( EW_MEMORY_POOL_ADDR );
data = 0x00;
count = EW_MEMORY_POOL_SIZE;
while ( count-- )
{
if ( *ptr++ != data++ )
EwPrint( "Error at address 0x%08X\r\n", ptr-1 );
if ( data >= 253 )
data = 0;
}
EwPrint( "[OK]\r\n" );
EwPrint( "Waiting for %d seconds...", delay );
EwBspOsDelay( delay * 1000 );
EwPrint( "\r\n" );
delay *= 2;
}
}
Feel free to adapt the code to test the SDRAM more intensiv. The delay time between the read sequences is essential to verify that the SDRAM refresh is working correctly and the the memory content is stable for long time.
I hope this helps...
Manfred.