Installation

The Kvaser CANlib SDK supports both 32-bit and 64-bit programs under Windows and Linux. For more detailed information about supported platforms, please contact Kvaser Support.

If you have any problems you might want to have a look at our web site, www.kvaser.com. If our web site doesn't help, then by all means don't hesitate to contact your friendly Kvaser reseller, or Kvaser Support.

Installing on Windows

We recommend that you install the drivers first, then the Kvaser CANlibSDK, and last install the hardware.

Starting with CANLIB 4.0, all drivers and other executable files are digitally signed by Kvaser using an Authenticode™ certificate. Starting with CANlib 5.20 all drivers are also digitally signed by Microsoft.

The latest versions of documentation, software and drivers can be downloaded for free at www.kvaser.com/download.

Installing the Driver

When upgrading the drivers, we recommend that you remove all Kvaser hardware before installing the update. In that way you can be sure that no applications are using the hardware and that no files are locked during the installation. The installation will work just fine even if you don't remove the hardware, but you might have to reboot before the new drivers are actually used.

If you are upgrading the drivers, you should under all circumstances close all applications that use the CAN (or LIN) bus before starting the upgrade.

To install the drivers, run the driver installation package. At present it is called kvaser_drivers_setup.exe (direct link to latest version).

  1. When you start the installation program, Windows will ask for the password of an account with administrative rights, or, if you are already logged into an account with such rights, you will be presented with a "consent dialog" that asks you for permission to continue.
  2. Run the installation program. It will copy the driver files to your hard disk and register them with Windows.
  3. The first time you install new Kvaser hardware of a particular type, Windows will display the "Found New Hardware Wizard". Since all the required driver files are already installed on your computer, all you need to do is to click the Next and OK buttons to complete the wizard. Windows will search for the driver files and will discover them automatically.
Note
Windows might ask you if you want to look on Windows Update for updated drivers. We recommend that you answer "No, not this time" - it will save you time.
For the PCI and PCI Express cards you may need to reload the driver manually or restart your computer to get the system to use the new driver.

If you have trouble during installation, see Windows Installation troubleshooting.

Installing Additional Virtual Devices

By default, the Windows installer installs two Virtual Devices. If you need more, you can manually install additional Virtual Devices up to a maximum of 16. The first step is to increase the registry key "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\KVASER AB\CANDriver 1.0\Drivers\kcanv\MaxCards" to the number of Virtual Devices needed.

reg_kcanv.png
Maximum number of allowed Virtual Devices is controlled by the MaxCards Registry Setting

To increase the maximum number of allowed Virtual Devices to 8, copy the code below to a textfile, name it to "SetMaxKvaserVirtualDevices.reg", and execute the file by double clicking on it. You can also do the changes directly in the registry with Regedit.exe.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\KVASER AB\CANDriver 1.0\Drivers\kcanv]
"MaxCards"=dword:00000008
"DriverName"="kcanv"

It is also possible to change the number of channels each Virtual Device has using the registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\kcanv\Parameters\ChannelCount". By default, each Virtual Device has two channels.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\kcanv\Parameters]
"ChannelCount"=dword:00000002
Note
A reboot of the system is required after changing the ChannelCount setting.

To add a Virtual Device, start the "Hardware Wizard", by pressing "Win + R", type HDWWIZ and click OK. Go through the "Hardware Wizard" and select:

  1. Select "Install the hardware that I manually select from a list (Advanced)", and click Next
  2. Select "CAN Hardware (Kvaser)", and click next
  3. Scroll down in the list of device driver and select "Kvaser Virtual CAN Driver", click Next
  4. Complete the installation by clicking Next and Finish.
Note
If you try and install more than 16 Kvaser Virtual CAN Drivers, the "Hardware Wizard" will notify you that "This device is not working properly because Windows cannot load the drivers required".

Removing the driver

To remove the installed drivers, simply uninstall them using the Windows Control Panel.

Note
If you want to reinstall the drivers, a restart or power cycle may be needed in some cases between the uninstallation and the reinstallation. If the reinstallation fails, try to restart the computer and then run the installation again.

Installing Kvaser CANlib SDK

To install the Kvaser CANlib SDK, download and run the installation package. At present it is called canlib.exe (direct link to latest version).

Note
The CANlib SDK should not be installed on top of an already installed, older edition of CANlib SDK. You should install into a new directory, or uninstall the old version first.
Take a note of where you install the Kvaser CANlib SDK, since this is needed in order to setup your IDE, see Tutorials for some examples.

Removing Kvaser CANlib SDK

To remove the installed Kvaser CANlib SDK, simply uninstall using the Windows Control Panel.

Installing on Linux

We recommend that you install the drivers first, then the Kvaser CANlibSDK, and last install the hardware.

The latest versions of documentation, software and drivers can be downloaded for free at www.kvaser.com/download.

Installing the Driver

System requirements:

  • Linux 2.6.29 or later
  • Header files and compiler for kernel compilation.

In Ubuntu e.g. installing header files is accomplished by issuing the command:

sudo apt-get install build-essential

On some systems you may need to install the Linux headers using something like:

sudo apt-get install linux-headers-`uname -r`
Note
Having versions of the Linux headers installed other than that of the currently running kernel may cause conflicts and faulty drivers.

To download and unpack the latest drivers you may use:

wget --content-disposition "https://www.kvaser.com/download/?utm_source=software&utm_ean=7330130980754&utm_status=latest"
tar xvzf linuxcan.tar.gz
cd linuxcan
Note
Choose a path that doesn't contain any spaces for CANlib to build properly.

To build (compile) all drivers use:

make
Note
It is advised to remove the old driver by calling sudo make uninstall before replacing the installed drivers.

To install all drivers use:

sudo make install

To install and load, virtual and PCI drivers:

sudo make load
Note
Running sudo make load will also cause the virtual and PCI drivers to be loaded at boot time. This might be bad if experimenting with the device drivers.
It is never required to manually install or load any modules, create or edit files. This is taken care of the Makefile, in the root of the linuxcan directory.

More information can be found in the included README file.

Installing Virtual Devices

The driver named "virtualcan" controls the Virtual Devices. The number of channels each Virtual Device has, and the total number of Virtual Devices, is controlled by editing define statements in linuxcan\virtualcan\virtualcan.h.

#define NR_CHANNELS 2
#define NR_VIRTUAL_DEV 1

Removing the driver

To unload and uninstall all drivers:

sudo make uninstall

Installing Kvaser CANlib SDK

System requirements:

  • The package libxml2-dev is needed in order to build kvamemolibxml.
  • The packages libssl-dev and zlib1g-dev are needed to build kvlclib.

To download and unpack the latest version of Linux SDK library use:

wget --content-disposition "https://www.kvaser.com/download/?utm_source=software&utm_ean=7330130981966&utm_status=latest"
tar xvzf kvlibsdk.tar.gz
cd kvlibsdk

To build everything, run

make

To run self-tests, run

make check

To install everything, run

sudo make install

Removing Kvaser CANlib SDK

To uninstall everything, run

sudo make uninstall

Hardware Installation

Refer to the Device's User Guide description on how to install.

Windows: Working devices should be listed in the Windows Device Manager under "CAN Hardware (Kvaser)"

After a successful driver and hardware installation, you can use the Kvaser Device guide application to check the firmware version of the device.

In the Control Panel, under "Hardware and Sound", you can open the Kvaser Device Guide application. The driver is working and communicating with the device if the device is listed under "Hardware" and the firmware version can be read.

Note
A Remote Device (e.g. Ethercan Light) will not be listed in the Device Manager before a connection to the device has been established.

Linux: Run the list_devices example to verify that your hardware is correctly detected.

The latest versions of documentation, software and drivers can be downloaded for free at www.kvaser.com/download.