Table Of Contents

XNET Read (State » LIN Comm) (G Dataflow)

    Last Modified: February 22, 2017

    Reads the state of LIN communication using an XNET session.


    session in

    The session to read. This session is selected from the LabVIEW project or returned from XNET Create Session. The session must use a LIN interface.


    error in

    Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

    Default: No error


    session out

    An output that is the same as session in, provided for use with subsequent nodes.


    LIN comm

    An output that returns a LabVIEW cluster containing the communication elements.


    communication state

    A parameter that specifies the LIN interface state. The decimal value is in parentheses:

    Idle (0) This is the LIN interface initial state on power-up. The interface is essentially off, in that it is not attempting to communicate with other nodes (ECUs).

    When the start trigger occurs for the LIN interface, it transitions from the Idle state to the Active state. When the interface stops due to a call to XNET Stop, the LIN interface transitions from either Active or Inactive to the Idle state.

    Active (1) This state reflects normal communication. The LIN interface remains in this state as long as bus activity is detected (frame headers received or transmitted).
    Inactive (2) This state indicates that no bus activity has been detected in the past four seconds.

    Regardless of whether the interface acts as a master or slave, it transitions to this state after four seconds of bus inactivity. As soon as bus activity is detected (break or frame header), the interface transitions to the Active state.

    The LIN interface does not go to sleep automatically when it transitions to Inactive. To place the interface into sleep mode, set the XNET Session Interface:LIN:Sleep property when you detect the Inactive state.



    A parameter that indicates whether the transceiver and communication controller are in their sleep state.False indicates normal operation (awake), and true indicates sleep.

    This Boolean value changes from false to true only when you set the XNET Session Interface:LIN:Sleep property to Remote Sleep or Local Sleep.

    This Boolean value changes from true to false when one of the following occurs:

    • You set the XNET Session Interface:LIN:Sleep property to Remote Wake or Local Wake.
    • The interface receives a remote wakeup pattern (break). In addition to this XNET Read node, you can wait for a remote wakeup event using XNET Wait (LIN Remote Wakeup).

    transceiver ready?

    A parameter that indicates whether the LIN transceiver is powered from the bus. True indicates the bus power exists, so it is safe to start communication on the LIN interface.

    If this value is false, you cannot start communication successfully. Wire power to the LIN transceiver and run your application again.


    last error

    A parameter that specifies the status of the last attempt to receive or transmit a frame. It is an enumeration (ring data type). For a table of all values for last error, refer to the Details tab.


    last received

    A parameter that returns the value received from the network when last error occurred.


    last expected

    A parameter that returns the value that the LIN interface expected to see (instead of last received).


    last identifier

    A parameter that returns the frame identifier in which the last error occurred.



    A parameter that indicates that a fault occurred, and its code is available as fault code.


    fault code

    A parameter that returns a numeric code you can use to obtain a fault description.If fault? is false, the fault code is 0.

    A fault is an error that occurs asynchronously to the NI-XNET nodes your application calls. The fault cause may be related to LIN communication, but it also can be related to XNET hardware, such as a fault in the onboard processor. Although faults are extremely rare, XNET Read (State LIN Comm) provides a detection method distinct from the error out of NI-XNET nodes, yet easy to use alongside the common practice of checking the communication state.

    To obtain a fault description, wire the fault code into the LabVIEW Simple Error Handler error code input and view the resulting message. You also can bundle the fault code into a LabVIEW error cluster as the code element and use front panel features to view the error description.


    schedule index

    A parameter that indicates the LIN schedule that the interface is currently running. This index refers to a LIN schedule that you requested using XNET Write (State LIN Schedule Change). It indexes the array of schedules that are represented in the XNET Session Interface:LIN:Schedules property.

    This index applies only when the LIN interface is running as a master. If the LIN interface is running as a slave only, this element should be ignored.


    error out

    Error information. The node produces this output according to standard error behavior.


    You can use XNET Read (State LIN Comm) with any XNET session mode, as long as the session interface is LIN. Because the state reflects the LIN interface, it can apply to multiple sessions.

    Your application can use XNET Read (State LIN Comm) to check for problems on the LIN network independently from other aspects of your application. For example, you intentionally may introduce noise into the LIN cables to test how your ECU behaves under these conditions. When you do this, you do not want the error out of NI-XNET nodes to return errors, because this may cause your application to stop. Your application can use XNET Read (State LIN Comm) to read the LIN network state quickly as data, so that it does not introduce errors into the flow of your LabVIEW nodes.

    The following table lists each value for last error, along with a description, and applicable use of last received, last expected, and last identifier. In the last error column, the decimal value is shown in parentheses after the string name.

    Last Error Description Last Received Last Expected Last Identifier
    None (0) No bus error has occurred since the previous communication state read. 0 (N/A) 0 (N/A) 0 (N/A)
    Unknown ID (1) Received a frame identifier that is not valid (0–63). 0 (N/A) 0 (N/A) 0 (N/A)
    Form (2) The form of a received frame is incorrect. For example, the database specifies 8 bytes of payload, but you receive only 4 bytes. 0 (N/A) 0 (N/A) Received frame ID
    Framing (3) The byte framing is incorrect (for example, a missing stop bit). 0 (N/A) 0 (N/A) Received frame ID
    Readback (4) The interface transmitted a byte, but the value read back from the transceiver was different. This often is caused by a cabling problem, such as noise. Value read back Value transmitted Received frame ID
    Timeout (5) Receiving the frame took longer than the LIN-specified timeout. 0 (N/A) 0 (N/A) Received frame ID
    Checksum (6) The received checksum was different than the expected checksum. Received checksum Calculated checksum Received frame ID

    If the bus error is detected at time when no frame ID is received (such as wakeup), last identifier uses the special value 64.

    Alternately, to log bus errors, you can set the Interface:Bus Error Frames to Input Stream? property to cause LIN bus errors to be logged as a special frame into a Frame Stream Input queue.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: Supported

    Recently Viewed Topics