Full tutorial text with screenshots:
Download and install Kvaser Drivers for Windows, available here:
Download and install Kvaser CANKing, available at the same link.
Start CANKing and select Template from the first window.
After selecting OK, you will see the Template selection window. Select 2 CAN channels within this window leading to two CAN windows appearing on your desktop.. One Kvaser driver supports a maximum of two virtual channels, so this is the only selection that makes sense for now, since you need a minimum of two channels to pass data.
Five windows should open on your desktop, the Kvaser CANKing window, two CAN Channel windows, a Select Formatter window, and the Output Window. If your configuration is different you can go to the View menu and manually turn these five windows on. You’ll also need the Timed Transmission and History List windows, so turn these on as well. I like to arrange the windows on my Desktop so I can see everything, and the locations are logical. Here’s how my Desktop looks now:
Make sure you select the Virtual CAN Driver in both CAN 1 and CAN 2 windows, found under CAN Channels. One should say 0 – Kvaser Virtual CAN Driver, and the other should say 1 – Kvaser Virtual CAN Driver. Both channels should also have the same Bus Configuration information. All this should be set by default. Now select Start Run in your Kvaser CANKing window. This will turn on both Virtual channels and start communication. Now we create a message.
Go up to the Message menu in the top right corner, and select Universal, or just use the shortcut Ctrl+U. The window that will open will look like this:
This CAN Message 1 window is where we’re going to select a CAN message to send on our virtual CAN bus. Plug a simple CAN Identifier into the top box, say $0F0, then type a number between 1 and 8 into the DLC box. I like to use 8 to send a full frame of data. Now click on Randomize Data in the lower right corner of the window. My window now looks like this:
We are now all set to transmit the data. Click Send in your CAN Message 1 window. If you followed the steps above you should see two messages in your Output Window, and one in your History List window. The Output Window shows one message as Transmitted, and the same message as Received on the other channel. What we just did was to send our CAN message from one virtual channel to a second virtual channel. Here is what’s at the top of my Output Window:
You can see that this is the same randomized data selected in the CAN Message 1 window, with the CAN Identifier that I selected, transmitted from channel 0 and received on channel 1.
Let’s send one more message with a different Data Length Cade (DLC). Go back to the CAN Message 1 window and change the CAN Identifier, I’ll use $050 for the new identifier. Now change the DLC to 3. Click the Randomize Data button again, then click Send. Another message should be transmitted from Channel 0 and received on Channel 1, this time with only three data bytes. You can see this below in my CAN Message 1 window and my Output Window:
Now we are set up to go to step two of this training and use the History List window to send repeating CAN data frames. Your Timed Transmission window should still be open on your desktop. If not, you can go to the View menu and open it. I filled in my Timed Transmission window for 1000ms and Cyclic Transmission Mode:
Next, I looked at my History List window and could see the two original messages I transmitted and received through the virtual channels:
If you now select Send All in the History List window, you will see that the messages you created are pulled from the History List and transmitted on the virtual CAN bus according the parameters set in your Timed Transmission window. Here is what my Output Window now shows:
This is just an example of what can be done with the Kvaser Virtual CAN drivers and Kvaser CANKing. Other tasks that can be performed with the software you have are:
- Develop an example .dbc file as it would be used to decode any CAN data (J1939, NMEA 2000®, or CANOpen), and then put it to work by generating some data with CANKing and seeing if the decode goes correctly. Search Kvaser.com for J1939 DBC Files and find this link if you want to learn more about these before working with .dbc files. https://www.kvaser.com/developer-blog/an-introduction-j1939-and-dbc-files/
- Download and install a trial version of a partner’s CAN analysis tool and get to know it by sending and receiving data with it, through your virtual CAN bus.
- Download and install Kvaser CANlib SDK and develop a PC based application that accesses a CAN bus, then test your application through the virtual CAN driver.