This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F280025C: CAN Communication With Jetson Orin Nano

Part Number: LAUNCHXL-F280025C

I am currently running the can_ex5_transmit_receive example and making the launchpad the receiver.  I am using this CAN usb transceiver hooked in the Jetson's usb

Screenshot from 2025-11-05 20-02-10.png

and have written a program using their can library.   See the attached file.  Interface_Function_Library_User_Instruction.pdf 

The interrupt triggers in code composer when I run my python program, but it is not hitting the code to read the value as I know I'm not passing the correct id.



  I am new to CAN and am learning how it works.  If anyone could point me in the right direction on what to pass in the transmit function to make this work I would appreciate it.  

This is my python script

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)