Get the CAN FD communication timing settings.
Ret = CanGetCanFdTiming ( Id , ChannelNo , ArbBitrate , ArbTSeg1 , ArbSJW , ArbTSeg2 , DataBitrate , DataSeg1 , DataSJW , DataSeg2 )
Id
[ C: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CanInit.
ChannelNo
[ C: unsigned short ] [ Python: ctypes.c_ushort ]
Specify the channel number.
ArbBitrate
[ C: unsigned int * ] [ Python: ctypes.POINTER(ctypes.c_uint) ]
Get the arbitration bitrate. The unit is bps. (bit per second)
ArbTSeg1 [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the arbitration time segment 1. The unit is TQ.
ArbSJW [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the arbitration SJW. The unit is TQ.
ArbTSeg2 [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the arbitration time segment 2. The unit is TQ.
DataBitrate
[ C: unsigned int * ] [ Python: ctypes.POINTER(ctypes.c_uint) ]
Get the data bitrate. The unit is bps. (bit per second)
DataTSeg1 [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the data time segment 1. The unit is TQ.
DataSJW [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the data SJW. The unit is TQ.
DataTSeg2 [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the data time segment 2. The unit is TQ.
Ret [ C: long ] [ Python: ctypes.c_long ]
Definition |
Value |
Description |
CAN_ERR_SUCCESS |
0 |
Normality completion |
CAN_ERR_DLL_INVALID_ID |
10001 |
Invalid ID specified. |
CAN_ERR_DLL_CALL_DRIVER |
10002 |
Driver can't be called (Failed in the ioctl). |
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)
None
Get the CAN FD communication timing settings.
It can be used even when connected to CAN bus.
For details, please refer to Difference between CAN 2.0B Communication and CAN FD Communication
and CAN communication transmission time.
Get ArbBitrate, ArbTSeg1, ArbSJW, ArbTSeg2, DataBitrate, DataTSeg1, DataSJW, DataTSeg2 set to ChannelNo = 1.
C |
long Ret; unsigned int ArbBitrate; unsigned short ArbTSeg1; unsigned short ArbSJW; unsigned short ArbTSeg2; unsigned int DataBitrate; unsigned short DataTSeg1; unsigned short DataSJW; unsigned short 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) )
|