CAN bus: Difference between revisions

 
(One intermediate revision by the same user not shown)
Line 119: Line 119:
** Also simple timer-based interface for cyclic RX with failure notification
** Also simple timer-based interface for cyclic RX with failure notification


===iproute===
===[[iproute]]===
SocketCAN devices, including virtual interfaces (<tt>vcanX</tt>), are configured with the standard <tt>iproute</tt> tool.
SocketCAN devices, including virtual interfaces (<tt>vcanX</tt>), are configured with the standard <tt>iproute</tt> tool.
* Get statistics: <tt>ip -details -statistics link show canX</tt>
* Get statistics: <tt>ip -details -statistics link show canX</tt>
** Alternatively, look at <tt>/proc/net/can/stats</tt>
** Alternatively, look at <tt>/proc/net/can/stats</tt>
Options for the device include:
Options for the device include:
* <tt>restart-ms</tt>: automatic restart time in milliseconds in the event of bus-off state
* <tt>restart-ms</tt>: automatic restart time in milliseconds in the event of bus-off state (default: disabled)
** <tt>restart</tt> can be used by itself for one-time bus recovery
** <tt>restart</tt> can be used by itself for one-time bus recovery
** A restart will send an error frame
** A restart will send an error frame
* <tt>one-shot</tt>: don't attempt to retransmit when we don't see an ACK
* <tt>one-shot</tt>: don't attempt to retransmit when we don't see an ACK (default: disabled)
** Note: when sniffing a <b>non-virtual</b> CAN interface, you must either (a) see an ACK -- requiring a connected device, or (b) be in one-shot mode, or you will not see your transmitted frames
** Note: when sniffing a <b>non-virtual</b> CAN interface, you must either (a) see an ACK -- requiring a connected device, or (b) be in one-shot mode, or you will not see your transmitted frames
* <tt>bitrate</tt>: bits per second, i.e. "125000".
* <tt>bitrate</tt>: bits per second, i.e. "125000".