Testing Program and Data Memory

Here is another memory testing question.  Thank you Artimage and Anju for your last Global Memory Testing contributions.

Is there an easy way to test program memory and data memory?  My code resides out of program memory and all of my initialize sections are in data memory.  This test has to be in real-time (no compile or load time testing).  There are no operating systems just embedded code in a DSP processor.

Who is Participating?
Anju111599Connect With a Mentor Commented:
An *easy* way?  Let somebody else do it, lol!

Interesting question.  It begs more questions, though:  

1.  How much memory must be tested?  
2.  How fast can you access memory (cpu speed, memory bus speed).
3.  Using the numbers from question two and the number of cycles it takes to run a complete set of tests on a single memory location, you can calculate approximately how long would it take to test all of the memory.  Is it physically possible to test all of memory in the allotted time?
4.  You say you must test both the data and code sections of memory.  Will your particular cpu allow you to access the code section from a running process without a problem?  If you're using something like the intel family of cpus, they have a "real" mode and a "protected" mode.  The real mode allows you to do anything...  but protected mode makes it pretty darn hard to write to the code segment ;)

Saving memory from the data segment while you're running tests is not difficult.  You could simply pull in the value from a memory location, stick it in a holding register, do your tests, then write the value from the holding register back to the tested location before moving on to the next location.

Testing the code segment is more interesting if you're also going to have to test the memory your test code resides in.  One approach would be to make the code relocatable and move it just before testing the memory it currently resides in, then jump to the new location to execute the test.

There are several RAM tests that are typically done in embedded systems to verify the integrity and interconnect to the RAM.  

Perhaps a typical embedded startup sequence may do the following:
1) Code starts executing out of ROM
2) This code performs a RAM test on a small portion of RAM
3) Some code is copied to the RAM that was just tested, and execution jumps to the newly loaded RAM
4) RAM Code performs another RAM test on the rest of RAM
5) After final RAM test is done, the rest of the ROM code is copied down to its appropriate RAM locations.

RAM Tests should test the following:
1) Stuck data bit
Walk a '1' across a single RAM address.  Verify what you write is what you read, ie, first write '00000001', read '00000001', write '00000010', read '00000010', etc...

2) Stuck address bit
-To each RAM address write '10101010'.
-Verify that you read '10101010' from each address.
As you read each address, write '01010101' to the address just read
-Verify that you read '01010101' to each address.  As you read each address, write '10101010' to the address just read.
-Verify that you read '10101010' back from each address.

kph1Author Commented:
The program memory test must be quick and must be ran every 3 seconds.

Also what would you do with the variables that point to different sections of memory while testing data memory?
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Perhaps reserve a section of memory that you use for testing only?  Or do you have to test the memory that you are actively using?
kph1Author Commented:
Thank you for your comments.  You gave me some good ideas.
You're very welcome!  I didn't think I'd answered your question...  unless you're going to take my suggestion and get someone else to do the testing? <grin>

I'd love to hear how this project turns out.  It sounds like you have some fun stuff to work on.  I believe I read somewhere that giving out e-mail addresses here is taboo, but does that still hold true if you went and searched for my e-mail address on Yahoo?  

Keep me posted, okay?

Anju Amur
kph1Author Commented:
No, I found out I that I could do a checksum on the program memory.   The only problem with that is the architecture on the DSP I am using does not allow direct accesses to the program memory so I have to use DMA.  It is more complicated then this, but I won't go into it now.

For the internal data memory (IDM), I plan to copy the information residing in the memory to on-chip memory (that has already been tested) and perform a destructive test on IDM memory then move the information back.

BTW, how is the weather in Marietta? :)
Sounds like you have the problem licked.  Great!

And it's sunny and cool here :)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.