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

SOME/IP Fixed 8-Byte Header

SOME/IP Header Layout
  Byte  0-1:  Service ID     (uint16)  — identifies the service interface
  Byte  2-3:  Method/Event ID (uint16)  — method call or event notification
  Byte  4-7:  Length          (uint32)  — total message size MINUS first 8 bytes
  Byte  8-9:  Client ID       (uint16)  — identifies the calling client
  Byte 10-11: Session ID      (uint16)  — incremented per request; used for matching response
  Byte   12:  Protocol Version (uint8)  — 0x01
  Byte   13:  Interface Version(uint8)  — matches ServiceInterface.version in ARXML
  Byte   14:  Message Type   (uint8):
                0x00 = REQUEST (client → server, expects RESPONSE)
                0x01 = REQUEST_NO_RETURN (fire-and-forget)
                0x02 = NOTIFICATION (server → subscriber, one-way)
                0x80 = RESPONSE (server → client, matches Client+Session ID)
                0x81 = ERROR (server → client, error response)
  Byte   15:  Return Code    (uint8):
                0x00 = E_OK
                0x01 = E_NOT_OK
                0x22 = E_UNKNOWN_METHOD
                0x23 = E_WRONG_MESSAGE_TYPE
Pythonsomeip_parse_header.py
import struct

def parse_someip_header(data: bytes) -> dict:
    """Parse SOME/IP 16-byte header (8 fixed + 8 request header)"""
    if len(data) < 16:
        raise ValueError(f"Too short: {len(data)} bytes")
    service_id, method_id, length, client_id, session_id,         proto_ver, iface_ver, msg_type, return_code =         struct.unpack(">HHIBBHHBBBB", data[:16])
    return {
        "service_id":    f"0x{service_id:04X}",
        "method_id":     f"0x{method_id:04X}",
        "length":        length,
        "client_id":     f"0x{client_id:04X}",
        "session_id":    session_id,
        "msg_type":      {0x00:"REQUEST",0x02:"NOTIFICATION",0x80:"RESPONSE"}.get(msg_type, f"0x{msg_type:02X}"),
        "return_code":   "E_OK" if return_code == 0 else f"0x{return_code:02X}",
    }

# Example: parse a SOME/IP NOTIFICATION
raw = bytes([0x12,0x34, 0x80,0x01, 0x00,0x00,0x00,0x04,
             0x00,0x01, 0x00,0x05, 0x01, 0x01, 0x02, 0x00,
             0x00,0x00, 0x27,0x10])  # payload: VehicleSpeed = 10000 (×0.01 = 100 km/h)
hdr = parse_someip_header(raw)
print(hdr)

Transport Binding: UDP vs TCP

Communication PatternTransportWhy
Events (NOTIFICATION)UDPFire-and-forget; multicast possible; low overhead per packet
Methods (REQUEST/RESPONSE)TCPReliable delivery; connection-based; response guaranteed or timeout
Service Discovery (SD)UDP multicast (port 30490)SD must reach all nodes on subnet without prior connection
Large payloads (>65 KB)SOME/IP-TP over UDPSegmentation layer above single datagram limit

💡 UDP Multicast for Events

SOME/IP events sent over UDP multicast reach all subscribed nodes with a single transmission — the IP stack replicates the packet, not the application. This is far more efficient than sending individual unicast UDP packets to each subscriber when many nodes subscribe to the same event (e.g., VehicleSpeed). Configure a multicast group address (239.x.x.x range) in the Service Instance Manifest for event groups that benefit from multicast delivery.

Service Instance Concept

XMLvsomeip_config.json
// vsomeip configuration: SpeedService server
{
    "unicast": "192.168.1.100",
    "applications": [{
        "name": "SpeedServer",
        "id": "0x1111"
    }],
    "services": [{
        "service":  "0x1234",   // Service ID
        "instance": "0x5678",   // Instance ID (distinguishes multiple instances)
        "reliable": {           // TCP for method calls
            "port": "30501"
        },
        "unreliable": {         // UDP for event notifications
            "port": "30502"
        },
        "events": [{
            "event":     "0x8001",   // Event ID (Methods 0x0001-0x7FFF; Events 0x8000-0xFFFF)
            "is_field":  "false",
            "update-cycle": "10"     // 10 ms event cycle
        }],
        "eventgroups": [{
            "eventgroup": "0x0001",  // Eventgroup ID for SD SubscribeEventgroup
            "events":    ["0x8001"]
        }]
    }]
}

GENIVI vsomeip Stack Architecture

vsomeip Architecture
  Application Layer (C++)
  ara::com Proxy / Skeleton API (AUTOSAR Adaptive)
        │
  ara::com vsomeip binding
        │
  vsomeip library (libvsomeip3.so)
  ├── Service Discovery Manager (SD state machine)
  ├── Routing Manager (inter-process message routing)
  ├── E2E Protection layer (optional)
  └── Transport Layer
      ├── UDP socket (events, SD)
      └── TCP socket (method calls)
        │
  Linux TCP/IP stack
        │
  100BASE-T1 Automotive Ethernet PHY

Summary

SOME/IP's fixed 16-byte header (8 protocol + 8 request) encodes service routing (Service ID + Method/Event ID), call tracking (Client ID + Session ID for request/response demultiplexing), and message semantics (Message Type). UDP is the preferred transport for events due to multicast capability and low overhead; TCP is used for methods where response delivery must be guaranteed. vsomeip is the reference implementation used in most AUTOSAR Adaptive deployments.

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

← PreviousHands-On: FlexRay Schedule ConfigurationNext →Service Discovery (SD) Protocol