DEENESPTFRRUARHIKOZHNL

AUTOSAR Classic LIN

Das LIN-Cluster umfasst Low-Cost-Subbus-Kommunikation für Karosserie- und Komfortfunktionen inklusive Treiber, LinIf-Schedule-Tabellen-Handling, Transceiver-Steuerung und State-Management.

Lin

This function checks if a wakeup has occurred on the addressed LIN channel.

Std_ReturnType Lin_CheckWakeup (uint8 Channel);
Lin_GetStatus function

Service Lin_GetStatus.

Lin_StatusType Lin_GetStatus (uint8 Channel, const uint8* * Lin_SduPtr);

Returns the version information of this module.

void Lin_GetVersionInfo (Std_VersionInfoType* versioninfo);
Lin_GoToSleep function

The service instructs the driver to transmit a go - to - sleep - command on the addressed LIN channel. Only used for LIN master nodes.

Std_ReturnType Lin_GoToSleep (uint8 Channel);

Sets the channel state to LIN_ CH_ SLEEP, enables the wake - up detection and optionally sets the LIN hardware unit to reduced power operation mode (if supported by HW).

Std_ReturnType Lin_GoToSleepInternal (uint8 Channel);
Lin_Init function

Initializes the LIN module.

void Lin_Init (const Lin_ConfigType* Config);
Lin_SendFrame function

Sends a LIN header and a LIN response, if necessary. The direction of the frame response (master response, slave response, slave - to - slave communication) is provided by the Pdu Info Ptr. Only used for LIN master nodes.

Std_ReturnType Lin_SendFrame (uint8 Channel, const Lin_PduType* PduInfoPtr);
Lin_Wakeup function

Generates a wake up pulse and sets the channel state to LIN_ CH_ OPERATIONAL.

Std_ReturnType Lin_Wakeup (uint8 Channel);

Sets the channel state to LIN_ CH_ OPERATIONAL without generating a wake up pulse.

Std_ReturnType Lin_WakeupInternal (uint8 Channel);

This is the type of the external data structure containing the overall initialization data for the LIN driver and the SFR settings affecting the LIN channels. A pointe r to such a structure is provided to the LIN driver initialization routine for configuration of the driver, LIN hardware unit and LIN hardware channels.

This type is used to specify the Checksum model to be used for the LIN Frame.

This type is used to specify the number of SDU data bytes to copy.

Represents all valid protected identifier used by Lin_ Send Frame().

Thi s type is used to specify whether the frame processor is required to transmit the response part of the LIN frame.

This Type is used to provide PID, checksum model, data length and SDU pointer from the LIN Interface to the LIN driver.

This type represents the slave error types that are detected during header reception and response transmission / reception.

LIN operation states for a LIN channel or frame, as returned by the API service Lin_ Get Status().

LinIf

Notifies the change of the response error signal with the new value. Only applicable for LIN slave nodes. AUTOSAR CP R20 - of Document ID : AUTOSAR_ SWS_ LINInterface

void <User_ResponseErrorSignalChanged> (NetworkHandleType Channel, boolean RespErrSigValue);

Indication of a received PDU from a lower layer communication interface module.

void <User_RxIndication> (PduIdType RxPduId, const PduInfoType* PduInfoPtr);

Notifies the reception of a Save Configuration request. Only applicable for LIN slave nodes.

boolean <User_SaveConfigurationRequest> (NetworkHandleType Channel);

Within this API, the upper layer module (called module) shall check whether the available data fits into the b uffer size reported by Pdu Info Ptr - >Sdu Length. If it fits, it shall copy its data into the buffer provided by Pdu Info Ptr - >Sdu Data Ptr and update the length of the actual copied data in Pdu Info Ptr - >Sdu Length. If not, it returns E_ NOT_ OK without ch anging Pdu Info Ptr.

Std_ReturnType <User_TriggerTransmit> (PduIdType TxPduId, PduInfoType* PduInfoPtr);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

void <User_TxConfirmation> (PduIdType TxPduId, Std_ReturnType result);

Will be called when the Ecu M has been notified about a wakeup on a specific LIN channel.

Std_ReturnType LinIf_CheckWakeup (EcuM_WakeupSourceType WakeupSource);

Enables or disables mirroring for a LIN channel.

Std_ReturnType LinIf_EnableBusMirroring (NetworkHandleType Channel, boolean MirroringActive);

Reports the current configured NAD. Only applicable for LIN slave nodes.

Std_ReturnType LinIf_GetConfiguredNAD (NetworkHandleType Channel, uint8* Nad);

Retrieves all assigned PID values. The order is congruent to the LIN frame index. Only applicable for LIN slave nodes.

Std_ReturnType LinIf_GetPIDTable (NetworkHandleType Channel, Lin_FramePidType* PidBuffer, uint8* PidBufferLength);

Returns the actual sta te of a LIN Transceiver Driver.

Std_ReturnType LinIf_GetTrcvMode (NetworkHandleType Channel, LinTrcv_TrcvModeType* TransceiverModePtr);

Returns the reason for the wake up that has been detected by the LIN Transceiver Driver.

Std_ReturnType LinIf_GetTrcvWakeupReason (NetworkHandleType Channel, LinTrcv_TrcvWakeupReasonType* TrcvWuReasonPtr);

Returns the version information of this module.

void LinIf_GetVersionInfo (Std_VersionInfoType* versioninfo);

Initiates a transition into the Sleep Mode on the selected channel.

Std_ReturnType LinIf_GotoSleep (NetworkHandleType Channel);

The LIN Driver will call this function to report a received LIN header. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).

Std_ReturnType LinIf_HeaderIndication (NetworkHandleType Channel, Lin_PduType* PduPtr);
LinIf_Init function

Initializes the LIN Interface.

void LinIf_Init (const LinIf_ConfigType* ConfigPtr);

The LIN Driver will call this function to report a detected error event during header or response processing. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).

void LinIf_LinErrorIndication (NetworkHandleType Channel, Lin_SlaveErrorType ErrorStatus);

The LIN Driver will call this function to report a successfully received response and provides the reception data to the LIN Interface. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).

void LinIf_RxIndication (NetworkHandleType Channel, uint8* Lin_SduPtr);

Requests a schedule table to be executed. Only used for LIN master nodes.

Std_ReturnType LinIf_ScheduleRequest (NetworkHandleType Channel, LinIf_SchHandleType Schedule);

Sets the current configured NAD. Only applicable for LIN slave nodes.

Std_ReturnType LinIf_SetConfiguredNAD (NetworkHandleType Channel, uint8 Nad);

Sets all assigned PID values. The order is congruent to the LIN frame index. Only applicable for LIN slave nodes.

Std_ReturnType LinIf_SetPIDTable (NetworkHandleType Channel, Lin_FramePidType* PidBuffer, uint8 PidBufferLength);

Set the given LIN transceiver to the given mode.

Std_ReturnType LinIf_SetTrcvMode (NetworkHandleType Channel, LinTrcv_TrcvModeType TransceiverMode);

This API enables, disables and cl ears the notification for wakeup events on the addressed network

Std_ReturnType LinIf_SetTrcvWakeupMode (NetworkHandleType Channel, LinTrcv_TrcvWakeupModeType LinTrcvWakeupMode);

Re quests transmission of a PDU.

Std_ReturnType LinIf_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);

The LIN Driver will call this function to report a successfully transmitted response. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).

void LinIf_TxConfirmation (NetworkHandleType Channel);
LinIf_Wakeup function

Initiates the wake up process.

Std_ReturnType LinIf_Wakeup (NetworkHandleType Channel);

The LIN Driver or LIN Transceiver Driver will call this function to report the wake up source after the successful wakeup detection during Check Wakeup or after power on by bus.

void LinIf_WakeupConfirmation (EcuM_WakeupSourceType WakeupSource);

Request to change a specific transport protocol parameter (e.g. block size).

Std_ReturnType LinTp_ChangeParameter (PduIdType id, TPParameterType parameter, uint16 value);

Returns the version information of this module.

void LinTp_GetVersionInfo (Std_VersionInfoType* versioninfo);
LinTp_Init function

Initializes the LIN Transport Layer.

void LinTp_Init (const LinTp_ConfigType* ConfigPtr);

Shutdowns the LIN TP.

void LinTp_Shutdown (void);

Requests transmission of a PDU.

Std_ReturnType LinTp_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);

A pointer to an instance of this structure will be used in the initialization of the LIN Interface. The outline of the structure is defined in chapter 10 Configuration Specification.

Index of the schedule table that is selectable and followed by LIN Interface. Value is unique per LIN c hannel/ controller, but not per ECU. The number of schedule tables is limited to 255

This is the base type for the configuration of the LIN Transport Protocol A pointer to an instance of this structure will be used in the initialization of the LIN Transport Protocol. The outline of the structure is defined in chapter 10 Configuration Specification

This type denotes which Schedule table can be requested by LIN TP during diagnostic session

LinSM

Function to query the current communication mode.

Std_ReturnType LinSM_GetCurrentComMode (NetworkHandleType network, ComM_ModeType* mode);

-

void LinSM_GetVersionInfo (Std_VersionInfoType* versioninfo);

The Lin If will call this callback when the go to sleep command is sent successfully or not sent successfully on the network.

void LinSM_GotoSleepConfirmation (NetworkHandleType network, boolean success);

The Lin If will call this callback when the go to sleep command is received on the network or a bus idle timeout occurs. Only applicable for LIN slave nodes.

void LinSM_GotoSleepIndication (NetworkHandleType Channel);
LinSM_Init function

This function initializes the Lin SM.

void LinSM_Init (const LinSM_ConfigType* ConfigPtr);

Periodic function that runs the timers of different request timeouts

void LinSM_MainFunction (void);

Requesting of a communication mode. The mode switch will not be made instant. The Lin SM will notify the caller when mode transition is made.

Std_ReturnType LinSM_RequestComMode (NetworkHandleType network, ComM_ModeType mode);

The upper layer requests a schedule table to be changed on one LIN network.

Std_ReturnType LinSM_ScheduleRequest (NetworkHandleType network, LinIf_SchHandleType schedule);

The Lin If module will call this callback when the new requested schedule table is active.

void LinSM_ScheduleRequestConfirmation (NetworkHandleType network, LinIf_SchHandleType schedule);

The Lin If will call this callback when the wake up signal command is sent not successfully/ successfully on the network.

void LinSM_WakeupConfirmation (NetworkHandleType network, boolean success);

Data structure type for the post - build configuration parameters.

Type used to report the current mode to the Bsw M

LinTrcv

Service LinTrcv_CheckWakeup.

Std_ReturnType LinTrcv_CheckWakeup (uint8 LinNetwork);

This API provides the reason for the wakeup that the LIN transceiver has detected in the parameter "Reason". The ability to dete ct and differentiate the possible wakeup reasons depends strongly on the LIN transceiver hardware.

Std_ReturnType LinTrcv_GetBusWuReason (uint8 LinNetwork, LinTrcv_TrcvWakeupReasonType* Reason);

API detects the actual software state of LIN transceiver driv er.

Std_ReturnType LinTrcv_GetOpMode (uint8 LinNetwork, LinTrcv_TrcvModeType* OpMode);

This service provides the version information of this module through the parameter "versioninfo".

void LinTrcv_GetVersionInfo (Std_VersionInfoType* versioninfo);
LinTrcv_Init function

Initializes the Lin Transceiver Driver module.

void LinTrcv_Init (const LinTrcv_ConfigType* ConfigPtr);

The internal state of the LIN transceiver driver is switched to mode given in the parameter Op Mode.

Std_ReturnType LinTrcv_SetOpMode (uint8 LinNetwork, LinTrcv_TrcvModeType OpMode);

This API enables, disables and clears the notification for wakeup events on the addressed network. A vailable via Lin Trcv.h

Std_ReturnType LinTrcv_SetWakeupMode (uint8 LINNetwork, LinTrcv_TrcvWakeupModeType TrcvWakupMode);

Configuration data structure of the Lin Trcv module. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_LINTransceiverDriver

Operating modes of the LIN Transceiver Driver

Wake up operating modes of the LIN Transceiver Driver.

This type denotes the wake up reason detected by the LIN transceiver in detail.

Cluster GuideKI-GENERIERT

Ermöglicht die kosteneffiziente Vernetzung von Sensoren und Aktoren über das Local Interconnect Network im Fahrzeug.
KI-GENERIERT ungeprüft Modell: gemini-3.8-flash-medium · Aufwand: medium · Temperatur: nicht steuerbar · Prompt: 01a9cd8d631b Herkunft Offene Fragen (2)
Kausaler Anker: R20-11 Gültig ab R20-11 Neu synthetisiert für diesen Spezifikationsstand.
KI-generiertgemini-3.8-flash-medium · 2026-10-13

Ermöglicht die kosteneffiziente Vernetzung von Sensoren und Aktoren über das Local Interconnect Network im Fahrzeug.

Das Modulcluster LIN Communication realisiert die standardisierte Anbindung von LIN-Subbussystemen über die Module LinSM, LinIf, LinTrcv und Lin (SWS COMManager S. 19). Es steuert die Schedule-basierte Übertragung von Frames bei Mastern sowie die reaktive Header-Auswertung und Datenübermittlung bei Slaves ([SWS_LinIf_91004], [SWS_Lin_00168]). Gleichzeitig koordiniert das Cluster den geordneten Wechsel zwischen Vollkommunikation und Schlafmodus sowie die autonome Fehlerbehandlung über das response_error-Signal ([SWS_LinIf_00763]).

Das Modulcluster LIN Communication stellt die vollständige AUTOSAR-Implementierung des LIN-Protokolls bereit und umfasst den Zustandsmanager LinSM, das Interface LinIf (inklusive Transportprotokoll LinTp), den Transceiver-Treiber LinTrcv sowie den MCAL-Treiber Lin (SWS COMManager S. 19). Es bindet Subnetzwerke, Sensoren und Aktoren an die AUTOSAR-Kommunikationsmatrix an und unterscheidet strikt zwischen Master-Knoten mit autonomer Schedule-Abarbeitung und rein reaktiv antwortenden Slave-Knoten ([SWS_LinIf_00197], [SWS_Lin_00272]).

Architekturdiagramm: Schichtenarchitektur und Schnittstellenbeziehungen des LIN-Clusters zwischen Kommunikationsdiensten, Abstraktionsschicht und MCAL. Quellen: SWS COMManager S. 19, AUTOSAR SWS LINInterface S. 133.

Die Datenübertragung erfolgt auf Master-ECUs durch periodische Ansteuerung des Treibers über Lin_SendFrame und nachfolgende Statusabfrage via Lin_GetStatus ([SWS_Lin_00168]). Am Slave hingegen führt die Erkennung eines Headers im Treiber zum synchronen Callback LinIf_HeaderIndication ([SWS_LinIf_91004]). Das Interface entscheidet anhand der PID über Empfang, Antwort oder Ignorieren und quittiert den Abschluss über LinIf_RxIndication bzw. LinIf_TxConfirmation ([SWS_LinIf_91005], [SWS_LinIf_91006]). Diagnosenachrichten wickelt das integrierte LinTp über automatisierte Umschaltungen der Schedule-Tabelle ab ([SWS_LinIf_00641]).

Im Betriebszyklus koordiniert LinSM die Zustandsübergänge zwischen LINSM_NO_COM und LINSM_FULL_COM ([SWS_LinSM_00026], [SWS_LinSM_00032]). Das Wecken erfolgt per Bus-Puls über Lin_Wakeup ([SWS_Lin_00169]). Der Übergang in den Schlafmodus erfolgt beim Master durch aktives Senden eines Sleep-Frames, beim Slave nach Empfang des Sleep-Befehls oder bei Bus-Idle via LinIf_GotoSleep, Lin_GoToSleepInternal und Transceiver-Schlafsteuerung ([SWS_LinSM_00231], [SWS_LinIf_00757]).

Go-to-Sleep Ablauf auf einem LIN-SlaveComMLinSMLinIfLin DriverLinTrcvBswMLinSM_RequestComMode(COMM_NO_COMMUNICATION)E_OK (Modus vorgemerkt)Use Case: Bus-Sleep Ereignis (Sleep-Frame oder Bus-Idle)LinSM_GotoSleepIndication(Channel)LinIf_GotoSleep(Channel)Lin_GoToSleepInternal(Channel)E_OK (LIN_CH_SLEEP aktiv)optTransceiver Driver konfiguriertLinTrcv_SetOpMode(LINTRCV_TRCV_MODE_SLEEP)E_OKLinSM_GotoSleepConfirmation(Channel, success=TRUE)State = LINSM_NO_COMComM_BusSM_ModeIndication(COMM_NO_COMMUNICATION)BswM_LinSM_CurrentState(LINSM_NO_COM)

Sequenzdiagramm: Zusammenspiel der BSW-Module beim Eintritt eines LIN-Slaves in den Schlafzustand nach Bus-Sleep-Signal. Quellen: [SWS_LinSM_91000], [SWS_LinSM_00231], [SWS_LinIf_00757], AUTOSAR SWS LINStateManager S. 48.

Kommunikationsfehler werden auf Slaves über LinIf_LinErrorIndication erfasst und autonom im response_error-Signal an den Master gemeldet ([SWS_LinIf_91007], [SWS_LinIf_00763]). Kanalübergreifende Synchronisationsbereiche und strikte Trennungen zwischen zyklischen Tasks (LinIf_MainFunction) und Treiber-ISRs sichern die Systemstabilität ([SWS_LinIf_00384]).

Systemarchitektur & Rolle des Modulclusters

Das Modulcluster LIN Communication stellt im AUTOSAR-Classic-Basissoftwarestapel die standardisierte Kommunikation über das Local Interconnect Network (LIN) nach ISO 17987 bereit. Es fungiert primär als kosteneffizientes Subbussystem zur Anbindung von Sensoren und Aktoren im Fahrzeugnetzwerk (AUTOSAR FO Features S. 58). Das Cluster erstreckt sich über mehrere Schichten der AUTOSAR-Architektur: Der LIN State Manager (LinSM) operiert auf der Ebene der Communication Services, das LIN Interface (LinIf) inklusive des integrierten Transportprotokolls (LinTp) bildet die Communication Abstraction, der LIN Transceiver Driver (LinTrcv) ist Teil der ECU Abstraction und der LIN Driver (Lin) residiert als hardwarenahes Modul im Microcontroller Abstraction Layer (MCAL) (SWS COMManager S. 19).

Architektonisch differenziert das Cluster strikt zwischen Master- und Slave-Knoten. Ein LIN-Master steuert über Schedule-Tabellen autark den Busverkehr und generiert alle Header, während LIN-Slaves rein reaktiv auf empfangene Header antworten oder Signale auswerten ([SWS_LinIf_00197], [SWS_Lin_00272]). Für Diagnose- und Transportaufgaben nach ISO 14229 kapselt das LIN Interface die TP-Funktionalität, welche segmentierte Diagnosenachrichten (Master Request Frame MRF und Slave Response Frame SRF) über PduR und DCM abwickelt ([SWS_LinIf_00351], [SWS_LinIf_00629]). Nach außen interagiert das Cluster intensiv mit dem Communication Manager (ComM), dem Basic Software Mode Manager (BswM), dem PDU Router (PduR) und dem ECU State Manager (EcuM) (SWS COMManager S. 19).

Architekturdiagramm: Schichtenarchitektur und Schnittstellenbeziehungen des LIN-Clusters zwischen Kommunikationsdiensten, Abstraktionsschicht und MCAL. Quellen: SWS COMManager S. 19, AUTOSAR SWS LINInterface S. 133.

Zusammenspiel & Interaktionspfade zwischen den Modulen

Die Interaktionspfade im Cluster unterscheiden sich fundamental je nach Knotenrolle. Im LIN-Master initiiert das LIN Interface über seine periodische Task die Abarbeitung der aktiven Schedule-Tabelle. Für fällige Sende-Frames holt LinIf die Nutzdaten über Trigger-Transmit-Mechanismen der oberen Schicht ab und übergibt die Lin_PduType-Struktur an den LIN-Treiber via Lin_SendFrame ([SWS_Lin_00232], SWS LINInterface S. 37). Der Treiber überträgt Header und Daten nicht-blockierend ([SWS_Lin_00027]). Nach Ablauf der maximalen Frame-Laufzeit ermittelt LinIf das Übertragungsergebnis über Lin_GetStatus ([SWS_Lin_00168], SWS LINInterface S. 35). Bei Empfangs-Slots holt LinIf die vom Treiber im Puffer abgelegten Daten ab und leitet sie an die oberen Schichten weiter ([SWS_Lin_00233]).

Auf einem LIN-Slave läuft der Datenpfad ereignisgesteuert ab: Erkennt der MCAL-Treiber Lin auf der Hardware einen gültigen Break-, Synch- und PID-Header, ruft er synchron den Callback LinIf_HeaderIndication auf ([SWS_Lin_00280], [SWS_LinIf_91004]). Das Interface prüft den geschützten Bezeichner (PID) anhand der internen PID-Tabelle ([SWS_LinIf_00816], [SWS_LinIf_00823]). Handelt es sich um einen Sende-Frame, holt LinIf die Nutzdaten ab, konfiguriert den Response-Typ auf LIN_FRAMERESPONSE_TX und stellt die Daten dem Treiber im Puffer bereit ([SWS_Lin_00230]). Ist der Frame als Empfang konfiguriert, meldet der Treiber nach vollständigem Byte-Empfang den Erfolg via LinIf_RxIndication ([SWS_LinIf_91005]), woraufhin LinIf die Daten an den PDU-Router weiterreicht. Bestätigungen gesendeter Slave-Responses erfolgen über LinIf_TxConfirmation ([SWS_LinIf_91006]).

Über das LIN-Interface wird zudem die Transceiver-Steuerung transparent gekapselt: Modusanforderungen wie LinIf_SetTrcvMode leitet das Interface synchron an LinTrcv_SetOpMode weiter ([SWS_LinIf_00544], [SWS_LinTrcv_00002]). Bei Transportprotokoll-Transaktionen steuert LinTp über BswM_LinTp_RequestMode die gezielte Umschaltung der Schedule-Tabelle des Masters zwischen Applikationsmodus (LINTP_APPLICATIVE_SCHEDULE), Diagnoseanforderung (LINTP_DIAG_REQUEST) und Diagnoseantwort (LINTP_DIAG_RESPONSE) ([SWS_LinIf_00641], [SWS_LinIf_00642], [SWS_LinIf_00643]).

LIN-Slave Frame-Verarbeitung (Rx / Tx)LinController UARTLin DriverLinIfPduR LSduRInterrupt (Header empfangen)LinIf_HeaderIndication(Channel, PduPtr)EvaluatePID(PduPtr->Pid)altResponse ist Sendedaten (TX)LSduR_LinIfTriggerTransmit(PduInfoPtr)E_OK (Sendedaten bereitgestellt)PduPtr->Drc = LIN_FRAMERESPONSE_TXE_OK (PduPtr konfiguriert)Transmit Response BytesInterrupt (Tx Complete)LinIf_TxConfirmation(Channel)Response ist Empfangsdaten (RX)PduPtr->Drc = LIN_FRAMERESPONSE_RXE_OK (Bereit für Empfang)Interrupt (Rx Complete)LinIf_RxIndication(Channel, SduPtr)LSduR_LinIfRxIndication(Channel, PduInfoPtr)

Sequenzdiagramm: Dynamischer Steuer- und Datenfluss bei Header-Indikation, Sende-Triggerung und Empfangsquittierung an einem LIN-Slave. Quellen: [SWS_Lin_00280], [SWS_LinIf_91004], [SWS_LinIf_91005], AUTOSAR SWS LINInterface S. 133.

Synchronisation, Reentranz und Task-Kontexte

Die Ausführung innerhalb des Modulclusters ist auf zyklische Task-Kontexte und hardwarenahe Interrupt-Ebenen aufgeteilt. Kern der zyklischen Ablaufsteuerung im LIN Interface ist die geplante Funktion LinIf_MainFunction_<LinIfChannel.ShortName>, welche zwingend für jeden konfigurierten LIN-Kanal separat instanziiert wird ([SWS_LinIf_00384], [SWS_LinIf_00725]). Sie übernimmt das Weiterschalten der Schedule-Slots, die Statusabfragen beim Treiber und das Timeout-Handling des Transportprotokolls ([SWS_LinIf_00800], SWS LINInterface S. 119). Parallel dazu verwaltet LinSM_MainFunction die Countdown- und Bestätigungs-Timer für asynchrone Kanal- und Wakeup-Anforderungen ([SWS_LinSM_00162], [SWS_LinSM_00159]).

Im Gegensatz zur Task-Ebene laufen die Treiber-Routinen des MCAL-Moduls Lin bei Vorhandensein eines Interrupt-gesteuerten Controllers oder einer UART-Schnittstelle im Interrupt-Kontext (ISR) ab (AUTOSAR CP SWS LINDriver S. 53). Die Callbacks LinIf_HeaderIndication, LinIf_RxIndication und LinIf_TxConfirmation werden direkt aus diesem ISR-Kontext heraus synchron ausgelöst ([SWS_Lin_00280], [SWS_LinIf_91005], [SWS_LinIf_91006]). Dies erfordert eine strikte Absicherung kritischer Bereiche (Exclusive Areas) im LIN Interface: Steueraufrufe wie LinIf_Transmit, LinIf_GotoSleep, LinIf_ScheduleRequest oder LinIf_Wakeup dürfen interne Kanalstrukturen nur geschützt gegen parallele Zugriffe aus der LinIf_MainFunction oder ISR-Callbacks modifizieren (SWS LINInterface S. 119).

Hinsichtlich der Reentranz sind die API-Funktionen der Module LinIf und LinSM überwiegend reentrant für unterschiedliche Kanäle bzw. Netzwerke, jedoch nicht-reentrant für denselben Kanal konzipiert ([SWS_LinSM_00126], [SWS_LinIf_00201], [SWS_LinIf_00204]). Ebenso verhalten sich die Treiberdienste in Lin (z. B. Lin_Wakeup, Lin_GoToSleepInternal), die strikt pro physikalischem Kanal synchronisiert werden müssen ([SWS_Lin_00167], [SWS_Lin_00169]). Bei einfacher UART-Hardware ohne Mehrbyte-FIFO puffert der LIN-Treiber Bytes temporär in Software ([SWS_Lin_00026]), was Interpretation: bei hoher Buslast zu gesteigertem CPU-Interruptaufkommen auf Slave-Knoten führen dürfte. Frage Q-0d07d89d1ade6a01 (offen)

Typische Lebenszyklen und Betriebsmodi

Während des Systemstarts initialisiert der BswM die BSW-Module in einer vorgegebenen Kette: Zuerst werden die Basistreiber Lin_Init und LinTrcv_Init initialisiert, gefolgt von LinIf_Init, LinTp_Init und abschließend LinSM_Init (ModemanagementGuide S. 54). LinIf_Init setzt den Schedule aller Master-Kanäle standardmäßig auf NULL_SCHEDULE ([SWS_LinIf_00233]) und lädt bei Slaves die vorkonfigurierten NAD- und PID-Tabellen ([SWS_LinIf_00767], [SWS_LinIf_00768]). LinSM startet im Zustand LINSM_NO_COM, ohne bei der Initialisierung Callbacks an ComM oder BswM abzusetzen ([SWS_LinSM_00026], [SWS_LinSM_00166]).

Fordert der ComM über LinSM_RequestComMode(COMM_FULL_COMMUNICATION) die Kommunikationsfreigabe an, stößt LinSM direkt LinIf_Wakeup an und startet einen Überwachungs-Timer ([SWS_LinSM_00047], [SWS_LinSM_00100]). LinIf sendet über Lin_Wakeup den physischen Wakeup-Puls auf den Bus ([SWS_LinIf_00205], [SWS_Lin_00043]). Meldet LinIf den erfolgreichen Aufwachvorgang via LinSM_WakeupConfirmation(success=TRUE), wechselt der Zustand zu LINSM_FULL_COM ([SWS_LinSM_00049], [SWS_LinSM_00132]). Dies wird ComM via ComM_BusSM_ModeIndication und BswM via BswM_LinSM_CurrentState signalisiert ([SWS_LinSM_00033], [SWS_LinSM_00192]). Bei Slaves gilt der Bus erst als erfolgreich aufgewacht, wenn der Master den ersten LIN-Header sendet und dieser empfangen wird ([SWS_LinIf_00761], SWS LINStateManager S. 28).

Das Herunterfahren in den Schlafmodus (Go-to-Sleep) unterscheidet sich gravierend: Auf einem Master führt die Anforderung COMM_NO_COMMUNICATION zum Aufruf von LinIf_GotoSleep ([SWS_LinSM_00036], [SWS_LinSM_10208]). LinIf beauftragt den Treiber über Lin_GoToSleep, einen standardisierten Go-to-Sleep-Frame auf dem Bus zu senden ([SWS_Lin_00166], [SWS_Lin_00089]). Auf einem Slave hingegen empfängt das Interface den Go-to-Sleep-Befehl oder erkennt einen Bus-Idle-Timeout und informiert LinSM via LinSM_GotoSleepIndication ([SWS_LinSM_91000]). LinSM ruft daraufhin synchron LinIf_GotoSleep auf ([SWS_LinSM_00231]). Das Interface schaltet den Treiber über Lin_GoToSleepInternal lokal in den Zustand LIN_CH_SLEEP ([SWS_LinIf_00757], [SWS_Lin_00095]) und versetzt den Transceiver via LinIf_SetTrcvMode(LINTRCV_TRCV_MODE_SLEEP) in den Schlafzustand ([SWS_LinIf_00544], AUTOSAR CP SWS LINInterface S. 137). Nach der Bestätigung LinSM_GotoSleepConfirmation wechselt LinSM final zu LINSM_NO_COM ([SWS_LinSM_00046], [SWS_LinSM_00233]).

Go-to-Sleep Ablauf auf einem LIN-SlaveComMLinSMLinIfLin DriverLinTrcvBswMLinSM_RequestComMode(COMM_NO_COMMUNICATION)E_OK (Modus vorgemerkt)Use Case: Bus-Sleep Ereignis (Sleep-Frame oder Bus-Idle)LinSM_GotoSleepIndication(Channel)LinIf_GotoSleep(Channel)Lin_GoToSleepInternal(Channel)E_OK (LIN_CH_SLEEP aktiv)optTransceiver Driver konfiguriertLinTrcv_SetOpMode(LINTRCV_TRCV_MODE_SLEEP)E_OKLinSM_GotoSleepConfirmation(Channel, success=TRUE)State = LINSM_NO_COMComM_BusSM_ModeIndication(COMM_NO_COMMUNICATION)BswM_LinSM_CurrentState(LINSM_NO_COM)

Sequenzdiagramm: Zusammenspiel der BSW-Module beim Eintritt eines LIN-Slaves in den Schlafzustand nach Bus-Sleep-Signal. Quellen: [SWS_LinSM_91000], [SWS_LinSM_00231], [SWS_LinIf_00757], AUTOSAR SWS LINStateManager S. 48.

Fehlerbehandlung, DET-Tracing und Degradation

Das Cluster besitzt ein mehrstufiges Fehlererkennungs- und Diagnosekonzept. Entwicklungsfehler werden über den Default Error Tracer (Det) erfasst: Ungültige Kanal- oder Netzwerkparameter melden LIN_E_INVALID_CHANNEL ([SWS_Lin_00259]), LINIF_E_NONEXISTENT_CHANNEL ([SWS_LinIf_00539]) bzw. LINSM_E_NONEXISTENT_NETWORK ([SWS_LinSM_00127]). Aufrufe uninitialisierter Module ziehen LIN_E_UNINIT, LINIF_E_UNINIT oder LINSM_E_UNINIT nach sich ([SWS_Lin_00258], [SWS_LinSM_00128]). Transceiver-Fehler wie ungültige Netzwerknummern melden LINTRCV_E_INVALID_LIN_NETWORK an DET ([SWS_LinTrcv_00145]).

Im laufenden Betrieb auftretende Kommunikationsstörungen werden als Laufzeitfehler klassifiziert: Das Interface definiert LINIF_E_RESPONSE bei fehlerhaften Frames sowie LINIF_E_NC_NO_RESPONSE bei fehlenden Antworten auf Node-Configuration-Requests ([SWS_LinIf_00729]). Physische Bus- und Protokollfehler (Framing-Fehler, Checksummen-Fehler, Bit-Monitoring-Fehler) meldet der MCAL-Treiber am Slave über LinIf_LinErrorIndication mit dem Status Lin_SlaveErrorType ([SWS_LinIf_91007], [SWS_Lin_91140]). Auf Master-Knoten liefert Lin_GetStatus detaillierte Fehlercodes wie LIN_TX_HEADER_ERROR, LIN_TX_ERROR oder LIN_RX_ERROR an das Interface ([SWS_Lin_00168], [SWS_Lin_00233]).

Ein zentraler Fehlermechanismus für LIN-Slaves ist das standardisierte response_error-Signal. Das LIN-Interface verwaltet dieses 1-Bit-Signal autonom: Tritt ein Übertragungsfehler auf, setzt LinIf das Bit, welches im nächsten unkonditionierten Sende-Frame an den Master übertragen wird ([SWS_LinIf_00763], SWS LINInterface S. 58). Nach erfolgreicher Frame-Übertragung löscht LinIf das Flag selbsttätig ([SWS_LinIf_00747]). Im Diagnosekanal überwacht LinTp strikte Protokollzeitfenster: Bei Ausbleiben von N-PDUs brechen die Timer $N_{As}$ und $N_{Cr}$ die Transaktion definiert ab und melden E_NOT_OK an den PDU-Router ([SWS_LinIf_00799], [SWS_LinIf_00804], [SWS_LinIf_00806]). Fehlt am PDU-Router Pufferkapazität, bricht das Interface die Aufnahme ab und schaltet die Schedule-Tabelle des Masters zurück auf Applikationsbetrieb ([SWS_LinIf_00676], [SWS_LinIf_00792]).

Dieser Leitfaden basiert auf den AUTOSAR-Spezifikationen für Release R20-11 der Module Lin, LinIf, LinSM und LinTrcv. Alle Normbelege stammen aus den referenzierten Dokumenten und Requirement-Einträgen.

Module im Cluster

LIN Driver (Lin)

Controls hardware LIN controllers on the ECU.

BSW ID 82 17 APIs (9 Funktionen, 8 Typen) #include "Lin.h"

LIN Interface (LinIf)

Abstracts LIN hardware and manages schedule tables and frame transmission.

BSW ID 62 35 APIs (31 Funktionen, 4 Typen) #include "LinIf.h"

LIN Network Management (LinNm)

AUTOSAR Classic Communication Services-Modul LIN Network Management (LinNm, Spezifikation: AUTOSAR_SWS_LINNetworkManagement.pdf).

BSW ID 63 Keine C-API · 0 Records #include "LinNm.h"

LIN State Manager (LinSM)

Manages state transitions of LIN networks.

BSW ID 141 12 APIs (10 Funktionen, 2 Typen) #include "LinSM.h"

LIN Transceiver Driver (LinTrcv)

Controls physical bus transceiver states and wakeup on LIN lines.

BSW ID 64 11 APIs (7 Funktionen, 4 Typen) #include "LinTrcv.h"