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. Make sure that the Vector Hardware is installed properly in the Windows® Device Manager.

  2. Open the c28x_CAN_Tx model that sends message from the board to the host.

  3. Select the target hardware that you are using. The model is set to use a CAN baud of 1Mbit/ sec; you can change the baud settings in the Target Preferences settings.

  4. Use btest32.exe (Vector tool) on the host to receive the messages. ‘btest32.exe’ comes with the Vector drivers that you can find in the driver installation zip file from vector.

    Make sure that ‘btest32’ returns the message values with no errors.

  5. Set the baud for btest32 as follows:

    For 1 Mbit/s: btest32.exe 1000000

    This confirms the following:

    The Vector CAN card drivers are working on the host.

    The CAN settings, connection, and the cable on the target are working properly.

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

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

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

  9. Open the CCP example model c28x_ccp_ert. Open the Configuration Parameters dialog box to select the desired processor and verify the CAN baud. The default baud is 1 Mbits/sec.

  10. To run the model in External mode, click Run.

    CAN communication is now set up between your host computer and the C2000 target hardware. Click the Info button on the model to get help on this example.