Reads the state of CAN 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.

  • 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 CAN comm

    CAN 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 CAN interface state with respect to error confinement (decimal value in parentheses):

  • iu8.png last error

    last error specifies the status of the last attempt to receive or transmit a frame (decimal value in parentheses):

  • iu8.png receive error counter

  • iu8.png transmit error counter

  • ibool.png transceiver error?

    transceiver error? indicates whether an error condition exists on the physical transceiver. This is typically referred to as the transceiver chip NERR pin. False indicates normal operation (no error), and true indicates an error.

  • 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.

  • 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 CAN Comm) VI with any XNET session mode, as long as the session interface is CAN. Because the state reflects the CAN interface, it can apply to multiple sessions.

    Your application can use the XNET Read (State CAN Comm) VI to check for problems on the CAN network independently from other aspects of your application. For example, you intentionally may introduce noise into the CAN 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 CAN Comm) VI to read the CAN network state quickly as data, so that it does not introduce errors into the flow of your LabVIEW VIs.

    Alternately, to log bus errors, you can set the Interface:Bus Error Frames to Input Stream? property to cause CAN bus errors to be logged as a special frame (refer to Special Frames for more information) into a Frame Stream Input queue.