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

SD Message Structure

SOME/IP-SD Message Layout
  SOME/IP Header (Service ID=0xFFFF, Method ID=0x8100)
  ├── SD Header (8 bytes):
  │     Flags byte: Bit7=Reboot, Bit6=Unicast, Bit5=EIDC
  │     3 reserved bytes
  ├── Entry Array (variable):
  │     Service Entry (Type 0x00=FindService, 0x01=OfferService, 0x81=StopOfferService)
  │       Service ID, Instance ID, Major Version, TTL, Minor Version
  │     Eventgroup Entry (Type 0x06=SubscribeEventgroup, 0x07=SubscribeEventgroupAck)
  │       Service ID, Instance ID, Major Version, TTL, Counter, Eventgroup ID
  └── Options Array (variable):
        IPv4 Endpoint Option: IP address (4B) + reserved + transport (UDP/TCP) + port
        IPv6 Endpoint Option: IP address (16B) + reserved + transport + port

OfferService FSM Implementation

Pythonsd_offer_fsm.py
# SOME/IP-SD OfferService state machine (server side)
import time, random, threading

class SDServerFSM:
    def __init__(self, service_id, instance_id, ip, port):
        self.service_id  = service_id
        self.instance_id = instance_id
        self.ip          = ip
        self.port        = port
        self.state       = "DOWN"

    def start(self):
        self.state = "INITIAL_WAIT"
        # Random initial delay 10-500 ms prevents SD storm on simultaneous ECU power-on
        delay = random.uniform(0.010, 0.500)
        print(f"Service 0x{self.service_id:04X}: Initial wait {delay*1000:.0f}ms")
        time.sleep(delay)

        # Repetition phase: OfferService at doubling intervals
        self.state = "REPETITION"
        base_delay = 0.010  # 10 ms base
        for n in range(3):  # RepetitionMaxCount = 3
            self._send_offer()
            time.sleep(base_delay * (2 ** n))  # 10ms, 20ms, 40ms

        # Main phase: periodic OfferService
        self.state = "MAIN"
        while True:
            self._send_offer()
            time.sleep(1.0)  # SdCycleOfferServiceDelay = 1000 ms

    def _send_offer(self):
        print(f"→ OfferService: 0x{self.service_id:04X}/0x{self.instance_id:04X} "
              f"at {self.ip}:{self.port} [{self.state}]")

Eventgroup Subscribe and Notify Flow

Subscribe/Notify Sequence
  Client (Subscriber)                     Server (Publisher)
  ──────────────────────────────────────────────────────────
  Receives OfferService (Main Phase)
  Sends SubscribeEventgroup:
    Entry Type=0x06, Eventgroup ID=0x0001
    TTL=0xFFFFFF (indefinite), Counter=0
    Endpoint Option: 192.168.1.200 UDP 30502   ──────────────►
                                                Validates subscription
                                              ◄────────────────
                                                SubscribeEventgroupAck:
                                                Entry Type=0x07, same IDs

  Subscription confirmed — server adds client to multicast/unicast list
                                              ◄────────────────
                                                NOTIFICATION every 10 ms:
                                                Service=0x1234, Event=0x8001
                                                Payload: VehicleSpeed=100 km/h
  Client processes event via GetNewSamples()

SD Timing Tuning

ParameterConservativeAggressiveTrade-off
InitialDelayMinValue50 ms5 msLarger = less SD storm on power-on; slower service availability
InitialDelayMaxValue500 ms50 msLarger = more spread of SD traffic
RepetitionBaseDelay30 ms10 msSmaller = faster client discovery; more SD traffic
RepetitionMaxCount35More repetitions = higher probability of client finding service
OfferCyclicDelay1000 ms200 msSmaller = faster re-discovery after client reboot; more SD bandwidth
SubscriptionTTL0xFFFFFF (indefinite)3000 msShorter TTL requires periodic re-subscribe; enables stale-subscription cleanup

Summary

SOME/IP-SD orchestrates dynamic service discovery without preconfigured IP mappings. The OfferService FSM's three phases (Initial Wait, Repetition, Main) spread SD traffic across startup to prevent network congestion. SubscribeEventgroup establishes the publisher-subscriber relationship — after the Ack, the server sends NOTIFICATION events directly to the subscriber's endpoint. Timing tuning balances startup latency against SD bandwidth overhead; over-aggressive OfferCyclicDelay wastes network bandwidth on large fleets.

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

← PreviousSOME/IP Protocol FundamentalsNext →Events, Methods, and Fields