Reads the state of LIN communication using an XNET session.


icon

Inputs/Outputs

  • cgenclassrntag.png session in

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

  • cerrcodeclst.png error in (no error)

    The error in cluster can accept error information wired from VIs previously called. Use this information to decide if any functionality should be bypassed in the event of errors from other VIs. The pop-up option Explain Error (or Explain Warning) gives more information about the error displayed.

  • igenclassrntag.png session out

    session out is the same as session in, provided for use with subsequent VIs.

  • icclst.png LIN comm

    LIN comm returns a LabVIEW cluster containing the communication elements. The elements are:

  • ii32.png fault code

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

  • ibool.png fault?

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

  • iu8.png communication state

    communication state specifies the LIN interface state (decimal value in parentheses):

  • iu8.png last error

    last error 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 Description section.

  • iu8.png last error received

    last error 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 Description section.

  • iu8.png last error expected

    last error 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 Description section.

  • iu8.png last error identifier

    last error 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 Description section.

  • ibool.png sleep?

    sleep? 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 VI, you can wait for a remote wakeup event using the XNET Wait (LIN Remote Wakeup) VI.
  • ibool.png transceiver ready?

    transceiver ready? 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.

  • iu8.png schedule index

    schedule index indicates the LIN schedule that the interface is currently running. This index refers to a LIN schedule that you requested using the XNET Write (State LIN Schedule Change) VI. 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.

  • ierrcodeclst.png error out

    The error out cluster passes error or warning information out of a VI to be used by other VIs. The pop-up option Explain Error (or Explain Warning) gives more information about the error displayed.

  • Description

    You can use the XNET Read (State LIN Comm) VI 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 the XNET Read (State LIN Comm) VI 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 VIs to return errors, because this may cause your application to stop. Your application can use the XNET Read (State LIN Comm) VI to read the LIN network state quickly as data, so that it does not introduce errors into the flow of your LabVIEW VIs.

    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 (refer to Special Frames for more information) into a Frame Stream Input queue.