EasyManua.ls Logo

Titan Electronics USB-2CAN-M - Linux SocketCAN Driver Installation

Titan Electronics USB-2CAN-M
76 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
16
7.4 Linux Driver Installation(SocketCAN)
SocketCAN is a set of open source CAN drivers and a networking stack contributed by
Volkswagen Research to the Linux kernel. Formerly known as Low Level CAN
Framework (LLCF).
Installing SocketCAN is rather easy. In fact, it just needs to install can-utils packages.
To proceed , uses the following command:
sudo apt-get install can-utils
By default, the SocketCAN device drivers are not automatically loaded by Linux at boot
time on all systems: you may need to enable the relevant linux kernel modules. You
can manually load these modules with the following command:
sudo modprobe can
sudo modprobe vcan
sudo modprobe slcan
7.4.1 Using SocketCAN with USB-CAN
To use USB-CAN with SocketCAN, you have to establish a “link” between the drivers
and the hardware. This is done with the following command:
sudo slcand -o -c -s8 /dev/ttyUSB0 can0
The -s parameter allow to configure different interface speed as indicated below.
ASCII Command
CAN Bitrate
s0
10 Kbit/s
s1
20 Kbit/s
s2
50 Kbit/s
s3
100 Kbit/s
s4
125 Kbit/s
s5
250 Kbit/s
s6
500 Kbit/s
s7
800 Kbit/s
s8
1000 Kbit/s
If everything worked fine, you should now see the can0 network device. To very it, just
type the following command:
sudo ip link set up slcan0

Table of Contents