NI-XNET API for LabVIEW and C

XNET Write (Frame FlexRay).vi

  • Updated2023-11-11
  • 6 minute(s) read
 XNET Write (Frame FlexRay).vi

XNET Write (Frame FlexRay).vi

Purpose

Writes data to a session as an array of FlexRay frames. The session must use a FlexRay interface and a mode of Frame Output Queued or Frame Output Single-Point.

Format

Inputs

session in is the session to write. This session is selected from the LabVIEW project or returned from the XNET Create Session VI. The session mode must be Frame Output Queued or Frame Output Single-Point.

Frame Output Stream mode is not supported for FlexRay.
data provides the array of LabVIEW clusters.

Each array element corresponds to a frame value to transmit.

For a Frame Input Single-Point session mode, the order of frames in the array corresponds to the order in the session list.

The data you write is queued up for transmit on the network. Using the default queue configuration for this mode, and assuming frames with 8 bytes of payload, you can safely write 64 frames if you have a sufficiently long timeout. To write more data, refer to the XNET Session Number of Values Unused property to determine the actual amount of queue space available for write.

For an example of how this data applies to network traffic, refer to Frame Output Queued Mode or Frame Output Single-Point Mode.

The elements of each cluster are specific to the FlexRay protocol. For more information, refer to Summary of the FlexRay Standard or the FlexRay protocol specification.

The cluster elements are:
slot specifies the slot number within the FlexRay cycle.
cycle count specifies the cycle number.

The FlexRay cycle count increments from 0 to 63, then rolls over back to 0.
startup? is a Boolean value that specifies whether the frame is a startup frame (true) or not (false).
sync? is a Boolean value that specifies whether the frame is a sync frame (true) or not (false).
preamble? is a Boolean value that specifies the value of the payload preamble indicator in the frame header.

If the frame is in the static segment, preamble? being true indicates the presence of a network management vector at the beginning of the payload. The XNET Cluster FlexRay:Network Management Vector Length property specifies the number of bytes at the beginning.

If the frame is in the dynamic segment, preamble? being true indicates the presence of a message ID at the beginning of the payload. The message ID is always 2 bytes in length.

If preamble? is false, the payload does not contain a network management vector or a message ID.
chA is a Boolean value that specifies whether to transmit the frame on channel A (true) or not (false).
chB is a Boolean value that specifies whether to transmit the frame on channel B (true) or not (false).
echo? is not used for transmit. You must set this element to false.
type is the frame type. type is not used for transmit, so you must leave this element uninitialized. All frame values are assumed to be the FlexRay Data type. Frames of FlexRay Data type contain payload data.

The FlexRay Null type is not transmitted based on this type. As specified in the XNET Frame FlexRay:Timing Type property, the FlexRay null frame is transmitted when a cyclically timed frame does not have new data.
timestamp represents absolute time using the LabVIEW absolute timestamp type. timestamp is not used for transmit. You must set this element to the default value, invalid (0).

The slot and cycle count specify when the frame transmits in FlexRay global time.
payload is the array of data bytes for FlexRay frames of type FlexRay Data.

The array size indicates the payload length of the frame value to transmit. According to the FlexRay protocol, the length range is 0–254.

For PDU output session mode, the payload is the array of data bytes for the specific PDU, not the entire frame.

When the session mode is Frame Output Single-Point, Frame Output Queued, PDU Output Single-Point, or PDU Output Queued, the number of bytes in the payload array must match the Payload Length property of the corresponding frame. You can leave all other FlexRay frame cluster elements uninitialized. For more information, refer to the topic for each mode.
timeout is the time to wait for the FlexRay frame data to be queued up for transmit.

The timeout is a LabVIEW relative time, represented as 64-bit floating-point in units of seconds.

If timeout is positive, the XNET Write (Frame FlexRay) VI waits up to that timeout for space to become available in queues. If the space is not available prior to the timeout, a timeout error is returned.

If timeout is negative, the XNET Write (Frame FlexRay) VI waits indefinitely for space to become available in queues.

If timeout is 0, the XNET Write (Frame FlexRay) VI does not wait and immediately returns with a timeout error if all data cannot be queued. Regardless of the timeout used, if a timeout error occurs, none of the data is queued, so you can attempt to call the XNET Write (Frame FlexRay) VI again at a later time with the same data.

This input is optional. The default value is 10.0 (10 seconds).

If the session mode is Frame Output Single-Point, you must set timeout to 0.0. Because this mode writes the most recent value of each frame, timeout does not apply.
error in is the error cluster input (refer to Error Handling).

Outputs

session out is the same as session in, provided for use with subsequent VIs.
error out is the error cluster output (refer to Error Handling).

Description

The data represents an array of FlexRay frames. Each FlexRay frame uses a LabVIEW cluster with FlexRay-specific elements.

The FlexRay frames are associated to the session's list of frames as follows:

  • Frame Output Queued: Array of frame values to transmit for the single frame specified in the list.
  • Frame Output Single-Point: Array of single frame values, one for each frame specified in the list.
  • PDU Output Queued: Array of frame (PDU payload) values to transmit for the single PDU specified in the list. This mode is similar to Frame Output Queued.
  • PDU Output Single-Point: Array of single frame (PDU payload) values, one for each PDU specified in the list. This mode is similar to a Frame Output Single-Point.

Log in to get a better experience