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

Implementing Hazard Analysis and Risk Assessment

Perform systematic hazard identification and risk assessment to define safety goals that mitigate potential system failures during the design phase.

In this lesson, you will learn how to systematically identify potential system failures and quantify their risks to establish safety goals before you write your first line of production code.

The Systematic Approach to Safety

Hazard Analysis and Risk Assessment (HARA) is the foundation of functional safety. It is a top-down process where we evaluate the system’s functions to identify "hazards"—potential conditions that could lead to harm. Unlike debugging, which fixes known issues, HARA aims to predict failures before they occur by analyzing the impact of hardware or software malfunctions.

To perform a HARA, we evaluate every system function against three criteria: Severity (how bad is the harm?), Exposure (how often are we in a situation where the harm could occur?), and Controllability (can the operator or system mitigate the hazard?).

From Hazards to Safety Goals

Once you identify a hazard (e.g., "Unexpected acceleration in an EV controller"), you must derive a Safety Goal. A Safety Goal is a high-level requirement that defines the behavior needed to keep the system in a safe state. For example, if your Hazard Analysis reveals that a corrupted memory state could lead to unintended actuator movement, your safety goal might be: "The system shall transition to a Safe State within 10ms of detecting a memory corruption event."

This requirement then drives your architectural decisions, such as implementing Memory Protection Units (MPUs) for isolation or Hardware Watchdogs for recovery.

Implementation Example

Consider a simple sensor-actuator loop. We analyze the risk of a "stuck-at" fault in our sensor input:

// Safety Goal: Detect sensor failure and enter Safe State
void sensor_read_task(void) {
    uint32_t raw_data = read_sensor();
    
    // Risk mitigation: Sanity check based on HARA requirement
    if (raw_data > SENSOR_MAX_THRESHOLD || raw_data < SENSOR_MIN_THRESHOLD) {
        set_system_safe_state(); // Trigger recovery defined by safety goals
        log_fault_and_halt();
    }
}

By formalizing these risks during the design phase, you ensure that safety is an inherent architectural property rather than an afterthought. This process provides the evidence required for industry-standard compliance and ensures that your failure-handling strategies—like Graceful Degradation—are aligned with the actual risk profile of your system.

Key Takeaway: Hazard Analysis and Risk Assessment transforms abstract system dangers into concrete, measurable safety goals that dictate your hardware and software architecture.