LIN Frame Timing and Session Mode
- Updated2023-09-14
- 6 minute(s) read
LIN Frame Timing and Session Mode
This section describes the LIN behavior for each XNET session mode. As context for describing LIN frame transfer on the network, this section uses the timing concepts described in the LIN section of Cyclic and Event Timing.
An input session receives the LIN data frame (payload) from the network, and an output session transmits the LIN data frame. The LIN data frame payload is mapped to/from signal values.
For NI-XNET input sessions, the timing of each LIN schedule entry does not directly impact the representation of data from the appropriate nxRead function.
For NI-XNET output sessions, the timing of each LIN schedule entry determines whether to transmit a data frame when no new payload data is available.
You can configure the NI-XNET LIN interface to run as the LIN master by requesting a schedule ( nxWriteState function). If the NI-XNET LIN interface runs as a LIN slave (default), a remote ECU on the network must execute schedules as LIN master for these modes to operate.
Cyclic
The LIN data frame transmits in a cyclic (periodic) manner.
This implies that the LIN master is running a continuous schedule, and the LIN data frame is contained within an unconditional schedule entry.
If no new payload data is available when it is time to transmit, the payload data from the previous transmit is repeated.
Signal Input Single-Point, Signal
Input Waveform, and Signal Input XY Modes
You specify the signals when you create the session, and a specific LIN data frame contains each signal. When the LIN data frame is received, a subsequent call to the appropriate nxRead function returns its signal data. For information about how the data is represented for each mode, refer to Session Modes.
Frame Input Queued and Frame
Input Single-Point Modes
You specify the LIN frame(s) when you create the session. When the LIN data frame is received, a subsequent call to the appropriate nxRead function returns its data. For information about how the data is represented for each mode, refer to Session Modes.
Frame Input Stream Mode
You specify the LIN cluster when you create the session, but not the specific LIN frames. When any LIN data frame is received, a subsequent call to the appropriate nxRead function returns it.
Signal Output Single-Point,
Signal Output XY, Frame Output Single-Point, and Frame Output Queued Modes
You specify the LIN frame (or its signals) when you create the session. When you write data using the appropriate nxWrite function, the LIN data frame is transmitted onto the network. For information about how the data is represented for each mode, refer to Session Modes.
When the session and its associated interface are started, the LIN data frame transmits according to its schedule entry. Assuming that the LIN frame is contained in only one entry of the continuous schedule, the time between frame transmissions is the same as the time to execute the entire schedule (all entries). After that first transmit, the LIN data frame transmits according to its schedule entry, regardless of whether the appropriate nxWrite function is called. If no new data is available for transmit, the next cycle transmits using the previous LIN data frame (repeats the payload).
Signal Output Waveform Mode
If the NI-XNET interface runs as a LIN master, NI-XNET executes schedules, and therefore controls the timing of LIN frames. When running as a LIN master, this session mode is supported, and NI-XNET resamples the waveform data such that it transmits at the scheduled frame rates.
If the NI-XNET interface runs as a LIN slave (default), this session mode is not supported. When running as a LIN slave, NI-XNET does not know which schedule the LIN master is executing. Because the LIN schedule is not known, the frame transfer rates also are not known, which makes it impossible to resample the waveform data.
Frame Output Stream Mode
This mode is available only when the LIN interface is master. You specify the LIN cluster when you create the session, but not the specific LIN frame.
The stream I/O modes do not use the database-specified timing for frames. Therefore, LIN data frames transmit only when you pass them to the nxWrite function and do not transmit cyclically afterward.
When using a stream output timing of immediate mode, data is transmitted onto the network as soon as possible. Specifically, if the data array is empty, only the header part of the frame is transmitted (with the expectation that a slave transmits the response). If the data array is not empty, the header + response parts of the frame (the full frame) is transmitted. You can use this mode in conjunction with the scheduler, in which case each frame written to stream output is handled as a run-once schedule with lowest priority and having a single one-frame entry. A run-continuous schedule is interrupted to transmit the frame. A run-once schedule is not interrupted, and the frame is transmitted only when there are no pending run-once schedules with higher-than-lowest priority.
When using a stream output timing of either Replay Exclusive or Replay Inclusive, data is transmitted onto the network based on the timestamps in the frame.
Refer to the Interface:Output Stream Timing property for more details about using this mode with LIN.
Event
The LIN data frame transmits in an event-driven manner. The event is the appropriate nxWrite function.
If no new event (payload data) is available when it is time to transmit, no frame transmits. This means that the LIN master transmits the frame header, but no payload data follows this header.
Signal Input Single-Point, Signal
Input Waveform, Signal Input XY, Frame Input Single-Point, Frame Input Queued, and
Frame Input Stream Modes
The behavior is the same as Cyclic.
Signal Output Single-Point,
Signal Output XY, Frame Output Single-Point, and Frame Output Queued Modes
The behavior is similar to Cyclic , except that the LIN data frame does not continue to transmit after the data from the appropriate nxWrite function has transmitted.
If the frame is contained in a sporadic schedule entry, and there are values for multiple frames pending for that entry, NI-XNET selects a single frame to transmit in each entry. NI-XNET selects the frame using the order in the XNET LIN Schedule Entry Frames property. For example, if the Frames property contains three frames, and you write data for the first and third, NI-XNET transmits the first frame (index 0) in the next occurrence of the sporadic entry, and then transmits the third frame (index 2) when that sporadic entry executes again.
If the frame is contained in an event-triggered schedule entry, a collision may occur if another ECU transmits in the same schedule entry. If the NI-XNET LIN interface runs as a LIN master, it automatically uses the XNET LIN Schedule Entry Collision Resolving Schedule property to resolve this collision.
Signal Output Waveform Mode
The behavior is the same as Cyclic.
If the NI-XNET interface runs as a LIN master, NI-XNET executes schedules, and therefore controls the timing of LIN frames. An event-driven LIN frame can transmit at most once per execution of its schedule entry.
If the NI-XNET interface runs as a LIN slave (default), this session mode is not supported.
Frame Output Stream Mode
When using a stream output timing of immediate mode, if the frame for transmit is defined as an event-triggered frame in the database, and a collision occurs during transmit, the interface automatically executes the collision resolving schedule defined for the frame, exactly as if the frame were transmitted in a scheduled event-triggered slot.
When using a stream output timing of either Replay Exclusive or Replay Inclusive, if the frame for transmit is determined to be defined as an event-triggered frame in the database, the frame is transmitted with a header ID equal to the unconditional frame ID contained in data byte 0. The data is transmitted without modification. In other words, the frame is transmitted as an unconditional frame associated with the event-triggered frame.
Refer to the Interface:Output Stream Timing property for more details about using this mode with LIN.
In This Section
- Cyclic
- Signal Input Single-Point, Signal
Input Waveform, and Signal Input XY Modes
- Frame Input Queued and Frame
Input Single-Point Modes
- Frame Input Stream Mode
- Signal Output Single-Point,
Signal Output XY, Frame Output Single-Point, and Frame Output Queued Modes
- Signal Output Waveform Mode
- Frame Output Stream Mode
- Event
- Signal Input Single-Point, Signal
Input Waveform, Signal Input XY, Frame Input Single-Point, Frame Input Queued, and
Frame Input Stream Modes
- Signal Output Single-Point,
Signal Output XY, Frame Output Single-Point, and Frame Output Queued Modes
- Signal Output Waveform Mode
- Frame Output Stream Mode