I am using CY62256 SRAM in my project. I use approx 30K of this 32K RAM for xdata. Upon system startup, RAM check is done by the following piece of code. Is it the right way to do, or more and more techniques have to be followed?
#define xbyte ((unsigned char volatile xdata*)0) unsigned char RAMCheck(void) { unsigned char i,j; unsigned int no; for(no=0;no<0x8000;no++) //check the RAM 0x8000 locations (0-32K) { i=xbyte[no]; xbyte[no]=0x55; //write 0x55 & read it & check whether correctly written j = xbyte[no]; if(j != 0x55) return 1; //if no then return 1 which will cause CPU to stop here and resets the controller xbyte[no]=0xaa; //similarly write 0xaa & check by reading it j = xbyte[no]; if(j != 0xaa) return 1; xbyte[no]=i; }//HERE, 1 IS RETURNED IF A SPECIFIED LOCATION FAILS TO READ THE VALUE WRITTEN }
kindly advise..
Simply writing a value and immediately reading it back can pass even with no RAM chips fitted! (capacitances can be sufficient that the signal levels remain on the bus wires)
You code does not check any other possible faults - such as addressing errors.
For a detailed discussion of the types of errors that commonly occur in memory systems, and how to test for them, search for the aticle "Software-Based Memory Testing" by Michael Barr:
www.embedded.com/.../master.htm
continued...
* How to do non-destructive RAM test if I am using 32K SRAM with 30K data usage? * What are the popular and successful SRAM testing methods? * What are good RAM testing algorithms for testing 32K SRAM's? * How to do a more thorough SRAM test (32K) at the expense of speed/time? * RAM flush methods (CY62256 SRAM) I am using: a) shorting VCC and GROUND (In power Off Condition) b) Stuffing 0x0000-0x7FFE with 0 Are both same?
"* What are the popular and successful SRAM testing methods? * What are good RAM testing algorithms for testing 32K SRAM's? * How to do a more thorough SRAM test (32K) at the expense of speed/time?"
These are all answered in the article previously cited. Have you read it yet?
That's a completely different subject - you should start a new thread for that!
Excellent link! Thank you!
nice set of articles listed on embedded but i cant download any to view.
maybe try later after lunch. might have a curry or a roll and a drink.
have YOU got the file?
i can not get it :(
The direct link is: ftp.embedded.com/.../memtest.zip
If that doesn't work, just Google for "Software-Based Memory Testing by Michael Barr" - it also appears on several other sites...
did the google and got it on first entry.
thanks mista.