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

Traffic Capture Tools

ToolPlatformBest For
WiresharkWindows/Linux/MacProtocol dissection, SOME/IP decode, gPTP, DoIP — all built-in
tcpdumpLinuxQuick capture to pcap; pipe to Wireshark for decode
Vector CANoe/ETHWindowsProduction-grade; full AUTOSAR stack decode; signal-level view
IXIA/SpirentLab analyserConformance testing; TSN stream shaping verification
Automotive TAPHardwareNon-intrusive tap on vehicle harness; no performance impact

Exercise 1: Capture and Filter Ethernet Traffic

Bashcapture.sh
#!/bin/bash
# Capture automotive Ethernet traffic (requires Linux with Ethernet interface)
# Replace eth0 with your interface (e.g., enp3s0 or the TAP interface)

IFACE="eth0"
CAPTURE_FILE="vehicle_trace.pcap"

# Basic capture: all frames on interface
tcpdump -i $IFACE -w $CAPTURE_FILE &
TCPDUMP_PID=$!
echo "Capturing on $IFACE for 30 seconds..."
sleep 30
kill $TCPDUMP_PID

echo "Frames captured: $(tcpdump -r $CAPTURE_FILE | wc -l)"

# Filter: only SOME/IP traffic (UDP port 30490 for SOME/IP-SD; app ports vary)
tcpdump -r $CAPTURE_FILE -w someip_only.pcap 'udp port 30490 or udp portrange 30000-30499'

# Filter: only DoIP traffic (TCP/UDP port 13400)
tcpdump -r $CAPTURE_FILE -w doip_only.pcap 'tcp port 13400 or udp port 13400'

# Filter: only gPTP (EtherType 0x88F7)
tcpdump -r $CAPTURE_FILE -w gptp.pcap 'ether proto 0x88F7'

# Open in Wireshark for analysis
wireshark vehicle_trace.pcap &

Exercise 2: Decode a SOME/IP Frame

Pythondecode_someip.py
#!/usr/bin/env python3
# Manually decode a raw SOME/IP message from bytes
# (Wireshark does this automatically, but understanding the format is essential)

import struct

# Example: raw SOME/IP Request frame (captured from pcap)
# Service 0x0123, Method 0x0ABC, length 12, client 0x0001, session 0x0001
raw_someip = bytes([
    0x01, 0x23,    # Service ID
    0x0A, 0xBC,    # Method ID
    0x00, 0x00, 0x00, 0x0C,   # Length (12 = 8 header + 4 payload)
    0x00, 0x01,    # Client ID
    0x00, 0x01,    # Session ID
    0x01,          # Protocol Version (1)
    0x01,          # Interface Version (1)
    0x00,          # Message Type: Request (0x00)
    0x00,          # Return Code: E_OK (0x00)
    # Payload: uint32 value = 0x0000AABB
    0x00, 0x00, 0xAA, 0xBB
])

def decode_someip_header(data: bytes) -> dict:
    if len(data) < 16:
        raise ValueError("Too short for SOME/IP header")
    svc_id, meth_id, length, client_id, session_id, proto_ver, iface_ver, msg_type, ret_code =         struct.unpack(">HHIHHBBBB", data[:16])
    return {
        "service_id":   f"0x{svc_id:04X}",
        "method_id":    f"0x{meth_id:04X}",
        "length":       length,
        "client_id":    f"0x{client_id:04X}",
        "session_id":   f"0x{session_id:04X}",
        "proto_ver":    proto_ver,
        "iface_ver":    iface_ver,
        "msg_type":     {0x00:"Request",0x01:"RequestNoReturn",0x02:"Notification",
                         0x80:"Response",0x81:"Error"}.get(msg_type, f"0x{msg_type:02X}"),
        "return_code":  {0x00:"E_OK",0x01:"E_NOT_OK",0x09:"E_UNKNOWN_SERVICE"}.get(ret_code, f"0x{ret_code:02X}"),
        "payload":      data[16:16+(length-8)].hex()
    }

header = decode_someip_header(raw_someip)
for k, v in header.items():
    print(f"  {k:15s}: {v}")

Exercise 3: Verify TSN Priority in VLAN Tag

Pythoncheck_pcp.py
#!/usr/bin/env python3
# Parse pcap and report VLAN tag PCP values per protocol
from scapy.all import rdpcap, Ether, Dot1Q, IP, UDP, TCP

packets = rdpcap("vehicle_trace.pcap")

pcp_stats = {}  # dict of {(protocol, PCP): count}

for pkt in packets:
    if pkt.haslayer(Dot1Q):
        pcp = pkt[Dot1Q].prio
        if pkt.haslayer(UDP):
            dport = pkt[UDP].dport
            if dport == 13400:
                proto = "DoIP"
            elif dport == 30490:
                proto = "SOME/IP-SD"
            elif 30000 <= dport <= 30499:
                proto = "SOME/IP"
            else:
                proto = "UDP-other"
        elif pkt.haslayer(TCP):
            proto = "TCP"
        else:
            proto = "Non-IP"
        key = (proto, pcp)
        pcp_stats[key] = pcp_stats.get(key, 0) + 1

print("Protocol         | PCP | Count")
print("-" * 35)
for (proto, pcp), count in sorted(pcp_stats.items()):
    pcp_desc = ["BE","Bkg","Spare","Excl","Ctrl","Video","Voice","Net"][pcp]
    print(f"{proto:16s} | {pcp}   ({pcp_desc}) | {count}")

# Expected: DoIP = PCP 3 (diagnostics), camera SOME/IP = PCP 6 (video), SD = PCP 5

Summary

Wireshark's SOME/IP, DoIP, gPTP, and 802.1Q dissectors work out of the box for automotive Ethernet traces — no plugins required. The most valuable analysis workflow: filter by protocol, check PCP values match the network design specification, and verify that safety-critical streams have PCP 6–7. A common integration bug: SOME/IP application data sent without a VLAN tag (PCP=0 default) instead of the designed PCP=5 — the switch treats it as best-effort and it gets queued behind OTA download traffic, causing latency violations.

🔬 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.

← PreviousAutomotive Ethernet vs IT EthernetNext →Automotive Ethernet Switches