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

LIN Diagnostic Frames: PID 0x3C / 0x3D

LIN Diagnostic Session Flow
  Master                          Slave (NAD=0x01)
  ─────────────────────────────────────────────────
  Schedule switches to Diagnostic_Schedule

  Sends PID 0x7F (0x3C) header
  Sends MasterReq data:
    NAD=0x01, PCI=0x06(SF,len=6),
    SID=0x22, DID_H=0xF1, DID_L=0x90   ─────────► Slave recognises NAD=0x01
  (ReadByIdentifier DID 0xF190 = VIN)             Processes SID 0x22
                                                    Prepares response
  Sends PID 0x7E (0x3D) header     ◄──────────────  Slave sends SlaveResp:
  Receives slave response:                            NAD=0x01, PCI=0x06,
    NAD=0x01, PCI=0x06(SF,len=6),                    SID=0x62, data[0-5]
    SID=0x62, VIN bytes 1-6

Node Configuration Services (LIN 2.x)

CAPLlin_assign_nad.can
/* CAPL: LIN Node Configuration — AssignNAD */
/* Change slave from initial NAD 0x7F to assigned NAD 0x01 */

variables {
    linFrame MasterReq_0x3C req;
}

on start {
    /* SID 0xB0 = AssignNAD */
    /* Supplier ID = 0x0005, Function ID = 0x0001, New NAD = 0x01 */
    req.nad         = 0x7F;   /* Initial NAD (broadcast) */
    req.pci_type    = 0x06;   /* Single Frame, length 6 */
    req.sid         = 0xB0;   /* AssignNAD service */
    req.data[0]     = 0x05;   /* Supplier ID low byte */
    req.data[1]     = 0x00;   /* Supplier ID high byte */
    req.data[2]     = 0x01;   /* Function ID low byte */
    req.data[3]     = 0x00;   /* Function ID high byte */
    req.data[4]     = 0x01;   /* New NAD */
    req.data[5]     = 0xFF;   /* Unused */
    linMasterRequest(req);
    write("Sent AssignNAD: 0x7F → 0x01");
}
NC ServiceSIDPurpose
AssignNAD0xB0Change slave NAD from initial (0x7F) to production address
AssignFrameIdentifierRange0xB3Map up to 4 frame IDs to slave's PID slots
DataDump0xB4Read/write slave EEPROM (vendor-specific payload)
ReadByIdentifier0xB2Read Supplier ID, Function ID, Variant — verify slave identity
ConditionalChangeNAD0xB3 (alt)Change NAD only if Supplier + Function IDs match — avoids wrong-slave addressing

AUTOSAR LINTp: Multi-Frame Diagnostic over LIN

LINTp Frame TypePCI ByteMax DataUsed For
Single Frame0x0N (N=length 1-6)6 bytesShort UDS requests/responses (fit in one LIN response)
First Frame0x1N + length byte254 bytes totalMulti-frame UDS (ReadMemoryByAddress with large response)
Consecutive Frame0x2N (N=SN 1–14)6 bytes per CFSubsequent segments
Flow Control0x30 (CTS)Receiver sends in MasterReq slot to continue multi-frame

Factory EOL Commissioning Sequence

Pythoneol_lin_commissioning.py
#!/usr/bin/env python3
# Factory EOL: commission all LIN slaves on body bus
import lin_api, time

master = lin_api.LINMaster(channel=1, baud=19200)

SLAVES = [
    {"name": "Window_FL", "supplier": 0x0005, "function": 0x0001, "assigned_nad": 0x01},
    {"name": "Window_FR", "supplier": 0x0005, "function": 0x0002, "assigned_nad": 0x02},
    {"name": "Mirror_L",  "supplier": 0x0006, "function": 0x0001, "assigned_nad": 0x03},
]

for slave in SLAVES:
    print(f"Commissioning {slave['name']}...")

    # 1. AssignNAD: initial 0x7F → assigned NAD
    master.assign_nad(
        initial_nad=0x7F,
        supplier_id=slave["supplier"],
        function_id=slave["function"],
        new_nad=slave["assigned_nad"]
    )
    time.sleep(0.05)

    # 2. Verify: ReadByIdentifier (SID 0x00) returns correct Supplier+Function
    response = master.read_by_identifier(nad=slave["assigned_nad"], identifier=0x00)
    assert response["supplier_id"] == slave["supplier"], "Supplier ID mismatch!"
    assert response["function_id"] == slave["function"], "Function ID mismatch!"
    print(f"  PASS: {slave['name']} at NAD=0x{slave['assigned_nad']:02X}")

print("EOL commissioning complete")

Summary

LIN diagnostics use two dedicated PIDs (0x3C master request, 0x3D slave response) to carry UDS services over a single-byte PCI transport layer. Node Configuration services allow factory commissioning to assign NADs, map frame IDs, and verify slave identity. EOL commissioning must verify each slave responds correctly at its assigned NAD before the vehicle is released — failure indicates wrong slave, EEPROM fault, or harness error.

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

← PreviousLIN Frame Structure & Schedule TablesNext →LIN Description Files (LDF)