Using LIN
- Updated2023-09-14
- 2 minute(s) read
Using LIN
This section summarizes some useful NI-XNET features specific to the LIN protocol.
Changing the LIN Schedule
LIN networks (clusters) always include a single ECU in the system called the master. The master transmits a schedule of frame headers. Each frame header is a remote request for a specific frame ID. For each header, a single ECU in the network (slave) responds by transmitting the payload for the requested ID. The master ECU also can respond to a specific header, and thus the master can transmit payload data for the slave ECUs to receive.
Unlike some other scheduled protocols such as FlexRay, LIN allows the master ECU to change the schedule of frame headers. For example, the master can initially use a "normal" schedule that requests IDs 1, 2, 3, 4, and then the master can change to a "diagnostic" schedule that requests IDs 60 and 61.
With NI-XNET, you change the LIN schedule using the XNET Write (State LIN Schedule Change) VI. When you want the NI-XNET interface to act as a master on the network, you must call this XNET Write VI at least once, to specify the schedule to run. When you write a schedule change, this automatically configures NI-XNET as master (the XNET Session Interface:LIN:Master? property is set to true). As a LIN master, NI-XNET handles all real-time scheduling of frame headers for you, using the LIN interface hardware onboard processor.
If you do not write a schedule change, NI-XNET leaves the interface at its default configuration of slave. As a LIN slave, you still can write signal or frame values to an output session, but NI-XNET waits for each frame's header to arrive before transmitting payload data.
Understanding LIN Frame Timing
Because LIN is a scheduled network, the headers that the master transmits determine the timing of all frames. To understand how and when each frame transmits, you must examine the entries in each schedule. Each entry transfers one frame (or possibly multiple frames). For more information, refer to the XNET LIN Schedule Entry Type property.
Because it is possible to use a single frame in multiple schedules and schedule entries, the overall timing for an individual frame can be complex. Nevertheless, each LIN schedule entry generally fits the concepts of cyclic and event timing that are common for other protocols such as CAN and FlexRay. For more information about how these concepts apply to LIN, refer to Cyclic and Event Timing.
LIN Diagnostics
Refer to the XNET Write (State LIN Diagnostic Schedule Change) VI for details.
Special Considerations for Using Stream
Output Mode with LIN
Refer to the Interface:Output Stream Timing property for details.