CanGetCanFdTiming


Function

Get the CAN FD communication timing settings.

Format

Ret = CanGetCanTiming ( Id , ChannelNo , ArbBitrate , ArbTSeg1 , ArbSJW , ArbTSeg2 , DataBitrate , DataSeg1 , DataSJW , DataSeg2 )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CanInit.

ChannelNo [ VB.NET: UShort ] [ C, C++: unsigned short ] [ C#: ushort ] [ Python: ctypes.c_ushort ]
Specify the channel number.

ArbBitrate [ VB.NET: UInteger ] [ C, C++: unsigned long * ] [ C#: out uint ] [ Python: ctypes.POINTER(ctypes.c_uint) ]
Get the arbitration bitrate. The unit is bps. (bit per second)

ArbTSeg1 [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the arbitration time segment 1. The unit is TQ.

ArbSJW [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the arbitration SJW. The unit is TQ.

ArbTSeg2 [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the arbitration time segment 2. The unit is TQ.

DataBitrate [ VB.NET: UInteger ] [ C, C++: unsigned long * ] [ C#: out uint ] [ Python: ctypes.POINTER(ctypes.c_uint) ]
Get the data bitrate. The unit is bps. (bit per second)

DataTSeg1 [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the data time segment 1. The unit is TQ.

DataSJW [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the data SJW. The unit is TQ.

DataTSeg2 [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the data time segment 2. The unit is TQ.

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

Definition

Value
[Dec]

Description

CAN_ERR_SUCCESS

0

Normality completion

CAN_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute CanResetDevice function because the device has recovered from standby mode.

CAN_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

CAN_ERR_DLL_CALL_DRIVER

10002

Driver can't be called (Failed in the device I/O control).

CAN_ERR_DLL_BUFF_ADDRESS

10100

Invalid data buffer address.

CAN_ERR_SYS_CH_NO

20101

Channel number is outside the settable range

The others (See also: Details of Error Code)

Initial Value

None

Remarks

Get the CAN FD communication timing settings.
It can be used even when connected to CAN bus.

For details, please refer to CAN communication transmission time.

Example

Get ArbBitrate, ArbTSeg1, ArbSJW, ArbTSeg2, DataBitrate, DataTSeg1, DataSJW, DataTSeg2 set to ChannelNo = 1.

VB.NET

Dim Ret As Integer

Dim ArbBitrate As UInteger

Dim ArbTSeg1 As UShort

Dim ArbSJW As UShort

Dim ArbTSeg2 As UShort

Dim DataBitrate As UInteger

Dim DataTSeg1 As UShort

Dim DataSJW As UShort

Dim DataTSeg2 As UShort

Ret = CanGetCanFdTiming ( Id , 1 , ArbBitrate , ArbTSeg1 , ArbSJW , ArbTSeg2 , DataBitrate , DataTSeg1 , DataSJW , DataTSeg2 )
 

C, C++

long Ret;

unsigned long ArbBitrate;

unsigned short ArbTSeg1;

unsigned short ArbSJW;

unsigned short ArbTSeg2;

unsigned long DataBitrate;

unsigned short DataTSeg1;

unsigned short DataSJW;

unsigned short DataTSeg2;
Ret = CanGetCanFdTiming ( Id , 1 , &ArbBitrate , &ArbTSeg1 , &ArbSJW , &ArbTSeg2 , &DataBitrate , &DataTSeg1 , &DataSJW , &DataTSeg2 );
 

C#

int Ret;

ulong ArbBitrate;

ushort ArbTSeg1;

ushort ArbSJW;

ushort ArbTSeg2;

ulong DataBitrate;

ushort DataTSeg1;

ushort DataSJW;

ushort DataTSeg2;
Ret = can.GetCanFdTiming ( Id , 1 , out ArbBitrate , out ArbTSeg1 , out ArbSJW , out ArbTSeg2 , out DataBitrate , out DataTSeg1 , out DataSJW , out DataTSeg2 );
 

Python

Ret = ctypes.c_long()

ArbBitrate = ctypes.ctypes.c_uint()

ArbTSeg1 = ctypes.c_ushort()

ArbSJW = ctypes.c_ushort()

ArbTSeg2 = ctypes.c_ushort()

DataBitrate = ctypes.ctypes.c_uint()

DataTSeg1 = ctypes.c_ushort()

DataSJW = ctypes.c_ushort()

DataTSeg2 = ctypes.c_ushort()

Ret.value = ccan.CanGetCanFdTiming ( Id , 1 , ctypes.byref(ArbBitrate) , ctypes.byref(ArbTSeg1) , ctypes.byref(ArbSJW) , ctypes.byref(ArbTSeg2) , ctypes.byref(DataBitrate) , ctypes.byref(DataTSeg1) , ctypes.byref(DataSJW) , ctypes.byref(DataTSeg2) )

 

See Also

CanSetCanFdTiming