sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget8/translations/zh_CN/networking/device_drivers/can/can327modnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget8/translations/zh_TW/networking/device_drivers/can/can327modnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget8/translations/it_IT/networking/device_drivers/can/can327modnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget8/translations/ja_JP/networking/device_drivers/can/can327modnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget8/translations/ko_KR/networking/device_drivers/can/can327modnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget8/translations/sp_SP/networking/device_drivers/can/can327modnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h7SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)h]h7SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhR/var/lib/git/docbuild/linux/Documentation/networking/device_drivers/can/can327.rsthKubhsection)}(hhh](htitle)}(h)can327: ELM327 driver for Linux SocketCANh]h)can327: ELM327 driver for Linux SocketCAN}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hAuthorsh]hAuthors}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hMax Staudt h](h Max Staudt <}(hhhhhNhNubh reference)}(h max@enpas.orgh]h max@enpas.org}(hhhhhNhNubah}(h]h ]h"]h$]h&]refurimailto:max@enpas.orguh1hhhubh>}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubeh}(h]authorsah ]h"]authorsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Motivationh]h Motivation}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h\This driver aims to lower the initial cost for hackers interested in working with CAN buses.h]h\This driver aims to lower the initial cost for hackers interested in working with CAN buses.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hCAN adapters are expensive, few, and far between. ELM327 interfaces are cheap and plentiful. Let's use ELM327s as CAN adapters.h]hCAN adapters are expensive, few, and far between. ELM327 interfaces are cheap and plentiful. Let’s use ELM327s as CAN adapters.}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h] motivationah ]h"] motivationah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Introductionh]h Introduction}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=hhhhhKubh)}(h|This driver is an effort to turn abundant ELM327 based OBD interfaces into full fledged (as far as possible) CAN interfaces.h]h|This driver is an effort to turn abundant ELM327 based OBD interfaces into full fledged (as far as possible) CAN interfaces.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj=hhubh)}(hSince the ELM327 was never meant to be a stand alone CAN controller, the driver has to switch between its modes as quickly as possible in order to fake full-duplex operation.h]hSince the ELM327 was never meant to be a stand alone CAN controller, the driver has to switch between its modes as quickly as possible in order to fake full-duplex operation.}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj=hhubh)}(hAs such, can327 is a best effort driver. However, this is more than enough to implement simple request-response protocols (such as OBD II), and to monitor broadcast messages on a bus (such as in a vehicle).h]hAs such, can327 is a best effort driver. However, this is more than enough to implement simple request-response protocols (such as OBD II), and to monitor broadcast messages on a bus (such as in a vehicle).}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hj=hhubh)}(hMost ELM327s come as nondescript serial devices, attached via USB or Bluetooth. The driver cannot recognize them by itself, and as such it is up to the user to attach it in form of a TTY line discipline (similar to PPP, SLIP, slcan, ...).h]hMost ELM327s come as nondescript serial devices, attached via USB or Bluetooth. The driver cannot recognize them by itself, and as such it is up to the user to attach it in form of a TTY line discipline (similar to PPP, SLIP, slcan, ...).}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hj=hhubh)}(hvThis driver is meant for ELM327 versions 1.4b and up, see below for known limitations in older controllers and clones.h]hvThis driver is meant for ELM327 versions 1.4b and up, see below for known limitations in older controllers and clones.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hj=hhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Data sheeth]h Data sheet}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK2ubh)}(hDThe official data sheets can be found at ELM electronics' home page:h]hFThe official data sheets can be found at ELM electronics’ home page:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hjhhubh block_quote)}(h"https://www.elmelectronics.com/ h]h)}(hhttps://www.elmelectronics.com/h]h)}(hjh]hhttps://www.elmelectronics.com/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhK6hjubah}(h]h ]h"]h$]h&]uh1jhhhK6hjhhubeh}(h] data-sheetah ]h"] data sheetah$]h&]uh1hhhhhhhhK2ubh)}(hhh](h)}(h!How to attach the line disciplineh]h!How to attach the line discipline}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK;ubh)}(hzEvery ELM327 chip is factory programmed to operate at a serial setting of 38400 baud/s, 8 data bits, no parity, 1 stopbit.h]hzEvery ELM327 chip is factory programmed to operate at a serial setting of 38400 baud/s, 8 data bits, no parity, 1 stopbit.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hjhhubh)}(hqIf you have kept this default configuration, the line discipline can be attached on a command prompt as follows::h]hpIf you have kept this default configuration, the line discipline can be attached on a command prompt as follows:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hjhhubh literal_block)}(hsudo ldattach \ --debug \ --speed 38400 \ --eightbits \ --noparity \ --onestopbit \ --iflag -ICRNL,INLCR,-IXOFF \ 30 \ /dev/ttyUSB0h]hsudo ldattach \ --debug \ --speed 38400 \ --eightbits \ --noparity \ --onestopbit \ --iflag -ICRNL,INLCR,-IXOFF \ 30 \ /dev/ttyUSB0}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKChjhhubh)}(hTo change the ELM327's serial settings, please refer to its data sheet. This needs to be done before attaching the line discipline.h]hTo change the ELM327’s serial settings, please refer to its data sheet. This needs to be done before attaching the line discipline.}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjhhubh)}(hiOnce the ldisc is attached, the CAN interface starts out unconfigured. Set the speed before starting it::h]hhOnce the ldisc is attached, the CAN interface starts out unconfigured. Set the speed before starting it:}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjhhubj)}(h# The interface needs to be down to change parameters sudo ip link set can0 down sudo ip link set can0 type can bitrate 500000 sudo ip link set can0 uph]h# The interface needs to be down to change parameters sudo ip link set can0 down sudo ip link set can0 type can bitrate 500000 sudo ip link set can0 up}hj@sbah}(h]h ]h"]h$]h&]hhuh1jhhhKShjhhubh)}(h500000 bit/s is a common rate for OBD-II diagnostics. If you're connecting straight to a car's OBD port, this is the speed that most cars (but not all!) expect.h]h500000 bit/s is a common rate for OBD-II diagnostics. If you’re connecting straight to a car’s OBD port, this is the speed that most cars (but not all!) expect.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjhhubh)}(hCAfter this, you can set out as usual with candump, cansniffer, etc.h]hCAfter this, you can set out as usual with candump, cansniffer, etc.}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjhhubeh}(h]!how-to-attach-the-line-disciplineah ]h"]!how to attach the line disciplineah$]h&]uh1hhhhhhhhK;ubh)}(hhh](h)}(h#How to check the controller versionh]h#How to check the controller version}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjrhhhhhKaubh)}(h3Use a terminal program to attach to the controller.h]h3Use a terminal program to attach to the controller.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKchjrhhubh)}(hUAfter issuing the "``AT WS``" command, the controller will respond with its version::h](hAfter issuing the “}(hjhhhNhNubhliteral)}(h ``AT WS``h]hAT WS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh:” command, the controller will respond with its version:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKehjrhhubj)}(h>AT WS ELM327 v1.4b >h]h>AT WS ELM327 v1.4b >}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhhjrhhubh)}(hiNote that clones may claim to be any version they like. It is not indicative of their actual feature set.h]hiNote that clones may claim to be any version they like. It is not indicative of their actual feature set.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjrhhubeh}(h]#how-to-check-the-controller-versionah ]h"]#how to check the controller versionah$]h&]uh1hhhhhhhhKaubh)}(hhh](h)}(hCommunication exampleh]hCommunication example}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKvubh)}(hThis is a short and incomplete introduction on how to talk to an ELM327. It is here to guide understanding of the controller's and the driver's limitation (listed below) as well as manual testing.h]hThis is a short and incomplete introduction on how to talk to an ELM327. It is here to guide understanding of the controller’s and the driver’s limitation (listed below) as well as manual testing.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKxhjhhubh)}(hThe ELM327 has two modes:h]hThe ELM327 has two modes:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK}hjhhubh bullet_list)}(hhh](h list_item)}(h Command modeh]h)}(hj h]h Command mode}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hReception mode h]h)}(hReception modeh]hReception mode}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj"ubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhKhjhhubh)}(hIn command mode, it expects one command per line, terminated by CR. By default, the prompt is a "``>``", after which a command can be entered::h](hcIn command mode, it expects one command per line, terminated by CR. By default, the prompt is a “}(hjBhhhNhNubj)}(h``>``h]h>}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjBubh*”, after which a command can be entered:}(hjBhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h >ATE1 OK >h]h >ATE1 OK >}hjbsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hThe init script in the driver switches off several configuration options that are only meaningful in the original OBD scenario the chip is meant for, and are actually a hindrance for can327.h]hThe init script in the driver switches off several configuration options that are only meaningful in the original OBD scenario the chip is meant for, and are actually a hindrance for can327.}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hWhen a command is not recognized, such as by an older version of the ELM327, a question mark is printed as a response instead of OK::h]hWhen a command is not recognized, such as by an older version of the ELM327, a question mark is printed as a response instead of OK:}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h>ATUNKNOWN ? >h]h>ATUNKNOWN ? >}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hkAt present, can327 does not evaluate this response. See the section below on known limitations for details.h]hkAt present, can327 does not evaluate this response. See the section below on known limitations for details.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hWhen a CAN frame is to be sent, the target address is configured, after which the frame is sent as a command that consists of the data's hex dump::h]hWhen a CAN frame is to be sent, the target address is configured, after which the frame is sent as a command that consists of the data’s hex dump:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h">ATSH123 OK >DEADBEEF12345678 OK >h]h">ATSH123 OK >DEADBEEF12345678 OK >}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hThe above interaction sends the SFF frame "``DE AD BE EF 12 34 56 78``" with (11 bit) CAN ID ``0x123``. For this to function, the controller must be configured for SFF sending mode (using "``AT PB``", see code or datasheet).h](h-The above interaction sends the SFF frame “}(hjhhhNhNubj)}(h``DE AD BE EF 12 34 56 78``h]hDE AD BE EF 12 34 56 78}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh” with (11 bit) CAN ID }(hjhhhNhNubj)}(h ``0x123``h]h0x123}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhY. For this to function, the controller must be configured for SFF sending mode (using “}(hjhhhNhNubj)}(h ``AT PB``h]hAT PB}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh”, see code or datasheet).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX.Once a frame has been sent and wait-for-reply mode is on (``ATR1``, configured on ``listen-only=off``), or when the reply timeout expires and the driver sets the controller into monitoring mode (``ATMA``), the ELM327 will send one line for each received CAN frame, consisting of CAN ID, DLC, and data::h](h:Once a frame has been sent and wait-for-reply mode is on (}(hjhhhNhNubj)}(h``ATR1``h]hATR1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, configured on }(hjhhhNhNubj)}(h``listen-only=off``h]hlisten-only=off}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh^), or when the reply timeout expires and the driver sets the controller into monitoring mode (}(hjhhhNhNubj)}(h``ATMA``h]hATMA}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhb), the ELM327 will send one line for each received CAN frame, consisting of CAN ID, DLC, and data:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h123 8 DEADBEEF12345678h]h123 8 DEADBEEF12345678}hjLsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hpFor EFF (29 bit) CAN frames, the address format is slightly different, which can327 uses to tell the two apart::h]hoFor EFF (29 bit) CAN frames, the address format is slightly different, which can327 uses to tell the two apart:}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h12 34 56 78 8 DEADBEEF12345678h]h12 34 56 78 8 DEADBEEF12345678}hjhsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hdThe ELM327 will receive both SFF and EFF frames - the current CAN config (``ATPB``) does not matter.h](hJThe ELM327 will receive both SFF and EFF frames - the current CAN config (}(hjvhhhNhNubj)}(h``ATPB``h]hATPB}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh) does not matter.}(hjvhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX%If the ELM327's internal UART sending buffer runs full, it will abort the monitoring mode, print "BUFFER FULL" and drop back into command mode. Note that in this case, unlike with other error messages, the error message may appear on the same line as the last (usually incomplete) data frame::h]hX*If the ELM327’s internal UART sending buffer runs full, it will abort the monitoring mode, print “BUFFER FULL” and drop back into command mode. Note that in this case, unlike with other error messages, the error message may appear on the same line as the last (usually incomplete) data frame:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h%12 34 56 78 8 DEADBEEF123 BUFFER FULLh]h%12 34 56 78 8 DEADBEEF123 BUFFER FULL}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubeh}(h]communication-exampleah ]h"]communication exampleah$]h&]uh1hhhhhhhhKvubh)}(hhh](h)}(h#Known limitations of the controllerh]h#Known limitations of the controller}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj)}(hhh](j )}(hXcClone devices ("v1.5" and others) Sending RTR frames is not supported and will be dropped silently. Receiving RTR with DLC 8 will appear to be a regular frame with the last received frame's DLC and payload. "``AT CSM``" (CAN Silent Monitoring, i.e. don't send CAN ACKs) is not supported, and is hard coded to ON. Thus, frames are not ACKed while listening: "``AT MA``" (Monitor All) will always be "silent". However, immediately after sending a frame, the ELM327 will be in "receive reply" mode, in which it *does* ACK any received frames. Once the bus goes silent, or an error occurs (such as BUFFER FULL), or the receive reply timeout runs out, the ELM327 will end reply reception mode on its own and can327 will fall back to "``AT MA``" in order to keep monitoring the bus. Other limitations may apply, depending on the clone and the quality of its firmware. h](h)}(h!Clone devices ("v1.5" and others)h]h%Clone devices (“v1.5” and others)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hASending RTR frames is not supported and will be dropped silently.h]hASending RTR frames is not supported and will be dropped silently.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hjReceiving RTR with DLC 8 will appear to be a regular frame with the last received frame's DLC and payload.h]hlReceiving RTR with DLC 8 will appear to be a regular frame with the last received frame’s DLC and payload.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hX9"``AT CSM``" (CAN Silent Monitoring, i.e. don't send CAN ACKs) is not supported, and is hard coded to ON. Thus, frames are not ACKed while listening: "``AT MA``" (Monitor All) will always be "silent". However, immediately after sending a frame, the ELM327 will be in "receive reply" mode, in which it *does* ACK any received frames. Once the bus goes silent, or an error occurs (such as BUFFER FULL), or the receive reply timeout runs out, the ELM327 will end reply reception mode on its own and can327 will fall back to "``AT MA``" in order to keep monitoring the bus.h](h“}(hjhhhNhNubj)}(h ``AT CSM``h]hAT CSM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh” (CAN Silent Monitoring, i.e. don’t send CAN ACKs) is not supported, and is hard coded to ON. Thus, frames are not ACKed while listening: “}(hjhhhNhNubj)}(h ``AT MA``h]hAT MA}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh” (Monitor All) will always be “silent”. However, immediately after sending a frame, the ELM327 will be in “receive reply” mode, in which it }(hjhhhNhNubhemphasis)}(h*does*h]hdoes}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1j(hjubh ACK any received frames. Once the bus goes silent, or an error occurs (such as BUFFER FULL), or the receive reply timeout runs out, the ELM327 will end reply reception mode on its own and can327 will fall back to “}(hjhhhNhNubj)}(h ``AT MA``h]hAT MA}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh(” in order to keep monitoring the bus.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hTOther limitations may apply, depending on the clone and the quality of its firmware.h]hTOther limitations may apply, depending on the clone and the quality of its firmware.}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hXAll versions No full duplex operation is supported. The driver will switch between input/output mode as quickly as possible. The length of outgoing RTR frames cannot be set. In fact, some clones (tested with one identifying as "``v1.5``") are unable to send RTR frames at all. We don't have a way to get real-time notifications on CAN errors. While there is a command (``AT CS``) to retrieve some basic stats, we don't poll it as it would force us to interrupt reception mode. h](h)}(h All versionsh]h All versions}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhubh)}(hoNo full duplex operation is supported. The driver will switch between input/output mode as quickly as possible.h]hoNo full duplex operation is supported. The driver will switch between input/output mode as quickly as possible.}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhubh)}(hThe length of outgoing RTR frames cannot be set. In fact, some clones (tested with one identifying as "``v1.5``") are unable to send RTR frames at all.h](hiThe length of outgoing RTR frames cannot be set. In fact, some clones (tested with one identifying as “}(hjhhhNhNubj)}(h``v1.5``h]hv1.5}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh*”) are unable to send RTR frames at all.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhubh)}(hWe don't have a way to get real-time notifications on CAN errors. While there is a command (``AT CS``) to retrieve some basic stats, we don't poll it as it would force us to interrupt reception mode.h](h^We don’t have a way to get real-time notifications on CAN errors. While there is a command (}(hjhhhNhNubj)}(h ``AT CS``h]hAT CS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhd) to retrieve some basic stats, we don’t poll it as it would force us to interrupt reception mode.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hXVersions prior to 1.4b These versions do not send CAN ACKs when in monitoring mode (AT MA). However, they do send ACKs while waiting for a reply immediately after sending a frame. The driver maximizes this time to make the controller as useful as possible. Starting with version 1.4b, the ELM327 supports the "``AT CSM``" command, and the "listen-only" CAN option will take effect. h](h)}(hVersions prior to 1.4bh]hVersions prior to 1.4b}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hThese versions do not send CAN ACKs when in monitoring mode (AT MA). However, they do send ACKs while waiting for a reply immediately after sending a frame. The driver maximizes this time to make the controller as useful as possible.h]hThese versions do not send CAN ACKs when in monitoring mode (AT MA). However, they do send ACKs while waiting for a reply immediately after sending a frame. The driver maximizes this time to make the controller as useful as possible.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h|Starting with version 1.4b, the ELM327 supports the "``AT CSM``" command, and the "listen-only" CAN option will take effect.h](h7Starting with version 1.4b, the ELM327 supports the “}(hjhhhNhNubj)}(h ``AT CSM``h]hAT CSM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhC” command, and the “listen-only” CAN option will take effect.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hVersions prior to 1.4 These chips do not support the "``AT PB``" command, and thus cannot change bitrate or SFF/EFF mode on-the-fly. This will have to be programmed by the user before attaching the line discipline. See the data sheet for details. h](h)}(hVersions prior to 1.4h]hVersions prior to 1.4}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hThese chips do not support the "``AT PB``" command, and thus cannot change bitrate or SFF/EFF mode on-the-fly. This will have to be programmed by the user before attaching the line discipline. See the data sheet for details.h](h"These chips do not support the “}(hj&hhhNhNubj)}(h ``AT PB``h]hAT PB}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubh” command, and thus cannot change bitrate or SFF/EFF mode on-the-fly. This will have to be programmed by the user before attaching the line discipline. See the data sheet for details.}(hj&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hXXVersions prior to 1.3 These chips cannot be used at all with can327. They do not support the "``AT D1``" command, which is necessary to avoid parsing conflicts on incoming data, as well as distinction of RTR frame lengths. Specifically, this allows for easy distinction of SFF and EFF frames, and to check whether frames are complete. While it is possible to deduce the type and length from the length of the line the ELM327 sends us, this method fails when the ELM327's UART output buffer overruns. It may abort sending in the middle of the line, which will then be mistaken for something else. h](h)}(hVersions prior to 1.3h]hVersions prior to 1.3}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjLubh)}(hThese chips cannot be used at all with can327. They do not support the "``AT D1``" command, which is necessary to avoid parsing conflicts on incoming data, as well as distinction of RTR frame lengths.h](hJThese chips cannot be used at all with can327. They do not support the “}(hj^hhhNhNubj)}(h ``AT D1``h]hAT D1}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^ubhy” command, which is necessary to avoid parsing conflicts on incoming data, as well as distinction of RTR frame lengths.}(hj^hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjLubh)}(hXtSpecifically, this allows for easy distinction of SFF and EFF frames, and to check whether frames are complete. While it is possible to deduce the type and length from the length of the line the ELM327 sends us, this method fails when the ELM327's UART output buffer overruns. It may abort sending in the middle of the line, which will then be mistaken for something else.h]hXvSpecifically, this allows for easy distinction of SFF and EFF frames, and to check whether frames are complete. While it is possible to deduce the type and length from the length of the line the ELM327 sends us, this method fails when the ELM327’s UART output buffer overruns. It may abort sending in the middle of the line, which will then be mistaken for something else.}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubeh}(h]h ]h"]h$]h&]j@jAuh1jhhhKhjhhubeh}(h]#known-limitations-of-the-controllerah ]h"]#known limitations of the controllerah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hKnown limitations of the driverh]hKnown limitations of the driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubj)}(hhh](j )}(hXNo 8/7 timing. ELM327 can only set CAN bitrates that are of the form 500000/n, where n is an integer divisor. However there is an exception: With a separate flag, it may set the speed to be 8/7 of the speed indicated by the divisor. This mode is not currently implemented. h](h)}(hNo 8/7 timing.h]hNo 8/7 timing.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hXELM327 can only set CAN bitrates that are of the form 500000/n, where n is an integer divisor. However there is an exception: With a separate flag, it may set the speed to be 8/7 of the speed indicated by the divisor. This mode is not currently implemented.h]hXELM327 can only set CAN bitrates that are of the form 500000/n, where n is an integer divisor. However there is an exception: With a separate flag, it may set the speed to be 8/7 of the speed indicated by the divisor. This mode is not currently implemented.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hXhNo evaluation of command responses. The ELM327 will reply with OK when a command is understood, and with ? when it is not. The driver does not currently check this, and simply assumes that the chip understands every command. The driver is built such that functionality degrades gracefully nevertheless. See the section on known limitations of the controller. h](h)}(h#No evaluation of command responses.h]h#No evaluation of command responses.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hXBThe ELM327 will reply with OK when a command is understood, and with ? when it is not. The driver does not currently check this, and simply assumes that the chip understands every command. The driver is built such that functionality degrades gracefully nevertheless. See the section on known limitations of the controller.h]hXBThe ELM327 will reply with OK when a command is understood, and with ? when it is not. The driver does not currently check this, and simply assumes that the chip understands every command. The driver is built such that functionality degrades gracefully nevertheless. See the section on known limitations of the controller.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hXfNo use of hardware CAN ID filtering An ELM327's UART sending buffer will easily overflow on heavy CAN bus load, resulting in the "``BUFFER FULL``" message. Using the hardware filters available through "``AT CF xxx``" and "``AT CM xxx``" would be helpful here, however SocketCAN does not currently provide a facility to make use of such hardware features. h](h)}(h#No use of hardware CAN ID filteringh]h#No use of hardware CAN ID filtering}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjubh)}(hX>An ELM327's UART sending buffer will easily overflow on heavy CAN bus load, resulting in the "``BUFFER FULL``" message. Using the hardware filters available through "``AT CF xxx``" and "``AT CM xxx``" would be helpful here, however SocketCAN does not currently provide a facility to make use of such hardware features.h](hbAn ELM327’s UART sending buffer will easily overflow on heavy CAN bus load, resulting in the “}(hjhhhNhNubj)}(h``BUFFER FULL``h]h BUFFER FULL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh=” message. Using the hardware filters available through “}(hjhhhNhNubj)}(h ``AT CF xxx``h]h AT CF xxx}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh ” and “}(hjhhhNhNubj)}(h ``AT CM xxx``h]h AT CM xxx}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhy” would be helpful here, however SocketCAN does not currently provide a facility to make use of such hardware features.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM"hjubeh}(h]h ]h"]h$]h&]uh1j hjhhhhhNubeh}(h]h ]h"]h$]h&]j@jAuh1jhhhMhjhhubeh}(h]known-limitations-of-the-driverah ]h"]known limitations of the driverah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h)Rationale behind the chosen configurationh]h)Rationale behind the chosen configuration}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjjhhhhhM+ubhdefinition_list)}(hhh](hdefinition_list_item)}(hE``AT E1`` Echo on We need this to be able to get a prompt reliably. h](hterm)}(h ``AT E1``h]j)}(hjh]hAT E1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhhhM0hjubh definition)}(hhh](h)}(hEcho onh]hEcho on}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hjubh)}(h1We need this to be able to get a prompt reliably.h]h1We need this to be able to get a prompt reliably.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM0hjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhM0hj}ubj)}(h``AT S1`` Spaces on We need this to distinguish 11/29 bit CAN addresses received. Note: We can usually do this using the line length (odd/even), but this fails if the line is not transmitted fully to the host (BUFFER FULL). h](j)}(h ``AT S1``h]j)}(hjh]hAT S1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhhhM:hjubj)}(hhh](h)}(h Spaces onh]h Spaces on}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjubh)}(h=We need this to distinguish 11/29 bit CAN addresses received.h]h=We need this to distinguish 11/29 bit CAN addresses received.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hjubh)}(hNote: We can usually do this using the line length (odd/even), but this fails if the line is not transmitted fully to the host (BUFFER FULL).h]hNote: We can usually do this using the line length (odd/even), but this fails if the line is not transmitted fully to the host (BUFFER FULL).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM7hjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhM:hj}hhubj)}(hE``AT D1`` DLC on We need this to tell the "length" of RTR frames. h](j)}(h ``AT D1``h]j)}(hj&h]hAT D1}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]uh1jhhhMAhj ubj)}(hhh](h)}(hDLC onh]hDLC on}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hj;ubh)}(h0We need this to tell the "length" of RTR frames.h]h4We need this to tell the “length” of RTR frames.}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM?hj;ubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhMAhj}hhubeh}(h]h ]h"]h$]h&]uh1j{hjjhhhhhNubeh}(h])rationale-behind-the-chosen-configurationah ]h"])rationale behind the chosen configurationah$]h&]uh1hhhhhhhhM+ubh)}(hhh](h)}(hA note on CAN bus terminationh]hA note on CAN bus termination}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjthhhhhMDubh)}(hYour adapter may have resistors soldered in which are meant to terminate the bus. This is correct when it is plugged into a OBD-II socket, but not helpful when trying to tap into the middle of an existing CAN bus.h]hYour adapter may have resistors soldered in which are meant to terminate the bus. This is correct when it is plugged into a OBD-II socket, but not helpful when trying to tap into the middle of an existing CAN bus.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMFhjthhubh)}(h~If communications don't work with the adapter connected, check for the termination resistors on its PCB and try removing them.h]hIf communications don’t work with the adapter connected, check for the termination resistors on its PCB and try removing them.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjthhubeh}(h]a-note-on-can-bus-terminationah ]h"]a note on can bus terminationah$]h&]uh1hhhhhhhhMDubeh}(h](can327-elm327-driver-for-linux-socketcanah ]h"])can327: elm327 driver for linux socketcanah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjjj:j7jjjjjojljjjjjjjgjdjqjnjju nametypes}(jjj:jjjojjjjgjqjuh}(jhjhj7jjj=jjjljjjrjjjjjdjjnjjjjtu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.