Main Content

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.

  1. Ensure that the Vector Hardware is installed properly in the Windows® Device Manager.

    Device manager

  2. 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:

    1. Download and install the "XL Driver Library Setup" from the following link: XL Driver Library 20.30.14.

    2. Download and install the Vector driver setup for Windows 10 and 11 from this link: Vector Driver Setup.

    3. 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").

    4. Copy the "vxlapi64.dll" file to the "C:\Windows\System32" folder.

    5. Copy the "vxlapi.dll" file to the "C:\Windows\SysWOW64" folder.

    6. Restart your computer.

    7. 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

  3. Run the vcanconf.exe in the vector driver installation.

  4. Right-click on the application and select "Add application".

    1. Name the application as ‘MATLAB’ and keep the default settings.

    2. Right-click the first CAN piggy hardware device, select MATLAB, and pick CAN 1.

    3. 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.

      Vector configure

  5. 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-config

    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