A:
For information about CAN FD communication, please refer to [Difference between CAN 2.0B Communication and CAN FD Communication].
① For CAN FD communication, different values can be specified for the
bit rate setting for the Arbitration
Field and the bit rate setting for the Data
Field.
In this case, the MessageType parameter of the
CanTransmit function
requires a CAN FD message (CCAN_MSG_TYPE_CAN_FD) and a bit rate switch
(CCAN_MSG_TYPE_BITRATE_SWITCH).
② Please set the bit rate settings and sampling points for the Arbitration
Field and Data Field on the
same CAN path to the same settings on the transmitting device and the
receiving device.
For settings, use the CanSetCanFdTiming
function.
Also, to check the setting values, use the CanGetCanFdTiming
function.
For details, please refer to the Function
Reference for each function.
CAN FD transmission from CAN device ChannelNo = 1.
MessageNum =1, CAN ID = 0x11c, DataLength = 1, Data = 0xff
VB.NET |
Dim Ret As Integer Dim MessageType(0) As UInteger Dim CanId(0) As UInteger Dim DataLength(0) As UShort Dim Data(0)(63) As Byte
MessageType(0) = CCAN_MSG_TYPE_CAN_FD Or CCAN_MSG_TYPE_BITRATE_SWITCH CanId(0) = &H11C Data(0)(0) = &HFF
Ret = CanTransmit ( Id
, 1 , 1 , MessageType , CanId , Data ) |
C, C++ |
long Ret; unsinged long MessageType[1]; unsinged long CanId[1]; unsinged short DataLength[1]; unsinged char Data[1][64];
MessageType[0] = CCAN_MSG_TYPE_CAN_FD | CCAN_MSG_TYPE_BITRATE_SWITCH; CanId[0] = 0x11c; Data[0][0] = 0xff;
|
C# |
int Ret; uint[] MessageType = new unit[1]; uint[] CanId = new uint[1]; ushort[] DataLength = new ushort[1]; ubyte[,] Data = new ubyte[1,64];
MessageType[0] = CCAN_MSG_TYPE_CAN_FD | CCAN_MSG_TYPE_BITRATE_SWITCH; CanId[0] = 0x11c; Data[0,0] = 0xff;
|
Python |
Ret = ctypes.c_long() MessageTypeType = ctypes.c_uint() * 1 MessageType = MessageTypeType() CanIdType = ctypes.c_uint() * 1 CanId = CanIdType() DataLengthType = ctypes.c_ushort() *1 DataLength = DataLengthType() SingleDataType = ctypes.c_ubyte() * 64 DataType = ctypes.SingleDataType * 1 Data = DataType()
MessageType[0] = ccan.CCAN_MSG_TYPE_CAN_FD | ccan.CCAN_MSG_TYPE_BITRATE_SWITCH CanId[0] = 0x11c DataLength[0] = 1 Data[0][0] = 0xff
Ret.value = ccan.CanTransmit ( Id , 1 , DataLength , MessageType , CanId , Data )
|