[CAN Bus] [Classic ECU] [Adaptive SoC]
VehicleSpeed frame ──► Com_ReceiveSignal() GetNewSamples()
(CAN ID 0x201) Gateway_Runnable() ──► SpeedProcessingApp
Serialize → SOME/IP ──► ComputeVolumeAttenuation()
Write IPC shared mem AudioSkeleton::Field::Update()
──► AudioSink subscriberVehicle Function: Speed-Dependent Audio Volume
Classic Side: Full Configuration
/* Classic gateway SWC runnable — called every 5ms */
FUNC(void, GW_CODE) SpeedGateway_Runnable(void)
{
uint16 speedRaw;
Std_ReturnType ret;
/* Read from COM (filled by CanIf on CAN Rx) */
ret = Com_ReceiveSignal(COM_SIG_VEHICLE_SPEED, &speedRaw);
if (ret == E_OK) {
/* Serialize speed to SOME/IP event payload */
SomeIP_SpeedEvent_t evt;
evt.vehicleSpeed = speedRaw; /* uint16, km/h * 100 */
evt.timestamp_ms = GetSystemTime_ms();
evt.valid = 1;
/* Write to IPC region (Classic owns write side) */
HwSemaphore_Acquire(HW_SEM_SPEED);
memcpy(&ipc_speed_event, &evt, sizeof(evt));
ipc_speed_new = 1;
HwSemaphore_Release(HW_SEM_SPEED);
} else if (ret == COM_E_STOPPED || ret == COM_INVALID) {
/* CAN bus failure: signal invalid */
HwSemaphore_Acquire(HW_SEM_SPEED);
ipc_speed_event.valid = 0;
ipc_speed_new = 1;
HwSemaphore_Release(HW_SEM_SPEED);
}
}Adaptive Side: SOME/IP Proxy Subscription
#include "SpeedService_proxy.h"
#include "AudioSkeleton.h"
#include
class SpeedProcessingApp {
std::shared_ptr proxy_;
std::unique_ptr audioSkeleton_;
public:
void Init() {
// Find SpeedService on local IPC transport
auto handles = SpeedService::Proxy::FindService(
ara::com::InstanceIdentifier("SpeedService_IPC_1"));
proxy_ = std::make_shared(handles[0]);
// Subscribe to speed event with 4-sample buffer
proxy_->SpeedEvent.Subscribe(4);
proxy_->SpeedEvent.SetReceiveHandler(
[this]() { OnSpeedEvent(); });
audioSkeleton_ = std::make_unique(
ara::com::InstanceIdentifier("AudioService_1"));
audioSkeleton_->OfferService();
}
void OnSpeedEvent() {
proxy_->SpeedEvent.GetNewSamples([this](auto sample) {
if (sample.GetE2ECheckStatus() ==
ara::com::e2e::ProfileCheckStatus::kOk) {
float speedKph = sample->vehicleSpeed / 100.0f;
// Volume attenuation: reduce by 0.5 dB per km/h above 80
float attenDb = std::max(0.0f, (speedKph - 80.0f) * 0.5f);
audioSkeleton_->VolumeAttenuation.Update(attenDb);
} else {
audioSkeleton_->VolumeAttenuation.Update(0.0f); // safe: no attenuation
}
}, 4);
}
}; Test: CANoe Injection to Adaptive Field Verification
/* Inject VehicleSpeed on CAN and verify Adaptive volume field update */
variables {
message VehicleSpeed_Msg msg;
float expectedAttenDb;
}
on key '1' {
/* Inject 100 km/h: attenuation should be (100-80)*0.5 = 10.0 dB */
msg.VehicleSpeed = 10000; /* raw: 100.00 km/h * 100 */
output(msg);
expectedAttenDb = 10.0;
setTimer(verifyTimer, 100); /* wait 100ms for Adaptive to process */
}
on timer verifyTimer {
/* Read Adaptive Field value via SOME/IP Get request */
/* (sent by CANoe SOME/IP tester module) */
float actualAtten = someip_get_field("AudioService_1", "VolumeAttenuation");
if (abs(actualAtten - expectedAttenDb) < 0.5) {
write("PASS: VolumeAttenuation=%.1f dB (expected %.1f)", actualAtten, expectedAttenDb);
} else {
write("FAIL: VolumeAttenuation=%.1f dB (expected %.1f)", actualAtten, expectedAttenDb);
}
}| Test Case | CAN Injected Speed | Expected Adaptive Volume Attenuation |
|---|---|---|
| Below threshold | 60 km/h (raw: 6000) | 0.0 dB (no attenuation) |
| At threshold | 80 km/h (raw: 8000) | 0.0 dB |
| Above threshold | 100 km/h (raw: 10000) | 10.0 dB |
| Maximum speed | 200 km/h (raw: 20000) | 60.0 dB (effectively muted) |
| CAN bus-off (no signal) | N/A | 0.0 dB (safe default — no attenuation on failure) |
Summary
The speed-dependent audio volume function demonstrates the complete Classic→Adaptive data path: COM signal extraction, IPC shared memory serialization, Adaptive proxy subscription with E2E checking, and Field update to downstream subscribers. The CANoe injection test validates the end-to-end chain including the safety-critical CAN bus-off case — which must apply the safe default (no attenuation) rather than the last-known value.
🔬 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.