Lely core libraries  1.9.2
doc/co/can2udp.md
1 can2udp - CAN to UDP forwarding tool
2 ====================================
3 
4 Synopsis
5 --------
6 
7  can2udp -h
8  can2udp --help
9  can2udp [-4 | --ipv4 | -6 | --ipv6] [-b | --broadcast] [-D | --no-daemon]
10  [-f | --flush] [-i n | --interface=n] [-k ms | --keep-alive=ms]
11  [-p local_port | --port=local_port] [-v | --verbose] [interface]
12  [address] [port]
13 
14 Description
15 -----------
16 
17 The CAN to UDP forwarding tool is a bridge between the CAN bus and UDP. It
18 converts CAN frames to and from generic frames (as specified by CiA 315) and
19 transmits these over UDP.
20 
21 The options are as follows:
22 
23  -4, --ipv4 Use IPv4 for receiving UDP frames (default).
24  -6, --ipv6 Use IPv6 for receiving UDP frames.
25  -b, --broadcast Send broadcast messages (IPv4 only).
26  -D, --no-daemon Do not run as daemon.
27  -f, --flush Flush the send buffer after every received CAN frame.
28  -h, --help Display help.
29  -i <n>, --interface=<n>
30  Use WTM interface indicator <n> (in the range
31  [1..127], default: 1).
32  -k <ms>, --keep-alive=<ms>
33  Sends a keep-alive message every <ms> milliseconds
34  (default: 10000).
35  -p <local port>, --port=<local port>
36  Receive UDP frames on <local port>.
37  -v, --verbose Print sent and received CAN frames.
38 
39 Example
40 -------
41 
42 Linux supports virtual CAN interfaces (through SocketCAN). This allows a user to
43 run CAN programs on machines (such as a developer PC) which do not have a
44 physical CAN bus. `can2udp` makes it possible to connect the virtual CAN
45 interface to an actual CAN bus on a remote device, as long as there is an
46 IPv4/IPv6 connection.
47 
48 To setup the connection, run
49 
50  can2udp -fp 6000 can0 192.168.0.101 6001
51 
52 on the device with a physical CAN bus, and
53 
54  can2udp -fp 6001 vcan0 192.168.0.100 6000
55 
56 on the machine with a virtual CAN interface. The first device listens on
57 192.168.0.100:6000 for incoming UDP frames, and puts the CAN frames they contain
58 on can0. Frames originating from the CAN bus are sent to 192.168.0.101:6001. The
59 second devices receives those messages and puts them on vcan0. In this way, CAN
60 frames are duplicated on can0 and vcan0, effectively combining the two remote
61 CAN interfaces into a single CAN bus.
62 
63 To monitor the CAN frames sent and received (like candump), run
64 
65  can2udp -Dfvp 6001 vcan0 192.168.0.100 6000
66