Course contentsShow
← Embedded Systems & Computer Architecture
Lesson 667 of 9369. Embedded Systems Reliability and SafetyFree lesson

Utilizing Dual Core Lockstep Execution

Configure dual-core processors to operate in lockstep mode to detect transient hardware faults by comparing instruction execution results in real-time.

In this lesson, you will learn how to configure a dual-core processor to operate in lockstep mode to achieve instantaneous hardware fault detection.

The Concept of Lockstep Execution

When we discuss system reliability, we must account for transient hardware faults—often called "soft errors"—caused by radiation or electromagnetic interference that can flip a bit in a register or flip-flop. While techniques like Triple Modular Redundancy (TMR) provide fault tolerance by voting, Dual Core Lockstep (DCLS) focuses specifically on high-assurance fault detection.

In lockstep mode, two identical processor cores execute the exact same instruction stream simultaneously. A hardware comparator monitors the output buses (registers, address bus, and data bus) of both cores in real-time. If the signals from Core A and Core B do not match at any clock cycle, the comparator immediately triggers a high-priority exception or a safety interrupt.

Implementing the Safety Logic

Unlike software-based redundancy, DCLS is managed at the hardware configuration level, usually during the initialization phase or via eFuses/registers. Once enabled, the application code itself remains largely agnostic, but you must ensure your exception handlers are ready to catch the comparison failure.

void Lockstep_Fault_Handler(void) {
    // This ISR is triggered by the hardware comparator
    // if Core A and Core B outputs diverge.
    Disable_Safety_Critical_Outputs(); 
    Enter_Safe_State(); // Transition to a predetermined safe mode
    Log_Error_And_Reset();
}

Why Use Lockstep?

The primary advantage is that DCLS provides zero-latency detection. Because the comparison happens cycle-by-cycle, you detect the fault the very moment it occurs, preventing the propagation of corrupted data into your memory or external peripherals.

While this does not provide the "masking" capability of TMR (where the system keeps working despite one failure), it is highly effective for safety-critical systems that must stop or reset immediately if they can no longer guarantee the integrity of their calculations. By combining this with Independent Watchdog Timer Hardware, you create a robust safety foundation that ensures no corrupted state can persist within the system.

Key Takeaway: Dual Core Lockstep provides cycle-accurate fault detection by comparing the outputs of two synchronized cores, enabling immediate intervention before hardware errors propagate through your system.