Set Up CAN Communication with Target Hardware
This section describes how to set up CAN communication with C2000™ target hardware.
Follow these steps to set up CAN communication between the target hardware and your host computer.
Ensure that the Vector Hardware is installed properly in the Windows® Device Manager.
Download and install the latest version of the Vector XL Library from the
Vector Web site
. After installing the library, copy the file vxlapi64.dll from the installation folder (for example C:\Softwares\Vector_Driver_Setup_9_3_0\Common) to the windows root\system32 folder.This folder name may vary depending on the Windows OS (for example C:\Windows\Sys32).
If you use the default installation of Vector driver setup for Windows 10 and 11, versions 23.20 or 24.10, and cannot detect the Vector CAN/CAN FD devices in MATLAB, follow these steps to resolve the issue:
Download and install the "XL Driver Library Setup" from the following link: XL Driver Library 20.30.14.
Download and install the Vector driver setup for Windows 10 and 11 from this link: Vector Driver Setup.
Open File Explorer and find the "vxlapi.dll" and "vxlapi64.dll" files in the XL Driver Library installation folder (e.g., "C:\Users\Public\Documents\Vector\XL Driver Library 20.30.14\bin").
Copy the "vxlapi64.dll" file to the "C:\Windows\System32" folder.
Copy the "vxlapi.dll" file to the "C:\Windows\SysWOW64" folder.
Restart your computer.
Open MATLAB and run the "canChannelList" command in the command window.
For more information on how to connect the hardware device with MATLAB, see How to Connect my hardware device from MATLAB
Run the vcanconf.exe in the vector driver installation.
Right-click on the application and select "Add application".
Name the application as ‘MATLAB’ and keep the default settings.
Right-click the first CAN piggy hardware device, select MATLAB, and pick CAN 1.
Right-click the first CAN piggy hardware device again and click Default baud rate to change the baud.
This baud has to match your Simulink® model CAN baud that you can change using the Target Preferences settings.
The Vector Hardware Config window is shown.
Open the model. Go to Configuration Parameters dialog box, select the desired Hardware board and verify the CAN baud rate. The default baud is
1 Mbits/sec
.CAN communication is now set up between your host computer and the C2000 target hardware. To know more about the CAN communication using CAN, see Communication Using CAN Blocks