1a6a52be8ac94fe13861f3aff66d7a54324b94c1
[AGL/documentation.git] / docs / 4_APIs_and_Services / 4.5_Message_Signaling / 7_CanDevStudio_Quickstart / candevstudio / 2_can_device_socketcan_backend.md
1 ---
2 edit_link: ''
3 title: Bringing up a CAN device using socketcan backend
4 origin_url: >-
5   https://raw.githubusercontent.com/automotive-grade-linux/docs-sources/master/agl-documentation/candevstudio/docs/2_can_device_socketcan_backend.md
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/apis_services/master/candevstudio-developer-guides-api-services-book.yml -->
9
10 # Bringing up a CAN device using socketcan backend
11
12 * [Using a supported Linux CAN device](https://www.elinux.org/CAN_Bus):
13
14 ```bash
15 # Find your interface name (e.g. can0)
16 ip link
17 # Configure bitrate
18 sudo ip link set can0 type can bitrate 1000000
19 # Bring the device up
20 sudo ip link set can0 up
21 # Optionally configure CAN termination
22 sudo ip link set can0 type can termination 1
23 ```
24
25 ## Using slcand
26
27 * Based on FTDI Serial driver
28 * Requires slcand to "convert" serial device to SocketCAN.
29 * Officially supported in Linux Kernel v2.6.38
30
31 ```bash
32 # Create SocketCAN device from serial interface
33 sudo slcand -o -c -s8 -S1000000 /dev/ttyUSB0 can0
34 # Bring the device up
35 sudo ip link set can0 up
36 ```
37
38 ## Using builtin Linux kernel virtual CAN module vcan
39
40 ```bash
41 sudo modprobe vcan
42 sudo ip link add dev can0 type vcan
43 sudo ip link set can0 up
44 ```