xref: /netbsd-src/sbin/canconfig/canconfig.8 (revision 53988e4234fda54fb9c218b91e6ac968b8436765)
1.\"	$NetBSD: canconfig.8,v 1.3 2017/05/29 08:46:23 wiz Exp $
2.\"
3.\" Copyright (c) 2017 Manuel Bouyer.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
25.Dd April 15, 2017
26.Dt CANCONFIG 8
27.Os
28.Sh NAME
29.Nm canconfig
30.Nd configure CAN network interface parameters
31.Sh SYNOPSIS
32.Nm
33.Fl a
34.Nm
35.Ar canif
36.Nm
37.Ar can
38.Ar command
39.Op Ar args ...
40.Sh DESCRIPTION
41The
42.Nm
43utility is used to configure CAN network interface parameters and retrieve
44CAN network interface parameters and status from the kernel.
45.Ss Timing
46The base time unit used to define the network bit rate is the time quanta (tq),
47its value is defined by the input clock frequency and the prescaler value
48as (1/ freq * prescaler).
49.Pp
50The network bit time is split in 4 segments:
51.Bl -tag -width "phase_seg1" -offset indent -compact
52.It sync_seg
53fixed to 1 tq
54.It prop_seg
55.It phase_seg1
56.It phase_seg2
57.El
58The network bit time is (1 + prop_seg + phase_seg1 + phase_seg2), in tq.
59The sample point is between phase_seg1 and phase_seg2.
60.Pp
61The receiver hardware is allowed to shorten prop_seg or phase_seg2 to
62resynchronize with the sender.
63The swj (Synchronisation Jump Width) parameter
64defines by how much the hardware can shorten these segments.
65.Pp
66Some hardware can use 3 sample points instead of one, and keep the majority as
67the final value.
68.Ss Options
69The options are as follows:
70.Bl -tag -width indent
71.It Fl a
72Display the status of all CAN devices present on the system.
73This flag is mutually exclusive with all other sub-commands.
74.El
75.Pp
76All other operations require that a CAN interface be specified.
77If a CAN interface is specified with no sub-commands,
78the status of that interface is displayed.
79.Pp
80The following sub-commands are available:
81.Bl -tag -width indent
82.It Cm up
83Start network operations on the interface.
84Requires that all timing parameters have been set.
85.It Cm down
86Stop network operations on the interface.
87.It Cm brp Ar value
88Set the value of the baud rate prescaler.
89.It Cm prop_seg Ar value
90Set the number of tq for the propagation segment.
91.It Cm phase_seg1 Ar value
92Set the number of tq for the phase segment 1.
93.It Cm phase_seg2 Ar value
94Set the number of tq for the phase segment 2.
95.It Cm sjw Ar value
96Set the number of tq for the Synchronisation Jump Width.
97.It Cm 3samples
98Enable triple-sampling.
99.It Cm -3samples
100Disable triple-sampling.
101.It Cm listenonly
102Enable listen-only mode.
103In this mode the controller is passive, and doesn't send ACKs on the bus.
104.It Cm -listenonly
105Disable listen-only mode.
106.It Cm loopback
107Enable loopback mode.
108In this mode, the controller doesn't expect ACK from the bus.
109.It Cm -loopback
110Disable loopback mode.
111.El
112.\".Sh EXAMPLES
113.\"TODO
114.Sh SEE ALSO
115.Xr ifconfig.if 5 ,
116.Xr ifconfig 8
117.Sh HISTORY
118The
119.Nm
120utility first appeared in
121.Nx 8.0 .
122.Sh AUTHORS
123This version of the
124.Nm
125utility was written by
126.An Manuel Bouyer .
127