Deploying to gh-pages from @ Klipper3d/klipper@a77d07907f 🚀
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
|
||||
<title>CANBUS Troubleshooting - Klipper 文档</title>
|
||||
<title>CanBus故障排除 - Klipper 文档</title>
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<div data-md-component="skip">
|
||||
|
||||
|
||||
<a href="#canbus-troubleshooting" class="md-skip">
|
||||
<a href="#canbus" class="md-skip">
|
||||
跳转至
|
||||
</a>
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<div class="md-header__topic" data-md-component="header-topic">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
CANBUS Troubleshooting
|
||||
CanBus故障排除
|
||||
|
||||
</span>
|
||||
</div>
|
||||
@@ -623,7 +623,7 @@
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="Axis_Twist_Compensation.html" class="md-nav__link">
|
||||
Axis Twist Compensation
|
||||
轴扭曲补偿
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1158,7 +1158,7 @@
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="Bootloader_Entry.html" class="md-nav__link">
|
||||
Bootloader Entry
|
||||
引导加载程序条目
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1195,12 +1195,12 @@
|
||||
|
||||
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
CANBUS Troubleshooting
|
||||
CanBus故障排除
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<a href="CANBUS_Troubleshooting.html" class="md-nav__link md-nav__link--active">
|
||||
CANBUS Troubleshooting
|
||||
CanBus故障排除
|
||||
</a>
|
||||
|
||||
|
||||
@@ -1219,30 +1219,30 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#verify-can-bus-wiring" class="md-nav__link">
|
||||
Verify CAN bus wiring
|
||||
<a href="#can" class="md-nav__link">
|
||||
验证CAN总线布线
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#check-for-incrementing-bytes_invalid-counter" class="md-nav__link">
|
||||
Check for incrementing bytes_invalid counter
|
||||
<a href="#bytes_invalid" class="md-nav__link">
|
||||
检查递增BYTES_INVALID计数器
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#obtaining-candump-logs" class="md-nav__link">
|
||||
Obtaining candump logs
|
||||
<a href="#candump" class="md-nav__link">
|
||||
获取candump日志
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Obtaining candump logs">
|
||||
<nav class="md-nav" aria-label="获取candump日志">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parsing-klipper-messages-in-a-candump-log" class="md-nav__link">
|
||||
Parsing Klipper messages in a candump log
|
||||
<a href="#candumpklipper" class="md-nav__link">
|
||||
分析candump日志中的Klipper消息
|
||||
</a>
|
||||
|
||||
</li>
|
||||
@@ -1253,8 +1253,8 @@
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-a-logic-analyzer-on-the-canbus-wiring" class="md-nav__link">
|
||||
Using a logic analyzer on the canbus wiring
|
||||
<a href="#canbus_1" class="md-nav__link">
|
||||
在CanBus接线上使用逻辑分析仪
|
||||
</a>
|
||||
|
||||
</li>
|
||||
@@ -1344,30 +1344,30 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#verify-can-bus-wiring" class="md-nav__link">
|
||||
Verify CAN bus wiring
|
||||
<a href="#can" class="md-nav__link">
|
||||
验证CAN总线布线
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#check-for-incrementing-bytes_invalid-counter" class="md-nav__link">
|
||||
Check for incrementing bytes_invalid counter
|
||||
<a href="#bytes_invalid" class="md-nav__link">
|
||||
检查递增BYTES_INVALID计数器
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#obtaining-candump-logs" class="md-nav__link">
|
||||
Obtaining candump logs
|
||||
<a href="#candump" class="md-nav__link">
|
||||
获取candump日志
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="Obtaining candump logs">
|
||||
<nav class="md-nav" aria-label="获取candump日志">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#parsing-klipper-messages-in-a-candump-log" class="md-nav__link">
|
||||
Parsing Klipper messages in a candump log
|
||||
<a href="#candumpklipper" class="md-nav__link">
|
||||
分析candump日志中的Klipper消息
|
||||
</a>
|
||||
|
||||
</li>
|
||||
@@ -1378,8 +1378,8 @@
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#using-a-logic-analyzer-on-the-canbus-wiring" class="md-nav__link">
|
||||
Using a logic analyzer on the canbus wiring
|
||||
<a href="#canbus_1" class="md-nav__link">
|
||||
在CanBus接线上使用逻辑分析仪
|
||||
</a>
|
||||
|
||||
</li>
|
||||
@@ -1401,35 +1401,35 @@
|
||||
</a>
|
||||
|
||||
|
||||
<h1 id="canbus-troubleshooting">CANBUS Troubleshooting<a class="headerlink" href="#canbus-troubleshooting" title="Permanent link">¶</a></h1>
|
||||
<p>This document provides information on troubleshooting communication issues when using <a href="CANBUS.html">Klipper with CAN bus</a>.</p>
|
||||
<h2 id="verify-can-bus-wiring">Verify CAN bus wiring<a class="headerlink" href="#verify-can-bus-wiring" title="Permanent link">¶</a></h2>
|
||||
<p>The first step in troubleshooting communication issues is to verify the CAN bus wiring.</p>
|
||||
<h1 id="canbus">CanBus故障排除<a class="headerlink" href="#canbus" title="Permanent link">¶</a></h1>
|
||||
<p>本文档提供了使用<a href="CANBUS.html">Klipper with CAN Bus</a>时通信问题的故障排除信息。</p>
|
||||
<h2 id="can">验证CAN总线布线<a class="headerlink" href="#can" title="Permanent link">¶</a></h2>
|
||||
<p>排除通信故障的第一步是验证CAN总线布线。</p>
|
||||
<p>Be sure there are exactly two 120 Ohm <a href="CANBUS.html#terminating-resistors">terminating
|
||||
resistors</a> on the CAN bus. If the resistors are not properly installed then messages may not be able to be sent at all or the connection may have sporadic instability.</p>
|
||||
<p>The CANH and CANL bus wiring should be twisted around each other. At a minimum, the wiring should have a twist every few centimeters. Avoid twisting the CANH and CANL wiring around power wires and ensure that power wires that travel parallel to the CANH and CANL wires do not have the same amount of twists.</p>
|
||||
<p>Verify that all plugs and wire crimps on the CAN bus wiring are fully secured. Movement of the printer toolhead may jostle the CAN bus wiring causing a bad wire crimp or unsecured plug to result in intermittent communication errors.</p>
|
||||
<h2 id="check-for-incrementing-bytes_invalid-counter">Check for incrementing bytes_invalid counter<a class="headerlink" href="#check-for-incrementing-bytes_invalid-counter" title="Permanent link">¶</a></h2>
|
||||
<p>The Klipper log file will report a <code>Stats</code> line once a second when the printer is active. These "Stats" lines will have a <code>bytes_invalid</code> counter for each micro-controller. This counter should not increment during normal printer operation (it is normal for the counter to be non-zero after a RESTART and it is not a concern if the counter increments once a month or so). If this counter increments on a CAN bus micro-controller during normal printing (it increments every few hours or more frequently) then it is an indication of a severe problem.</p>
|
||||
<p>Incrementing <code>bytes_invalid</code> on a CAN bus connection is a symptom of reordered messages on the CAN bus. There are two known causes of reordered messages:</p>
|
||||
<p>CANH和CANL母线应相互缠绕。至少,电线每隔几厘米就应该有一次绞合。避免将CANH和CALL电线缠绕在电源线周围,并确保平行于CANH和CALL电线的电源线没有相同的扭转量。</p>
|
||||
<p>确认CAN总线接线上的所有插头和线夹都已完全固定。打印机刀头的移动可能会挤压CAN总线布线,导致不良的线缆卷曲或未固定的插头,从而导致间歇性通信错误。</p>
|
||||
<h2 id="bytes_invalid">检查递增BYTES_INVALID计数器<a class="headerlink" href="#bytes_invalid" title="Permanent link">¶</a></h2>
|
||||
<p>当打印机处于活动状态时,Klipper日志文件将每秒报告一次<code>Stats‘行。对于每个微控制器,这些“Stat”行都将有一个</code>bytes_valid`计数器。在正常的打印机操作期间,此计数器不应递增(重新启动后计数器为非零值是正常的,如果计数器每月递增一次也无关紧要)。如果在正常打印过程中,CAN Bus微控制器上的此计数器增加(每隔几个小时或更频繁地增加一次),则表示存在严重问题。</p>
|
||||
<p>在CAN总线连接上递增<code>BYTES_INVALID</code>是CAN总线上消息重新排序的症状。消息重新排序有两个已知原因:</p>
|
||||
<ol>
|
||||
<li>Old versions of the popular candlight_firmware for USB CAN adapters had a bug that could cause reordered messages. If using a USB CAN adapter running this firmware then make sure to update to the latest firmware if incrementing <code>bytes_invalid</code> is observed.</li>
|
||||
<li>Some Linux kernel builds for embedded devices have been known to reorder CAN bus messages. It may be necessary to use an alternative Linux kernel or to use alternative hardware that supports mainstream Linux kernels that do not exhibit this problem.</li>
|
||||
<li>用于USB CAN适配器的常用烛光固件的旧版本有一个错误,可能会导致消息重新排序。如果使用运行此固件的USB CAN适配器,则在观察到递增的<code>Bytes_Invalid</code>时,请确保更新到最新固件。</li>
|
||||
<li>已知一些用于嵌入式设备的Linux内核版本会对CAN总线消息进行重新排序。可能需要使用替代的Linux内核,或者使用支持不存在此问题的主流Linux内核的替代硬件。</li>
|
||||
</ol>
|
||||
<p>Reordered messages is a severe problem that must be fixed. It will result in unstable behavior and can lead to confusing errors at any part of a print.</p>
|
||||
<h2 id="obtaining-candump-logs">Obtaining candump logs<a class="headerlink" href="#obtaining-candump-logs" title="Permanent link">¶</a></h2>
|
||||
<p>The CAN bus messages sent to and from the micro-controller are handled by the Linux kernel. It is possible to capture these messages from the kernel for debugging purposes. A log of these messages may be of use in diagnostics.</p>
|
||||
<p>The Linux <a href="https://github.com/linux-can/can-utils">can-utils</a> tool provides the capture software. It is typically installed on a machine by running:</p>
|
||||
<p>重新排序的消息是一个必须解决的严重问题。这将导致行为不稳定,并可能导致打印的任何部分出现令人困惑的错误。</p>
|
||||
<h2 id="candump">获取candump日志<a class="headerlink" href="#candump" title="Permanent link">¶</a></h2>
|
||||
<p>向微控制器发送和从微控制器发送的CAN总线消息由Linux内核处理。出于调试目的,可以从内核捕获这些消息。这些消息的日志可能在诊断中有用。</p>
|
||||
<p>Linux<a href="https://github.com/linux-can/can-utils">can-utils</a>工具提供了捕获软件。通常通过运行以下命令将其安装在计算机上:</p>
|
||||
<div class="highlight"><pre><span></span><code>sudo apt-get update && sudo apt-get install can-utils
|
||||
</code></pre></div>
|
||||
|
||||
<p>Once installed, one may obtain a capture of all CAN bus messages on an interface with the following command:</p>
|
||||
<p>安装后,可使用以下命令捕获接口上的所有CAN总线消息:</p>
|
||||
<div class="highlight"><pre><span></span><code>candump -tz -Ddex can0,#FFFFFFFF > mycanlog
|
||||
</code></pre></div>
|
||||
|
||||
<p>One can view the resulting log file (<code>mycanlog</code> in the example above) to see each raw CAN bus message that was sent and received by Klipper. Understanding the content of these messages will likely require low-level knowledge of Klipper's <a href="CANBUS_protocol.html">CANBUS protocol</a> and Klipper's <a href="MCU_Commands.html">MCU commands</a>.</p>
|
||||
<h3 id="parsing-klipper-messages-in-a-candump-log">Parsing Klipper messages in a candump log<a class="headerlink" href="#parsing-klipper-messages-in-a-candump-log" title="Permanent link">¶</a></h3>
|
||||
<p>One may use the <code>parsecandump.py</code> tool to parse the low-level Klipper micro-controller messages contained in a candump log. Using this tool is an advanced topic that requires knowledge of Klipper <a href="MCU_Commands.html">MCU commands</a>. For example:</p>
|
||||
<p>用户可以查看生成的日志文件(上例中的<code>mycanlog</code>),以查看Klipper发送和接收的每个原始CAN总线消息。要理解这些消息的内容,可能需要对Klipper的<a href="CanBus_Protocol.md">CanBus协议</a>和Klipper的<a href="mcu_Commands.md">MCU命令</a>有较低层次的了解。</p>
|
||||
<h3 id="candumpklipper">分析candump日志中的Klipper消息<a class="headerlink" href="#candumpklipper" title="Permanent link">¶</a></h3>
|
||||
<p>用户可以使用<code>parsecandump.py</code>工具来解析烛光日志中包含的低级Klipper微控制器消息。使用此工具是一个高级主题,需要具备Klipper<a href="MCU_Commands.html">MCU命令</a>的知识。例如:</p>
|
||||
<div class="highlight"><pre><span></span><code>./scripts/parsecandump.py mycanlog 108 ./out/klipper.dict
|
||||
</code></pre></div>
|
||||
|
||||
@@ -1437,13 +1437,13 @@ resistors</a> on the CAN bus. If the resistors are not properly installed then m
|
||||
tool</a>. See the documentation for that tool for information on generating the Klipper micro-controller data dictionary.</p>
|
||||
<p>In the above example, <code>108</code> is the <a href="CANBUS_protocol.html#micro-controller-id-assignment">CAN bus
|
||||
id</a>. It is a hexadecimal number. The id <code>108</code> is assigned by Klipper to the first micro-controller. If the CAN bus has multiple micro-controllers on it, then the second micro-controller would be <code>10a</code>, the third would be <code>10c</code>, and so on.</p>
|
||||
<p>The candump log must be produced using the <code>-tz -Ddex</code> command-line arguments (for example: <code>candump -tz -Ddex can0,#FFFFFFFF</code>) in order to use the <code>parsecandump.py</code> tool.</p>
|
||||
<h2 id="using-a-logic-analyzer-on-the-canbus-wiring">Using a logic analyzer on the canbus wiring<a class="headerlink" href="#using-a-logic-analyzer-on-the-canbus-wiring" title="Permanent link">¶</a></h2>
|
||||
<p>The <a href="https://sigrok.org/wiki/PulseView">Sigrok Pulseview</a> software along with a low-cost <a href="https://en.wikipedia.org/wiki/Logic_analyzer">logic analyzer</a> can be useful for diagnosing CAN bus signaling. This is an advanced topic likely only of interest to experts.</p>
|
||||
<p>One can often find "USB logic analyzers" for under $15 (US pricing as of 2023). These devices are often listed as "Saleae logic clones" or as "24MHz 8 channel USB logic analyzers".</p>
|
||||
<p>要使用<code>parsecandump.py</code>工具,必须使用<code>-tz-Ddex</code>命令行参数(例如:<code>andump-tz-DDEX can0,#FFFFFFF</code>)生成坎通普日志。</p>
|
||||
<h2 id="canbus_1">在CanBus接线上使用逻辑分析仪<a class="headerlink" href="#canbus_1" title="Permanent link">¶</a></h2>
|
||||
<p><a href="https://sigrok.org/wiki/PulseView">Sigrok Pulseview</a>软件和低成本的<a href="https://en.wikipedia.org/wiki/Logic_analyzer">逻辑分析</a>]可用于诊断CAN总线信号。这是一个可能只有专家才感兴趣的高级话题。</p>
|
||||
<p>人们经常可以找到价格低于15美元的“USB逻辑分析仪”(截至2023年美国定价)。这些设备通常被列为“Saleae逻辑克隆”或“24 MHz 8通道USB逻辑分析仪”。</p>
|
||||
<p><img alt="pulseview-canbus" src="img/pulseview-canbus.png" /></p>
|
||||
<p>The above picture was taken while using Pulseview with a "Saleae clone" logic analyzer. The Sigrok and Pulseview software was installed on a desktop machine (also install the "fx2lafw" firmware if that is packaged separately). The CH0 pin on the logic analyzer was routed to the CAN Rx line, the CH1 pin was wired to the CAN Tx pin, and GND was wired to GND. Pulseview was configured to only display the D0 and D1 lines (red "probe" icon center top toolbar). The number of samples was set to 5 million (top toolbar) and the sample rate was set to 24Mhz (top toolbar). The CAN decoder was added (yellow and green "bubble icon" right top toolbar). The D0 channel was labeled as RX and set to trigger on a falling edge (click on black D0 label at left). The D1 channel was labeled as TX (click on brown D1 label at left). The CAN decoder was configured for 1Mbit rate (click on green CAN label at left). The CAN decoder was moved to the top of the display (click and drag green CAN label). Finally, the capture was started (click "Run" at top left) and a packet was transmitted on the CAN bus (<code>cansend can0 123#121212121212</code>).</p>
|
||||
<p>The logic analyzer provides an independent tool for capturing packets and verifying bit timing.</p>
|
||||
<p>上图是在使用Pulseview和“Saleae Clone”逻辑分析仪时拍摄的。Sigrok和Pulseview软件安装在台式计算机上(如果单独打包,还应安装“fx2lafw”固件)。逻辑分析仪上的CH0引脚被布线到CAN Rx线路,CH1引脚被布线到CAN Tx引脚,GND被布线到GND。Pulseview配置为仅显示D0和D1线(红色“探头”图标中央顶部工具栏)。采样数设置为500万(顶部工具栏),采样率设置为24 Mhz(顶部工具栏)。添加了CAN解码器(右上工具栏黄绿相间的“气泡图标”)。D0通道被标记为RX并设置为在下降沿触发(点击左侧的黑色D0标签)。将d1通道标记为Tx(点击左侧棕色的d1标签)。CAN解码器配置为1Mbit速率(点击左侧绿色的CAN标签)。CAN解码器被移到显示屏顶部(单击并拖动绿色的CAN标签)。最后,开始捕获(点击左上角的“Run”(运行)),并在CAN总线上传输一个包(<code>cansend can0 123#121212121212</code>)。</p>
|
||||
<p>逻辑分析器提供了用于捕获数据包和验证位时序的独立工具。</p>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user