The LIN Interface (LinIf) manages communication between the LIN bus and the upper-layer modules (Com for signal exchange, LinTp for segmented transfer). It sits on top of the Lin driver and provides schedule-table handling, frame transmission/reception and the hooks needed by LinTp. The configuration is consumed by LinIf.py.
Each entry in networks describes one LIN network:
{
"class": "LinIf",
"networks": [
{
"name": "LIN0",
"me": "AS",
"timeout": 100,
"ldf": "LIN0.ldf"
}
]
}
name - logical network name (user defined);me - name of the local (self) node;timeout - LIN frame timeout in milliseconds;ldf - path to the LIN Description File defining the frames and signals.Com performs signal-based communication over LIN. Its network entry must use the same name and ldf as LinIf:
{
"class": "Com",
"networks": [
{
"name": "LIN0",
"network": "LIN",
"me": "AS",
"ldf": "LIN0.ldf"
}
]
}
The LDF file must be identical in both configurations so that the signal mapping cannot drift; the Com generator converts the LDF to its internal DBC representation automatically (see the Com document).
LinTp segments and reassembles large data over LIN. The configuration depends on the node role.
A LIN slave answers the requests of the master (for example sensor data or read/write DTC access). Configure the slave-side LinTp channel parameters (response timeouts, frame mapping) in LinTp_Cfg.c.
A LIN master typically gateways between LIN and CAN through PduR/CanTp (for example UDS over a CAN-to-LIN gateway). In addition to the local LinTp parameters, configure PduR routes between LinTp and CanTp (see the PduR document).
flowchart TD
subgraph Upper["Upper layers"]
COM[Com - signal based]
DCM[Dcm - diagnostics]
end
subgraph TP["LIN transport and interface"]
LINIF[LinIf]
LINTP[LinTp]
end
LIN[Lin driver - hardware]
COM --> LINIF
DCM --> LINTP
LINIF <--> LINTP
LINIF --> LIN
LINTP --> LIN
flowchart TD
subgraph Upper["Upper layers"]
COM[Com]
PDUR[PduR - CAN/LIN gateway]
end
LINIF[LinIf] <--> LINTP[LinTp]
PDUR <--> CANTP[CanTp]
LINTP <--> PDUR
LIN[Lin driver]
CAN[Can driver]
COM --> LINIF
LINIF --> LIN
CANTP --> CAN
.ldf file must be referenced by LinIf and Com;timeout to the bus speed and slave response time, typical values are 50 to 200 ms;LinIf.py generates LinIf_Cfg.c and LinIf_Cfg.h next to the JSON file.