Home Learning Paths ECU Lab Assessments Interview Preparation Arena Pricing Log In Sign Up

Cycle Design Process

Pythonflexray_cycle_design.py
# FlexRay communication cycle design: slot matrix generation
# Input: signal list with rates and payloads

import math

GDCYCLE_MS = 2     # 2 ms communication cycle
MAX_SLOTS  = 100   # available static slots
PAYLOAD_BYTES = 24 # gPayloadLengthStatic = 12 words = 24 bytes

signals = [
    # (name, payload_bytes, rate_ms, node)
    ("SteeringTorque",   8,  2, "ECU_EPS"),
    ("BrakePressure",   16,  2, "ECU_ESC"),
    ("WheelSpeeds",     16,  2, "ECU_ESC"),
    ("EngineStatus",    12,  2, "ECU_ENG"),   # 2ms → every cycle
    ("TransmissionCmd",  8,  4, "ECU_TCU"),   # 4ms → every 2nd cycle
    ("XCP_Data",        24, 10, "ECU_ENG"),   # 10ms → every 5th cycle
]

slot_matrix = []
for name, payload, rate_ms, node in signals:
    cycles_per_tx = max(1, rate_ms // GDCYCLE_MS)
    slots_needed  = math.ceil(payload / PAYLOAD_BYTES)
    slot_matrix.append({
        "signal": name, "node": node,
        "slots": slots_needed, "cycle_rep": cycles_per_tx
    })
    print(f"{name}: {slots_needed} slot(s) every {cycles_per_tx} cycle(s) — {node}")

total_static = sum(s["slots"] for s in slot_matrix)
print(f"\nTotal static slots: {total_static}/{MAX_SLOTS} "
      f"({total_static/MAX_SLOTS*100:.0f}% utilised)")

Payload Length Constraint and PDU Multiplexing

All static slots in a FlexRay cluster share the same gPayloadLengthStatic value — determined by the largest required payload. If most signals need only 8 bytes but one needs 24 bytes, every slot wastes 16 bytes. AUTOSAR FrIf I-PDU multiplexing packs multiple smaller signals into one slot payload, recovering this overhead.

XMLFrIf_IPDU_Multiplex.arxml


  FlexRay_Cluster_0
  12  



  Safety_Frame_Slot1
  24  
  
    /Com/IPdus/SteeringTorque_PDU
    MOST-SIGNIFICANT-BYTE-FIRST
    0  
  
  
    /Com/IPdus/BrakeRequest_PDU
    8  
  
  

Startup and Wakeup Sequences

Cflexray_startup.c
/* FlexRay startup sequence per AUTOSAR FrNm and EcuM */
#include "Fr.h"
#include "FrNm.h"

void FlexRay_StartupSequence(void)
{
    Fr_POCStatusType poc_status;

    /* Step 1: Wakeup — send WUS symbol on Channel A */
    Fr_SendWUP(FR_CHANNEL_A);
    /* WUS is ~50 µs duration pulse; all sleeping nodes detect it */

    /* Step 2: Wait for wakeup observation period (50 ms default) */
    /* During this time, other nodes wake up and enter CONFIG state */

    /* Step 3: Enter READY state */
    Fr_AllowColdstart(FR_CHANNEL_A);

    /* Step 4: Cold-start (if this node is the first cold-start node) */
    /* Node transmits CAS (Collision Avoidance Symbol) then begins counting slots */
    Fr_StartCommunication(FR_CHANNEL_A);

    /* Step 5: Integration — other nodes synchronise to the running cluster */
    /* Integration complete when ≥ 2 nodes are synchronised */
    /* Monitor: Fr_GetPOCStatus() returns FR_POCSTATE_NORMAL_ACTIVE */
    do {
        Fr_GetPOCStatus(FR_CHANNEL_A, &poc_status);
    } while (poc_status.State != FR_POCSTATE_NORMAL_ACTIVE);

    /* FlexRay cluster operational */
    FrNm_StartupIndication();  /* Notify FrNm → triggers ComM network mode */
}

AUTOSAR FrIf and FrTp

ModuleResponsibilityKey Config
FrIf (FlexRay Interface)Maps AUTOSAR I-PDUs to FlexRay slots, cycle offsets, channelsFrIfLPduRef → slot/cycle/channel; handles Channel A/B redundant reception
FrTp (FlexRay Transport Protocol)Segments large PDUs (OTA, diagnostics) across multiple cyclesFrTpConnectionRef → max 254-byte payload per TP PDU; N_As/N_Cr timeouts
FrNm (FlexRay Network Management)Coordinates sleep/wake across FlexRay clusterFrNmTimeoutTime; FrNmRepeatMsgTime; integrates with ComM
FrSM (FlexRay State Manager)Manages FlexRay CC state machine from application layerFrSmRequestedMode: FR_POCSTATE_NORMAL_ACTIVE / FR_POCSTATE_HALT

Summary

FlexRay cycle design requires matching signal rates to the cycle period — a 5 ms signal in a 2 ms cycle uses one static slot every 2–3 cycles with cycle repetition configuration. PDU multiplexing recovers bandwidth wasted by the fixed slot payload constraint. The startup sequence — wakeup symbol, cold-start node election, integration phase — takes 50–200 ms and is managed by AUTOSAR FrNm and EcuM wakeup source handling.

🔬 Deep Dive — Core Concepts Expanded

This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.

Key principles to reinforce:

  • Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
  • Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
  • Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.

🏭 How This Topic Appears in Production Projects

  • Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
  • Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
  • Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.

⚠️ Common Mistakes and How to Avoid Them

  1. Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
  2. Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
  3. Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
  4. Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.

📊 Industry Note

Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.

← PreviousClock Synchronization MechanismNext →Hands-On: FlexRay Schedule Configuration