器件型号: LAUNCHXL-F280025C
我当前正在运行 CAN_EX5_TRANSMIT_RECEIVE 示例、并将 LaunchPad 用作接收器。 我正在使用 Jetson USB 中连接的 CAN USB 收发器

并使用他们的 CAN 库编写了程序。 请参阅随附的文件。 Interface_Function_Library_User_Instruction.pdf
当我运行 python 程序时、代码编写器中会触发中断、但它不会点击代码来读取值、因为我知道我传递的 ID 不正确 
我不熟悉 CAN、并且正在学习它的工作原理。 如果有人可以向我指出在传输功能中传递哪些内容的正确方向、我将非常感激。
这是我的 python 脚本
from ctypes import *
VCI_USBCAN2 = 4
STATUS_OK = 1
class VCI_INIT_CONFIG(Structure):
_fields_ = [("AccCode", c_uint),
("AccMask", c_uint),
("Reserved", c_uint),
("Filter", c_ubyte),
("Timing0", c_ubyte),
("Timing1", c_ubyte),
("Mode", c_ubyte)
]
class VCI_CAN_OBJ(Structure):
_fields_ = [("ID", c_uint),
("TimeStamp", c_uint),
("TimeFlag", c_ubyte),
("SendType", c_ubyte),
("RemoteFlag", c_ubyte),
("ExternFlag", c_ubyte),
("DataLen", c_ubyte),
("Data", c_ubyte * 8),
("Reserved", c_ubyte * 3)
]
CanDLLName = './ControlCAN.dll' # Put the DLL in the corresponding directory
# canDLL = windll.LoadLibrary('./ControlCAN.dll')
# Under the Linux system, use the following statement to compile the command: python3 python3.8.0.py
canDLL = cdll.LoadLibrary('./libcontrolcan.so')
print(CanDLLName)
ret = canDLL.VCI_OpenDevice(VCI_USBCAN2, 0, 0)
if ret == STATUS_OK:
print('Call VCI_OpenDevice successfully\r\n')
if ret != STATUS_OK:
print('Error calling VCI_OpenDevice\r\n')
# Initial 0 channel
vci_initconfig = VCI_INIT_CONFIG(0x80000008, 0xFFFFFFFF, 0,
0, 0x03, 0x1C, 0) # baud rate 125k, normal mode
ret = canDLL.VCI_InitCAN(VCI_USBCAN2, 0, 0, byref(vci_initconfig))
if ret == STATUS_OK:
print('Call VCI_InitCAN1 successfully\r\n')
if ret != STATUS_OK:
print('Error calling VCI_InitCAN1\r\n')
ret = canDLL.VCI_StartCAN(VCI_USBCAN2, 0, 0)
if ret == STATUS_OK:
print('Call VCI_StartCAN1 successfully\r\n')
if ret != STATUS_OK:
print('Error calling VCI_StartCAN1\r\n')
# channel 1 send data
ubyte_array = c_ubyte * 8
a = ubyte_array(1, 2, 3, 4, 5, 6, 7, 8)
ubyte_3array = c_ubyte * 3
b = ubyte_3array(0, 0, 0)
vci_can_obj = VCI_CAN_OBJ(0x1, 0, 0, 1, 0, 0, 8, a, b) # Single send
#ret = canDLL.VCI_Transmit(VCI_USBCAN2, 0, 0, byref(vci_can_obj), 1)
ret = canDLL.VCI_Transmit(VCI_USBCAN2, 0, 0, byref(vci_can_obj), 1)
if ret == STATUS_OK:
print('CAN1 channel sent successfully\r\n')
if ret != STATUS_OK:
print('CAN1 channel sending failed\r\n')
# closure
canDLL.VCI_CloseDevice(VCI_USBCAN2, 0)