March13N Test API Functions¶
The code for this module is contained in source/stl_march.c and
source/stl_march_s.asm, with include/stl_march.h
containing the API declarations for use by applications.
Error Injection¶
To inject errors to be detected with the STL_March_testRAMCopy() and STL_March_checkErrorStatus() functions, call STL_March_injectError() to set up an error in a RAM location. See your device’s Technical Reference Manual for details on parity/ECC bit placement while the RAM is in test mode to select an appropriate xorMask value. Note that when running STL_March_testRAM(), any injected errors will be overwritten by the first pattern written to the RAM location since this triggers a recalculation of the parity/ECC.
Take care not to inject an error into the region of memory being used to contain the stack. The STL_March_injectError() needs to be able to use the stack, but will not be able to read and write to it as expected after the RAM is put into test mode.
Module Details¶
-
group
stl_march Defines
-
STL_MARCH_PASS0U¶
-
STL_MARCH_CORR_ERROR1U¶
-
STL_MARCH_UNC_ERROR2U¶
-
STL_MARCH_BOTH_ERROR3U¶
Typedefs
-
typedef STL_March_InjectErrorObj *
STL_March_InjectErrorHandle¶ Defines the RAM error logic test handle
Enums
-
enum
STL_March_Pattern¶ Values that must be used to pass to determine the test pattern for STL_March_testRAMCopy() and STL_March_testRAM()
Values:
-
STL_MARCH_PATTERN_ONE= 0x96966969U¶ Test Pattern One.
-
STL_MARCH_PATTERN_TWO= 0x0000FFFEU¶ Test Pattern Two.
-
STL_MARCH_PATTERN_THREE= 0x2AAA5555U¶ Test Pattern Three.
-
STL_MARCH_PATTERN_FOUR= 0xCC3723CCU¶ Test Pattern Four.
-
Functions
-
void
STL_March_testRAMCopy(const STL_March_Pattern pattern, const uint32_t startAddress, const uint32_t length, const uint32_t copyAddress)¶ Performs a March13N non-destructive memory test on the specified RAM memory.
This function performs a March13N memory test on RAM specified by
startAddress and length. This function performs a non-destructive memory test. This means that it will begin by copying the original contents of the memory to copyAddress, perform the memory test, and then copy the original contents back to the memory under test. The test patterns along with the March13N memory test algorithm provided, test memory for stuck-at-faults as well as boundary cases including worst case timings tailored for the C2000 RAM bank architecture.- Parameters
pattern: is the test pattern to use.startAddress: is the address to start the memory test.length: is the number of 32-bit words of the memory test minus 1.copyAddress: is the address to copy the original contents of the memory under test. It will be used to restore the original memory at the end of the March13N memory test.
This test is implemented to be able to perform a memory test on any section of RAM including the stack.
- Note
If this code is running from RAM, be careful not to perform this memory test on itself, meaning do not perform the March13N memory test on the March13N program code in RAM. This will likely lead to an ITRAP. In order to test the program code for this March13N algorithm, the user can create a copy of this function in RAM or flash and run the memory test code from the copy.
This function disables global CPU interrupts (DINT) and then re-enables them after the test has completed.
length is the number of 32-bits words to test minus 1. For example, in order to test 8 32-bit words, length is 7.
- Return
None.
-
void
STL_March_testRAM(const STL_March_Pattern pattern, const uint32_t startAddress, const uint32_t length)¶ Performs a March13N destructive memory test on the specified RAM memory.
This function performs a March13N memory test on RAM specified by
startAddress and length. This test performs a destructive memory test, meaning the original contents will be lost by this test. The test patterns along with the March13N memory test algorithm provided, test memory for stuck-at-faults as well as boundary cases including worst case timings tailored for the C2000 RAM bank architecture.- Parameters
pattern: is the test pattern to use.startAddress: is the address to start the memory test.length: is the number of 32-bit words of the memory test minus 1.
- Note
If this code is running from RAM, be careful not to perform this memory test on itself, meaning do not perform the March13N memory test on the March13N program code in RAM. This will likely lead to an ITRAP. In order to test the program code for this March13N algorithm, the user can create a copy of this function in RAM or flash and run the memory test code from the copy.
This function disables global CPU interrupts (DINT) and then re-enables them after the test has completed.
length is the number of 32-bits words to test minus 1. For example, in order to test 8 32-bit words, length is 7.
- Return
None.
-
void
STL_March_injectError(const STL_March_InjectErrorHandle errorHandle)¶ Injects an error into a RAM memory address.
This function injects an error at a specific memory
address in a specific ramSection. testMode specifies whether the error will be injected in the data or ECC/parity bits. xorMask specifies which bit or bits to flip in order to corrupt either the data or ECC/parity bits.- Parameters
errorHandle: the inject error handle specifying where and what type of error to inject into RAM.
- Return
None.
-
uint16_t
STL_March_checkErrorStatus(void)¶ Returns the status of the Memory Error Registers for RAM.
This function checks if there are any correctable or uncorrectable errors indicated by the Memory Error Registers and returns the status.
- Return
If the Memory Error Registers indicate a correctable error and/or an uncorrectable error in RAM, then the function returns STL_MARCH_CORR_ERROR, STL_MARCH_UNC_ERROR, or STL_MARCH_BOTH_ERROR. Otherwise, the function returns STL_MARCH_PASS.
-
struct
STL_March_InjectErrorObj¶ - #include <stl_march.h>
Defines the March memory test inject error object.
-
Pseudocode¶
Since the core functions in this module are written in assembly, it may be hard to follow for users who are not will versed in the C28x instruction set. Some pseudo-C code versions of the module functions are provided below to make them easier to understand. Some knowledge of the C28x core registers may still be helpful however. See the C28x CPU and Instruction Set Guide for more details.
Pseudocode for STL_March_testRAMCopy() is shown below. STL_March_testRAM() is simply a subset of this code without the save and restore of the RAM contents.
- ::
// // startAddress and copyAddress aren’t pointer types in the prototype // in stl_march.h, but we’ll treat them like pointers for simplicity of // the pseudocode. Increments/decrements to currentPointer and copyPointer // should be assumed to behave like pointer arithmetic, moving from one // 32-bit word to the next. // void STL_March_testRAMCopy(const STL_March_Pattern pattern,
const uint32_t startAddress, const uint32_t length, const uint32_t copyAddress)
- {
iterations = 1 wordCount = length currentPointer = startAddress copyPointer = copyAddress
DINT // Disable interrupts since we’ll be corrupting memory
// // Save the contents of the RAM we’ll be testing // // aSave while(wordCount != 0) {
}
wordCount = length currentPointer = startAddress
// // Fill the memory range with the pattern // // aFill while(wordCount != 0) {
*currentPointer = pattern
currentPointer++ wordCount–
}
// // Perform pattern reads and writes, working in an ascending address // direction. Note that it’s just reading the memory location, but not // checking the value. The ECC/parity check that happens in hardware // is what will catch any errors. // // This loop runs twice–once with ~pattern, then with pattern // // aAscend while(iterations >= 0) {
}
iterations = 1 endPointer = currentPointer // Save the end address+1 for future use
// // Perform pattern reads and writes, this time working in a descending // address direction. // // This loop runs twice–once with ~pattern, then with pattern // // aDescend while(iterations >= 0) {
}
wordCount = length
// // Restore RAM contents, working from end to start // // aRestore while(wordCount != 0) {
}
EINT
return
}