4.1k views
in System Integration by
Hello Embedded Wizard Team!

How can I verify that the SDRAM is working correctly on my custom specific hardware?

1 Answer

0 votes
by
 
Best answer

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.

 

by
What is the best plan of action if this fails?

I have a error a various addresses?

Thanks
by
Difficult to say...

Typically, the timing for the SDRAM is incorrect, sometimes there are conflicts in the configuration of I/O pins for other peripherals. Sometimes the hardware / layout is causing troubles...
by
In my custom harware i dont have usart for console what can i do to check the harware test.
by
You can toggle a GPIO (e.g. connected with a LED) in case that an error happend.

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...