summaryrefslogtreecommitdiffstats
path: root/docs/4_APIs_and_Services/4.5_Message_Signaling/7_CanDevStudio_Quickstart/candevstudio/2_can_device_socketcan_backend.md
blob: 1a6a52be8ac94fe13861f3aff66d7a54324b94c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
edit_link: ''
title: Bringing up a CAN device using socketcan backend
origin_url: >-
  https://raw.githubusercontent.com/automotive-grade-linux/docs-sources/master/agl-documentation/candevstudio/docs/2_can_device_socketcan_backend.md
---

<!-- 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 -->

# Bringing up a CAN device using socketcan backend

* [Using a supported Linux CAN device](https://www.elinux.org/CAN_Bus):

```bash
# Find your interface name (e.g. can0)
ip link
# Configure bitrate
sudo ip link set can0 type can bitrate 1000000
# Bring the device up
sudo ip link set can0 up
# Optionally configure CAN termination
sudo ip link set can0 type can termination 1
```

## Using slcand

* Based on FTDI Serial driver
* Requires slcand to "convert" serial device to SocketCAN.
* Officially supported in Linux Kernel v2.6.38

```bash
# Create SocketCAN device from serial interface
sudo slcand -o -c -s8 -S1000000 /dev/ttyUSB0 can0
# Bring the device up
sudo ip link set can0 up
```

## Using builtin Linux kernel virtual CAN module vcan

```bash
sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
```