Skip to content

Latest commit

 

History

History
222 lines (165 loc) · 8.85 KB

File metadata and controls

222 lines (165 loc) · 8.85 KB
layout post
title AUTOSAR SOMEIP and SD
category AUTOSAR
comments true

AUTOSAR SOMEIP/SD Overview

SOME/IP (Scalable service-Oriented MiddlewarE over IP) is an AUTOSAR standard for service-oriented communication in automotive systems, enabling dynamic discovery and invocation of services over IP networks. SOME/IP-SD (Service Discovery) extends SOMEIP to manage service registration, subscription, and discovery between ECUs. This document guides you through setting up, testing, and verifying SOMEIP/SD communication using example applications.


Table of Contents

  1. Key Concepts 1.1 SOMEIP/SD Fundamentals 1.2 Example Applications
  2. Environment Setup and Build Instructions 2.1 Prerequisites 2.2 Build NetApp (Full Stack Example) 2.3 Build NetAppT (SOMEIP/SD-Only Test)
  3. Running the Example Applications 3.1 Launch NetApp and NetAppT 3.2 Key Observations in Logs 3.3 Controlling Service Online/Offline 3.4 Analyzing Network Traffic
  4. Verifying Communication with vsomeip 4.1 Build vsomeip on WSL Ubuntu 20.04 4.2 Run the SSAS Client Example 4.3 Expected Outcome
  5. Troubleshooting Common Issues 5.1 VirtualBox Adapter Not Detected 5.2 LWIP Fails to Initialize 5.3 vsomeip Client Fails to Connect

1. Key Concepts

1.1 SOMEIP/SD Fundamentals

  • Service-Oriented Communication: Services are advertised (published) by servers and discovered (subscribed to) by clients dynamically.
  • Dynamic Addressing: Uses IP multicast for service discovery, avoiding static IP dependencies.
  • Middleware Role: SOMEIP/SD runs on top of TCP/IP, enabling cross-ECU communication over Ethernet.

1.2 Example Applications

The repository includes two primary examples to explore SOMEIP/SD:

  • NetApp: Integrates SOMEIP/SD, DoIP, and CAN stacks for end-to-end automotive communication (built with FreeRTOS + LWIP).
  • NetAppT: A lightweight SOMEIP/SD-only test app (built with OSAL) for isolated protocol validation.

2. Environment Setup and Build Instructions

2.1 Prerequisites

  • VirtualBox: Installed with a stable network adapter (e.g., "Oracle VM VirtualBox Network Adapter").
  • WSL (Windows Subsystem for Linux): For building vsomeip (optional, but recommended for validation).
  • LWIP/FreeRTOS: Preconfigured in the project for NetApp.

2.2 Build NetApp (Full Stack Example)

NetApp combines SOMEIP/SD, DoIP, and CAN stacks. Follow these steps:

# Configure VirtualBox adapter (index 0) with static IPv4: 172.18.0.1
# (Adjust adapter index if yours differs; check via "ipconfig" in Command Prompt)

# Set environment variables for LWIP and PCAP dumping
set PACKET_LIB_ADAPTER_NR=0   # Use VirtualBox adapter
set USE_PCAP=YES              # Enable Wireshark logging

# Build NetApp with FreeRTOS + LWIP
scons --app=NetApp --net=LWIP --os=FreeRTOS

Please note that for the NetApp + FreeRTOS + LWIP setup, it uses Windows PCAP to simulate a virtual network adapter for easy study/development. And I find that the VirtualBox network adapter is the most stable one that works perfectly. So you need to install VirtualBox and then manually configure its IPv4 address to "172.18.0.1", as shown in the image below:

vbox-ip-config

2.3 Build NetAppT (SOMEIP/SD-Only Test)

NetAppT tests core SOMEIP/SD functionality without additional stacks:

# Build NetAppT with OSAL (operates on host Windows sockets)
scons --app=NetAppT --os=OSAL

3. Running the Example Applications

3.1 Launch NetApp and NetAppT

Start both applications in separate terminals to simulate a client-server interaction:

# Launch NetApp (server/client with SOMEIP/SD, DoIP, CAN)
build\nt\GCC\NetApp\NetApp.exe

# Launch NetAppT (SOMEIP/SD-only test client)
build\nt\GCC\NetAppT\NetAppT.exe

3.2 Key Observations in Logs

Upon launching, NetApp outputs logs showing:

  • LWIP initialization with the VirtualBox adapter IP (172.18.0.200).
  • SOMEIP/SD service registration and discovery events.

Example log snippet:

INFO    :application build @ May  3 2022 21:06:24
... ...
TCPIPI  :Starting lwIP, IP 172.18.0.200
 0: NPF_{7C69ADB8-A49E-46AA-AA62-5E367B965EE9}
     Desc: "Oracle"
 1: NPF_{D8E510AC-9490-42A0-AA88-3BE0BD41E52D}
     Desc: "TAP-Windows Adapter V9"
 2: NPF_{8FAE2F35-41DC-4D5D-A2FC-8426852265FF}
     Desc: "Microsoft"
 3: NPF_{8F9E1CE9-4EA7-4354-844F-848EA56AF7EE}
     Desc: "Microsoft"
 4: NPF_{434E0818-480A-450B-A7F1-99F473224151}
     Desc: "Microsoft"
Using adapter_num: 0
Using adapter: "Oracle"

3.3 Controlling Service Online/Offline

Press the s key in NetApp to toggle SOMEIP/SD services:

  • First press: Brings services online (triggers service discovery).
  • Second press: Takes services offline (terminates subscriptions).

3.4 Analyzing Network Traffic

Check net.log (text logs) and wireshark.pcap (packet capture) in the project root for:

  • SOMEIP/SD multicast messages (e.g., SSDP/NOTIFY).
  • TCP/UDP packets for service data exchange.

Wireshark Capture


4. Verifying Communication with vsomeip

To validate cross-platform compatibility and ensure SSAS SOMEIP/SD interoperability, we use vsomeip - the official open-source reference implementation of SOMEIP from the SOME/IP Working Group. This section guides you through building and running a cross-backend test between SSAS SOMEIP and vsomeip.

4.1 Build vsomeip and Test Applications

  1. Build vsomeip libraries:
# Build vsomeip3 core library
scons --lib=vsomeip3 -j8

# Build vsomeip3 configuration library
scons --lib=vsomeip3-cfg --prebuilt -j8

# Build vsomeip3 service discovery library
scons --lib=vsomeip3-sd --prebuilt -j8
  1. Build test applications:
# Build RadarServiceClient with vsomeip backend
set SOMEIP_BACKEND=vsomeip
scons --app=RadarServiceClient --gen

# Build RadarServiceServer with SSAS SOMEIP backend
set SOMEIP_BACKEND=someip
scons --app=RadarServiceServer --net=LWIP --gen

4.2 Run to Verify Communication Between SSAS SOMEIP and vsomeip

  1. Prepare the vsomeip configuration:
# Copy the vsomeip configuration file to the build directory
cp download/vsomeip/examples/ssas/vsomeip.json build/nt/GCC/someip
  1. Start the test applications in separate terminals:

    Terminal 1 (Client - vsomeip backend):

    cd build\nt\GCC\someip 
    ..\RadarServiceClient\RadarServiceClient.exe

    Terminal 2 (Server - SSAS SOMEIP backend):

    build\nt\GCC\RadarServiceServer\RadarServiceServer.exe

4.3 Expected Outcome

When both applications are running:

  1. Service Discovery: The RadarServiceClient (vsomeip) will discover the RadarServiceServer (SSAS SOMEIP) via SOMEIP-SD multicast messages.

  2. Communication Establishment: The client will establish a connection to the server and exchange SOMEIP messages.

  3. Log Verification: Check the console output for:

    • Service discovery success messages
    • Client-server message exchange
    • No connection errors or timeouts
  4. Network Traffic: Use Wireshark to capture and analyze the SOMEIP/SD traffic between the client and server, verifying proper protocol implementation.


5. Troubleshooting Common Issues

5.1 VirtualBox Adapter Not Detected

  • Ensure VirtualBox is installed and the "Oracle VM VirtualBox Network Adapter" is enabled.
  • Manually set its IPv4 address to 172.18.0.1 (via "Settings -> Network & Internet").

5.2 LWIP Fails to Initialize

  • Check PACKET_LIB_ADAPTER_NR matches the correct VirtualBox adapter index (use ipconfig to list adapters).
  • Disable firewall/antivirus temporarily to avoid blocking LWIP traffic.

5.3 vsomeip Client Fails to Connect

  • Verify vsomeip.json is correctly linked and contains valid IP/port configurations.
  • Ensure NetApp is running and services are online (press s in NetApp).