nixnet.session.intf

class nixnet._session.intf.Interface(handle)[source]

Bases: object

Interface configuration for a session

baud_rate

CAN, FlexRay, or LIN interface baud rate.

The default value for this interface property is the same as the cluster’s baud rate in the database. Your application can set this interface baud rate to override the value in the database, or when no database is used.

CAN

When the upper nibble (0xF0000000) is clear, this is a numeric baud rate (for example, 500000).

NI-XNET CAN hardware currently accepts the following numeric baud rates: 33333, 40000, 50000, 62500, 80000, 83333, 100000, 125000, 160000, 200000, 250000, 400000, 500000, 800000, and 1000000.

LIN

When the upper nibble (0xF0000000) is clear, you can set only baud rates within the LIN-specified range (2400 to 20000) for the interface.

Type:int
bus_err_to_in_strm

Bus Error Frames to Input Stream?

Specifies whether the hardware should place a CAN or LIN bus error frame into the Stream Input queue after it is generated.

Type:bool
can_disable_prot_exception_handling

CAN Disable Protocol Exception Handling.

A protocol exception occurs when the CAN hardware detects an invalid combination of bits on the CAN bus reserved for a future protocol expansion. NI-XNET allows you to define how the hardware should behave in case of a protocol exception:

False (default): the CAN hardware stops receiving frames and starts a bus integration.

True: the CAN hardware transmits an error frame when it detects a protocol exception condition.

Type:bool
can_edge_filter

CAN Enable Edge Filter.

When this property is enabled, the CAN hardware requires two consecutive dominant tq for hard synchronization.

Type:bool
can_fd_baud_rate

The fast data baud rate for can_io_mode of nixnet._enums.CanIoMode CAN_FD_BRS

The default value for this interface property is the same as the cluster’s FD baud rate in the database. Your application can set this interface FD baud rate to override the value in the database.

When the upper nibble (0xF0000000) is clear, this is a numeric baud rate (for example, 500000).

NI-XNET CAN hardware currently accepts the following numeric baud rates: 200000, 250000, 400000, 500000, 800000, 1000000, 1250000, 1600000, 2000000, 2500000, 4000000, 5000000, and 8000000.

Note

Not all CAN transceivers are rated to transmit at the requested rate. If you attempt to use a rate that exceeds the transceiver’s qualified rate, XNET Start returns a warning. NI-XNET Hardware Overview describes the CAN transceivers’ limitations.

Type:int
can_fd_iso_mode

CAN FS ISO Mode.

This property is valid only when the interface is in CAN FD(+BRS) mode. It specifies whether the interface is working in the ISO CAN FD standard (ISO standard 11898-1:2015) or non-ISO CAN FD standard (Bosch CAN FD 1.0 specification). Two ports using different standards (ISO CAN FD vs. non-ISO CAN FD) cannot communicate with each other.

When you use a CAN FD database (DBC or FIBEX file created with NI-XNET), you can specify the ISO CAN FD mode when creating an alias name for the database. An alias is created automatically when you open a new database in the NI-XNET Database Editor. The specified ISO CAN FD mode is used as default, which you can change in the session using this property.

Type:nixnet._enums.CanFdIsoMode
can_io_mode

CAN IO Mode.

This property indicates the I/O Mode the interface is using.

The value is initialized from the database cluster when the session is created and cannot be changed later. However, you can transmit standard CAN frames on a CAN FD network.

Type:nixnet._enums.CanIoMode
can_lstn_only

Listen Only? property configures whether the CAN interface transmits any information to the CAN bus.

When this property is false, the interface can transmit CAN frames and acknowledge received CAN frames.

When this property is true, the interface can neither transmit CAN frames nor acknowledge a received CAN frame. The true value enables passive monitoring of network traffic, which can be useful for debugging scenarios when you do not want to interfere with a communicating network cluster.

Type:bool
can_pend_tx_order

Pending Transmit Order

The Pending Transmit Order property configures how the CAN interface manages the internal queue of frames. More than one frame may desire to transmit at the same time. NI-XNET stores the frames in an internal queue and transmits them onto the CAN bus when the bus is idle.

Note

You can modify this property only when the interface is stopped.

Note

Setting this property causes the internal queue to be flushed. If you start a session, queue frames, and then stop the session and change this mode, some frames may be lost. Set this property to the desired value once; do not constantly change modes.

Type:nixnet._enums.CanPendTxOrder
can_sing_shot

Single Shot Transmit?

The Single Shot Transmit? property configures whether the CAN interface retries failed transmissions.

When this property is false, failed transmissions retry as specified by the CAN protocol (ISO 11898-1, 6.11 Automatic Retransmission). If a CAN frame is not transmitted successfully, the interface attempts to retransmit the frame as soon as the bus is idle again. This retransmit process continues until the frame is successfully transmitted.

When this property is true, failed transmissions do not retry. If a CAN frame is not transmitted successfully, no further transmissions are attempted.

Note

You can modify this property only when the interface is stopped.

Note

Setting this property causes the internal queue to be flushed. If you start a session, queue frames, and then stop the session and change this mode, some frames may be lost. Set this property to the desired value once; do not constantly change modes.

Type:bool
can_tcvr_state

CAN Transceiver State.

The Transceiver State property configures the CAN transceiver and CAN controller modes. The transceiver state controls whether the transceiver is asleep or communicating, as well as configuring other special modes.

Type:nixnet._enums.CanTcvrState
can_tcvr_type

CAN Transceiver Type.

For XNET hardware that provides a software-selectable transceiver, the Transceiver Type property allows you to set the transceiver type. Use the XNET Interface CAN.Tranceiver Capability property to determine whether your hardware supports a software-selectable transceiver.

The default value for this property depends on your type of hardware. If you have fixed-personality hardware, the default value is the hardware value. If you have hardware that supports software-selectable transceivers, the default is High-Speed.

Type:nixnet._enums.CanTcvrType
can_term

CAN Termination.

The Termination property configures the onboard termination of the NI-XNET interface CAN connector (port). The enumeration is generic and supports two values: Off and On. However, different CAN hardware has different termination requirements, and the Off and On values have different meanings, see nixnet._enums.CanTerm.

Note

You can modify this property only when the interface is stopped.

Note

This property does not take effect until the interface is started.

Type:nixnet._enums.CanTerm
can_transmit_pause

CAN Transmit Pause.

When this property is enabled, the CAN hardware waits for two bit times before transmitting the next frame. This allows other CAN nodes to transmit lower priority CAN messages while this CAN node is transmitting high-priority CAN messages with high speed.

Type:bool
can_tx_io_mode

CAN Transmit IO Mode

This property specifies the I/O Mode the interface uses when transmitting a CAN frame. By default, it is the same as the XNET Cluster CAN:I/O Mode property. However, even if the interface is in CAN FD+BRS mode, you can force it to transmit frames in the standard CAN format. For this purpose, set this property to CAN.

The Transmit I/O mode may not exceed the mode set by the XNET Cluster CAN:I/O Mode property.

Note

This property is not supported in CAN FD+BRS ISO mode. If you are using ISO CAN FD mode, you define the transmit I/O mode in the database with the I/O Mode property of the frame. (When a database is not used (for example, in frame stream mode), define the transmit I/O mode with the frame type field of the frame data.) Note that ISO CAN FD mode is the default mode for CAN FD in NI-XNET.

Note

This property affects only the transmission of frames. Even if you set the transmit I/O mode to CAN, the interface still can receive frames in FD modes (if the XNET Cluster CAN:I/O Mode property is configured in an FD mode).

Type:nixnet._enums.CanIoMode
echo_tx

Echo Transmit?

Determines whether Frame Input or Signal Input sessions contain frames that the interface transmits.

When this property is true, and a frame transmit is complete for an Output session, the frame is echoed to the Input session. Frame Input sessions can use the Flags field to differentiate frames received from the bus and frames the interface transmits. When reading frames with the nixnet.types.RawFrame, you can parse the Flags field manually by reviewing the Raw Frame Format section. Signal Input sessions cannot differentiate the origin of the incoming data.

Note

Echoed frames are placed into the input sessions only after the frame transmit is complete. If there are bus problems (for example, no listener) such that the frame did not transmit, the frame is not received.

Type:bool
lin_alw_start_wo_bus_pwr

LIN Start Allowed without Bus Power?

Configures whether the LIN interface does not check for bus power present at interface start, or checks and reports an error if bus power is missing.

When this property is true, the LIN interface does not check for bus power present at start, so no error is reported if the interface is started without bus power.

When this property is false, the LIN interface checks for bus power present at start, and an error is reported if the interface is started without bus power.

Note

You can modify this property only when the interface is stopped.

Type:bool
lin_break_length

LIN Break Length

The length of the serial break used at the start of a frame header (schedule entry). The value is specified in bit-times.

The valid range is 10-36 (inclusive). The default value is 13, which is the value the LIN standard specifies.

At baud rates below 9600, the upper limit may be lower than 36 to avoid violating hold times for the bus. For example, at 2400 baud, the valid range is 10-14.

Note

This property is applicable only when the interface is the master.

Type:int
lin_checksum_to_in_strm

LIN Checksum to Input Stream?

Configure the hardware to place the received checksum for each LIN Data frame into the Event ID (Info) field. When False, the Event ID field contains 0 for all LIN Data stream input frames.

Type:bool
lin_diag_p2min

LIN Diag P2min

This is the minimum time in seconds between reception of the last frame of the diagnostic request message and transmission of the response for the first frame in the diagnostic response message by the slave.

Note

This property applies only to the interface as slave.

Type:float
lin_diag_stmin

LIN Diag STmin

master:
The minimum time in seconds the interface places between the end of transmission of a frame in a diagnostic request message and the start of transmission of the next frame in the diagnostic request message.
slave:
The minimum time in seconds the interface places between the end of transmission of a frame in a diagnostic response message and the start of transmission of the response for the next frame in the diagnostic response message.
Type:float
lin_master

LIN Master?

Specifies the NI-XNET LIN interface role on the network: master (true) or slave (false).

In a LIN network (cluster), there always is a single ECU in the system called the master. The master transmits a schedule of frame headers. Each frame header is a remote request for a specific frame ID. For each header, typically a single ECU in the network (slave) responds by transmitting the requested ID payload. The master ECU can respond to a specific header as well, and thus the master can transmit payload data for the slave ECUs to receive.

The default value for this property is false (slave). This means that by default, the interface does not transmit frame headers onto the network. When you use input sessions, you read frames that other ECUs transmit. When you use output sessions, the NI-XNET interface waits for the remote master to send a header for a frame in the output sessions, then the interface responds with data for the requested frame.

If you call the nixnet._session.base.SessionBase.change_lin_schedule function to request execution of a schedule, that implicitly sets this property to true (master). You also can set this property to true using, but no schedule is active by default, so you still must call the nixnet._session.base.SessionBase.change_lin_schedule function at some point to request a specific schedule.

Regardless of this property’s value, you use can input and output sessions. This property specifies which hardware transmits the scheduled frame headers: NI-XNET (true) or a remote master ECU (false).

Type:bool
lin_no_response_to_in_strm

LIN No Response Frames to Input Stream?

Configure the hardware to place a LIN no response frame into the Stream Input queue after it is generated. A no response frame is generated when the hardware detects a header with no response. For more information about the no response frame, see nixnet.types.NoResponseFrame.

Type:bool
lin_ostr_slv_rsp_lst_by_nad

LIN Output Stream Slave Response List By NAD

A list of NADs for use with the replay feature (nixnet._session.intf.Interface.out_strm_timng set to Replay Exclusive or Replay Inclusive).

For LIN, the array of frames to replay might contain multiple slave response frames, each with the same slave response identifier, but each having been transmitted by a different slave (per the NAD value in the data payload). This means that processing slave response frames for replay requires two levels of filtering. First, you can include or exclude the slave response frame or ID for replay using Interface:Output Stream List or Interface:Output Stream List By ID. If you do not include the slave response frame or ID for replay, no slave responses are transmitted. If you do include the slave response frame or ID for replay, you can use the Output Stream Slave Response List by NAD property to filter which slave responses (per the NAD values in the array) are transmitted. This property is always inclusive, regardless of the replay mode (inclusive or exclusive). If the NAD is in the list and the response frame or ID has been enabled for replay, any slave response for that NAD is transmitted. If the NAD is not in the list, no slave response for that NAD is transmitted.

Type:list of int
lin_sched_names

LIN Schedule Names

List of schedules for use when the NI-XNET LIN interface acts as a master (lin_master is true). When the interface is master, you can pass the index of one of these schedules to the nixnet._session.base.SessionBase.change_lin_schedule function to request a schedule change.

This list of schedules is the same as Cluster.lin_schedules used to configure the session.

Type:list of str
lin_term

LIN Termination

The Termination property configures the NI-XNET interface LIN connector (port) onboard termination. The enumeration is generic and supports two values: Off (disabled) and On (enabled).

Per the LIN 2.1 standard, the Master ECU has a ~1 kOhm termination resistor between Vbat and Vbus. Therefore, use this property only if you are using your interface as the master and do not already have external termination.

Note

You can modify this property only when the interface is stopped.

Note

This property does not take effect until the interface is started.

Type:nixnet._enums.LinTerm
out_strm_list

Output Stream List.

The Output Stream List property provides a list of frames for use with the replay feature (out_strm_timng property set to OutStrmTimng REPLAY_EXCLUSIVE or REPLAY_INCLUSIVE). In Replay Exclusive mode, the hardware transmits only frames that do not appear in the list. In Replay Inclusive mode, the hardware transmits only frames that appear in the list. For a LIN interface, the header of each frame written to stream output is transmitted, and the Exclusive or Inclusive mode controls the response transmission. Using these modes, you can either emulate an ECU (Replay Inclusive, where the list contains the frames the ECU transmits) or test an ECU (Replay Exclusive, where the list contains the frames the ECU transmits), or some other combination.

This property’s data type is an array of database handles to frames. If you are not using a database file or prefer to specify the frames using CAN arbitration IDs or LIN unprotected IDs, you can use Interface:Output Stream List By ID instead of this property.

Note

Only CAN and LIN interfaces currently support this property.

out_strm_list_by_id

Output Stream List by Frame Identifier.

Provide a list of frames for use with the replay feature Interface:Output Stream Timing property.

This property serves the same purpose as Interface:Output Stream List, in that it provides a list of frames for replay filtering. This property provides an alternate format for you to specify the frames by their CAN arbitration ID or LIN unprotected ID. The property’s data type is an array of integers. Each integer represents a CAN or LIN frame’s identifier, using the same encoding as nixnet.types.RawFrame.

For CAN Frames, see nixnet.types.CanIdentifier for parsing and generating raw identifiers.

LIN frame ID values may be within the range of possible LIN IDs (0-63).

See also Interface.out_strm_list.

Type:int
out_strm_timng

Output Stream Timing.

The Output Stream Timing property configures how the hardware transmits frames queued using a Frame Output Stream session.

See also Interface.out_strm_list.

Note

Only CAN and LIN interfaces currently support this property.

Type:nixnet._enums.OutStrmTimng
set_can_ext_tcvr_config(value)[source]

Configure XS series CAN hardware to communicate properly with your external transceiver.

Parameters:value (int) – Bitfield
set_lin_sleep(state)[source]

Set LIN Sleep State

Use the Sleep property to change the NI-XNET LIN interface sleep/awake state and optionally to change remote node (ECU) sleep/awake states.

Note

Setting a new value is effectively a request, and the function returns before the request is complete. To detect the current interface sleep/wake state, use nixnet._session.base.SessionBase.lin_comm.

Parameters:state (nixnet._enums.LinSleep) – Desired state.
src_term_start_trigger

Source Terminal Start Trigger

Specifies the name of the internal terminal to use as the interface Start Trigger.

This property is supported for C Series modules in a CompactDAQ chassis. It is not supported for CompactRIO, PXI, or PCI (refer to nixnet._session.base.SessionBase.connect_terminals for those platforms).

The digital trigger signal at this terminal is for the Start Interface transition, to begin communication for all sessions that use the interface. This property routes the start trigger, but not the timebase (used for timestamp of received frames and cyclic transmit of frames). Routing the timebase is not required for CompactDAQ, because all modules in the chassis automatically use a shared timebase.

Use this property to connect the interface Start Trigger to triggers in other modules and/or interfaces. When you read this property, you specify the interface Start Trigger as the source of a connection. When you write this property, you specify the interface Start Trigger as the destination of a connection, and the value you write represents the source.

The connection this property creates is disconnected when you clear (close) all sessions that use the interface.

Type:string
start_trig_to_in_strm

Start Trigger Frames to Input Stream?

Configures the hardware to place a start trigger frame into the Stream Input queue after it is generated. A Start Trigger frame is generated when the interface is started.

The start trigger frame is especially useful if you plan to log and replay CAN data.

Type:bool