memory test

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

memory test

7,200 Views
SG
Contributor I
Hi,
 
Has anyone attempted online RAM test for 8 bit processor (9s08GT16)? We are required to do a walk pat test of the RAM area every 3 seconds. Any pointers or code would be greatly appreciated. Thanks, SG
Labels (1)
0 Kudos
5 Replies

791 Views
SG
Contributor I
I need to check how many bytes are typically used for stack operation but you are right, I would follow your advise and move the block and allow the stack pointer to point to the new moved block address.
 
As to your question regarding actions upon fault detection, I am disabling interrupts and I indicate the user of hardware error fault. I am sending status and fault indication to another processor via serial comm. The fault would then be acknowledged and reset by cycling power to the board.
 
Thanks,
SG
0 Kudos

791 Views
SG
Contributor I

Thanks for your inputs. Our code is not very big and I am trying to minimize the usage of RAM area and declare most constants in flash. I have checksum routine for flash. That way the usage of variables are minimized.

I plan to test blocks of memory and move the variables area into the tested memory area and back. Stack is going to be a challenge and I need to figure a way out.

Reason for the stringent requirement is because the micro is used in safety critical application & these requirements come from regulatory boards. Thanks for your inputs though...

SG 

0 Kudos

791 Views
bigmac
Specialist III

Hello SG,

Quote:
I plan to test blocks of memory and move the variables area into the tested memory area and back. Stack is going to be a challenge and I need to figure a way out.

If your stack usage does not exceed the size of the test block, perhaps it is only necessary to also appropriately change the stack pointer when you transfer the existing stack data to the holding block, and back again.  I cannot see any problems, provided interrupts are disabled during the transfer process.

What is the strategy if you ever do detect an error?  Do you need to continue operation, or is there a safe shut-down process?

Regards,
Mac

 

0 Kudos

791 Views
tonyp
Senior Contributor II
To whomever is so paranoid to ask you this, I'd give them this counter-argument and let them spin in circles for ever:
 
How do you guarantee that fault will not occur in the second timing counter?  If Bit 0 goes, for example, you'll never be able to count to 3!
 
Seriously, such tests are only meaningful before the very first RAM access, immediately after reset.  Even a single push (e.g., calling the test routine) violates the whole concept.  That's why, normally, such code is inline, staight out of startup, and uses exclusively only whatever MCU registers are there.  At any other time, the sought for possible RAM fault is likely to cause a fatal crash, anyway, unless they've found ways to guarantee what addresses the fault(s) will fall in between!
 
In flash-based MCUs, in particular, chances are far greater that Flash will fail first, and your code will go bananas before it knows what hit it.
0 Kudos

791 Views
rocco
Senior Contributor II

SG wrote:
We are required to do a walk pat test of the RAM area every 3 seconds.

Wow. That seems extreme. How do you do that without shutting down the application?

I run memory and bus pattern tests on power-up, but that is before the application is running and the ram is in use. The stack seems especially problematic with interrupts enabled.

But if you can shut down the application every three seconds, here is how I would do it:

Set aside some ram for a temporary buffer. Maybe 32 bytes.
Write a routine that can thoroughly test any 32 byte (or whatever) block of ram.
Test the temporary buffer first.
One at a time, move a block of ram to the temp buffer.
Test the block that the data was just moved from.
Replace the original data from the temp buffer after the test.
Move on to the next block of ram, until all blocks are tested.

You would have to make sure no subroutines are called and no interrupts occur while testing the stack area.
0 Kudos