README.rst
1.. _snippet-socketcan-native-sim:
2
3SocketCAN on Native Simulator Snippet (socketcan-native-sim)
4############################################################
5
6.. code-block:: console
7
8 west build -S socketcan-native-sim [...]
9
10Overview
11********
12
13This snippet allows to configure Controller Area Network (CAN) samples with Linux SocketCAN support
14on :ref:`native_sim`.
15
16By default, the native simulator expects a SocketCAN network device called ``zcan0`` (specified in
17:zephyr_file:`boards/native/native_sim/native_sim.dts`). This name can be added as an alternative
18name for an existing SocketCAN network device (here, a newly created virtual CAN network device
19``vcan0``) using a command like the following:
20
21.. code-block:: console
22
23 sudo modprobe vcan
24 sudo ip link add dev vcan0 type vcan
25 sudo ip link property add dev vcan0 altname zcan0
26
27The SocketCAN device must be configured and brought up before running the native simulator:
28
29.. code-block:: console
30
31 sudo ip link set vcan0 up
32