| Aspect | Value | Notes |
|---|---|---|
| Transport | UDP (preferred) or TCP | UDP: events, fire-and-forget; TCP: reliable request/response |
| Port range | Default: 30000–30499 | Configurable per service; SOME/IP-SD uses UDP 30490 |
| Byte order | Big-endian (network order) | All SOME/IP header fields; payload serialisation is configurable |
| Header size | 16 bytes fixed | Service ID (2) + Method ID (2) + Length (4) + Client/Session (4) + Metadata (4) |
| Max payload | UDP: ~65507 bytes; TCP: unlimited (SOME/IP-TP for UDP segmentation) | Camera/LiDAR data uses SOME/IP-TP for large payloads |
| Standard | AUTOSAR SOME/IP R19-11 | Implemented by: vsomeip (open-source), AUTOSAR SomeIpXf, CommonAPI |
SOME/IP: Scalable service-Oriented MiddlewarE over IP
SOME/IP Header: 16-Byte Fixed Header
import struct
# SOME/IP header: 16 bytes, all big-endian
# ┌──────────┬──────────┬──────────────────────┬──────────┬──────────┐
# │ Svc ID │ Meth ID │ Length │ Clnt ID │ Sess ID │
# │ 2 bytes │ 2 bytes │ 4 bytes │ 2 bytes │ 2 bytes │
# ├──────────┴──────────┴──────────────────────┴──────────┴──────────┤
# │ Proto Ver│ Iface Ver│ Msg Type │ Ret Code │ Payload │
# │ 1 byte │ 1 byte │ 1 byte │ 1 byte │ variable │
# └──────────┴──────────┴──────────────────────┴──────────┴──────────┘
MSG_TYPE = {0x00:"Request", 0x01:"RequestNoReturn", 0x02:"Notification",
0x40:"RequestACK", 0x41:"RequestNoReturnACK",
0x80:"Response", 0x81:"Error"}
RET_CODE = {0x00:"E_OK", 0x01:"E_NOT_OK", 0x02:"E_UNKNOWN_SERVICE",
0x03:"E_UNKNOWN_METHOD", 0x04:"E_NOT_READY",
0x05:"E_NOT_REACHABLE", 0x08:"E_MALFORMED_MESSAGE",
0x09:"E_WRONG_PROTOCOL_VERSION", 0x0A:"E_WRONG_INTERFACE_VERSION"}
def parse_someip(data: bytes) -> dict:
if len(data) < 16:
raise ValueError(f"Too short: {len(data)} bytes")
svc, meth, length, client, session = struct.unpack(">HHIHH", data[:14])
proto_ver, iface_ver, msg_type, ret_code = struct.unpack("BBBB", data[12:16])
payload_len = length - 8 # length field includes 8 bytes after it
return {
"service_id": f"0x{svc:04X}",
"method_id": f"0x{meth:04X}",
"payload_len": payload_len,
"client_id": f"0x{client:04X}",
"session_id": f"0x{session:04X}",
"proto_ver": proto_ver,
"iface_ver": iface_ver,
"msg_type": MSG_TYPE.get(msg_type, f"0x{msg_type:02X}"),
"ret_code": RET_CODE.get(ret_code, f"0x{ret_code:02X}"),
"payload": data[16:16+payload_len]
}
def build_someip_request(svc_id, meth_id, client_id, session_id, payload=b""):
length = 8 + len(payload) # 8 = 4 (client+session) + 4 (metadata)
hdr = struct.pack(">HHIHH", svc_id, meth_id, length, client_id, session_id)
hdr += struct.pack("BBBB", 1, 1, 0x00, 0x00) # proto=1, iface=1, REQ, E_OK
return hdr + payloadSOME/IP Payload Serialisation
// SOME/IP payload serialisation: AUTOSAR SOME/IP Transformer (SomeIpXf)
// All integers big-endian; strings length-prefixed; structs packed
#include
#include
#include
#include
class SomeIpSerializer {
public:
// Append uint8
void push_u8(uint8_t v) { buf_.push_back(v); }
// Append uint16 big-endian
void push_u16(uint16_t v) {
buf_.push_back(static_cast(v >> 8));
buf_.push_back(static_cast(v & 0xFF));
}
// Append uint32 big-endian
void push_u32(uint32_t v) {
for (int i = 3; i >= 0; --i)
buf_.push_back(static_cast((v >> (i*8)) & 0xFF));
}
// Append float32 (IEEE 754, big-endian byte order)
void push_f32(float v) {
uint32_t bits;
std::memcpy(&bits, &v, 4);
push_u32(bits);
}
// Append length-delimited string (4-byte length prefix, UTF-8, no null)
void push_string(const std::string &s) {
push_u32(static_cast(s.size()));
buf_.insert(buf_.end(), s.begin(), s.end());
}
std::vector finish() { return std::move(buf_); }
private:
std::vector buf_;
};
// Example: serialise VehicleStatus struct
struct VehicleStatus {
uint16_t speed_kmh; // 2 bytes
float fuel_level_pct; // 4 bytes (float32)
uint8_t gear; // 1 byte
};
std::vector serialise_vehicle_status(const VehicleStatus &s) {
SomeIpSerializer ser;
ser.push_u16(s.speed_kmh);
ser.push_f32(s.fuel_level_pct);
ser.push_u8(s.gear);
return ser.finish(); // 7 bytes
} Message Types and Session ID Usage
| Message Type | Value | Direction | Session ID |
|---|---|---|---|
| Request | 0x00 | Client → Server | Client-generated; unique per outstanding request; server echoes back |
| RequestNoReturn | 0x01 | Client → Server | Session ID used; server sends no response (fire-and-forget) |
| Notification | 0x02 | Server → Subscribers | Session ID increments per notification cycle; client can detect missed events |
| Response | 0x80 | Server → Client | Same session ID as the Request it responds to |
| Error | 0x81 | Server → Client | Same session ID; non-zero return code; optional error payload |
Summary
SOME/IP is stateless at the protocol level: each request-response pair is matched by session ID, and there is no persistent connection state beyond what TCP maintains. The 16-byte header is fixed — Wireshark decodes it automatically once the UDP port is configured. Payload serialisation is caller-defined and described in the FIBEX/ARXML service interface specification; the AUTOSAR SomeIpXf (transformer) generates serialisation code from this specification automatically. The session ID counter must increment per client per service/method pair — reuse of session IDs causes response mis-matching.
🔬 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
- 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'.
- 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.
- 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.
- 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.