CPU Self Test

Test Name: CPU Self Test.

Purpose of test: Verify functional correctness of all CPU instructions/core features.

Requirement ID: SW_CPU_SELF_TEST_LIB_01

Acceptable Measure: Functional Test.

Description: The CPU Self-test is intended to periodically verify during run-time, that all CPU core features are working correctly.

The test is divided into three subsets and each subset test different parts of the CPU core.

During test execution, each subset will store register context to SRAM, perform a series of tests and results are stored in the CPU registers r0-r31.

At certain points, the registers are tested if they contain the expected values.

If this test passes, the 16-bit passing signature is incrementally built and the test continues to next part of the subset until it reaches the end of the test. If the registers do not contain the expected values, the test is aborted and will skip the rest of the subset. At the end of each subset, register context is restored so that the application can continue, this happens even if the subset fails.

API Documentation: SW_CPU_SELF_TEST_LIB_01

Initialization/Setup: Disable interrupts completely during the execution of each test subset function.

Error Reporting: Each test subset generates a unique 16-bit numerical test result, which can be compared to the corresponding expected result value.

Any mismatch between the generated and expected result can be flagged by the application software as an error condition for that specific test subset.

If the entire subset was executed as expected, the 16-bit passing signature will be complete, and the test will exit normally and test has passed.

If the test fails at some point, the test will be aborted, and the passing signature will be incomplete when exiting and test fails.

Refer to the AVR® Instruction Set Manual for a complete list of instructions available for the device. Refer to the device Safety Manual for more details of the test.

Note: The SLEEP and SPM instructions are not tested due to not being recommended for use in a safety application.

The functionality of the WDR instruction is tested by the WDT simple and WDT window test.

Interrupt functionality is not tested in the CPU_SELF_TEST_LIB, but is covered by the INTERRUPT_FREQUENCY_TEST.