aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/CANBUS.md74
-rw-r--r--docs/CANBUS_protocol.md4
-rw-r--r--docs/Config_Changes.md5
-rw-r--r--docs/Overview.md3
-rw-r--r--docs/img/canhat.jpgbin120306 -> 0 bytes
-rw-r--r--docs/img/mcp2515.jpgbin138999 -> 0 bytes
-rw-r--r--docs/img/mcp2515_vcc_cut.pngbin2086399 -> 0 bytes
-rw-r--r--docs/img/stlinkv2-700x700.jpgbin32998 -> 0 bytes
-rw-r--r--docs/stm32f0_CAN.md142
9 files changed, 83 insertions, 145 deletions
diff --git a/docs/CANBUS.md b/docs/CANBUS.md
new file mode 100644
index 00000000..07569205
--- /dev/null
+++ b/docs/CANBUS.md
@@ -0,0 +1,74 @@
+This document describes Klipper's CAN bus support.
+
+# Device Hardware
+
+Klipper currently only supports CAN on stm32 chips. In addition, the
+micro-controller chip must support CAN and it must be on a board that
+has a CAN transceiver.
+
+To compile for CAN, run "make menuconfig", unselect "Use USB for
+communication (instead of serial)" and then select "Use CAN for
+communication (instead of serial)". Finally, compile the
+micro-controller code and flash it to the target board.
+
+# Host Hardware
+
+In order to use a CAN bus, it is necessary to have a host adapter.
+There are currently two common options:
+
+1. Use a [Waveshare Raspberry Pi CAN
+ hat](https://www.waveshare.com/rs485-can-hat.htm) or one of its
+ many clones.
+
+2. Use a USB CAN adapter (for example
+ [https://hacker-gadgets.com/product/cantact-usb-can-adapter/](https://hacker-gadgets.com/product/cantact-usb-can-adapter/)). There
+ are many different USB to CAN adapters available - when choosing
+ one, we recommend verifying it can run the [candlelight
+ firmware](https://github.com/candle-usb/candleLight_fw). (Unfortunately,
+ we've found some USB adapters run defective firmware and are locked
+ down, so verify before purchasing.)
+
+It is also necessary to configure the host operating system to use the
+adapter. This is typically done by creating a new file named
+`/etc/network/interfaces.d/can0` with the following contents:
+```
+auto can0
+iface can0 can static
+ bitrate 500000
+ up ifconfig $IFACE txqueuelen 128
+```
+
+Note that the "Raspberry Pi CAN hat" also requires [changes to
+config.txt](https://www.waveshare.com/wiki/RS485_CAN_HAT).
+
+# Finding the canbus_uuid for new micro-controllers
+
+Each micro-controller on the CAN bus is assigned a unique id based on
+the factory chip identifier encoded into each micro-controller. To
+find each micro-controller device id, make sure the hardware is
+powered and wired correctly, and then run:
+```
+~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
+```
+
+If uninitialized CAN devices are detected the above command will
+report lines like the following:
+```
+Found canbus_uuid=11aa22bb33cc
+```
+
+Each device will have a unique identifier. In the above example,
+`11aa22bb33cc` is the micro-controller's "canbus_uuid".
+
+Note that the `canbus_query.py` tool will only report uninitialized
+devices - if Klipper (or a similar tool) configures the device then it
+will no longer appear in the list.
+
+# Configuring Klipper
+
+Update the Klipper [mcu configuration](Config_Reference.md#mcu) to use
+the CAN bus to communicate with the device - for example:
+```
+[mcu my_can_mcu]
+canbus_uuid: 11aa22bb33cc
+```
diff --git a/docs/CANBUS_protocol.md b/docs/CANBUS_protocol.md
index f5e56c74..3fa2bf2d 100644
--- a/docs/CANBUS_protocol.md
+++ b/docs/CANBUS_protocol.md
@@ -1,5 +1,7 @@
This document describes the protocol Klipper uses to communicate over
-[CAN bus](https://en.wikipedia.org/wiki/CAN_bus).
+[CAN bus](https://en.wikipedia.org/wiki/CAN_bus). See
+[CANBUS.md](CANBUS.md) for information on configuring Klipper with CAN
+bus.
# Micro-controller id assignment
diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md
index 0236fbd6..2c44b1c5 100644
--- a/docs/Config_Changes.md
+++ b/docs/Config_Changes.md
@@ -6,6 +6,11 @@ All dates in this document are approximate.
# Changes
+20210313: Klipper's support for micro-controllers that communicate
+with CAN bus has changed. If using CAN bus then all micro-controllers
+must be reflashed and the [Klipper configuration must be
+updated](CANBUS.md).
+
20210310: The TMC2660 default for driver_SFILT has been changed from 1
to 0.
diff --git a/docs/Overview.md b/docs/Overview.md
index 50d04bb5..48a10a3a 100644
--- a/docs/Overview.md
+++ b/docs/Overview.md
@@ -80,7 +80,6 @@ communication with the Klipper developers.
Beaglebone PRU.
- [Bootloaders](Bootloaders.md): Developer information on
micro-controller flashing.
-- [stm32f0](stm32f0_CAN.md): Information on the STM32F0 micro-controller
- port.
+- [CAN bus](CANBUS.md): Information on using CAN bus with Klipper.
- [TSL1401CL filament width sensor](TSL1401CL_Filament_Width_Sensor.md)
- [Hall filament width sensor](HallFilamentWidthSensor.md)
diff --git a/docs/img/canhat.jpg b/docs/img/canhat.jpg
deleted file mode 100644
index 6c05ce0f..00000000
--- a/docs/img/canhat.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/img/mcp2515.jpg b/docs/img/mcp2515.jpg
deleted file mode 100644
index 6a614522..00000000
--- a/docs/img/mcp2515.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/img/mcp2515_vcc_cut.png b/docs/img/mcp2515_vcc_cut.png
deleted file mode 100644
index 91e344e4..00000000
--- a/docs/img/mcp2515_vcc_cut.png
+++ /dev/null
Binary files differ
diff --git a/docs/img/stlinkv2-700x700.jpg b/docs/img/stlinkv2-700x700.jpg
deleted file mode 100644
index 6276d774..00000000
--- a/docs/img/stlinkv2-700x700.jpg
+++ /dev/null
Binary files differ
diff --git a/docs/stm32f0_CAN.md b/docs/stm32f0_CAN.md
deleted file mode 100644
index 8ee9838c..00000000
--- a/docs/stm32f0_CAN.md
+++ /dev/null
@@ -1,142 +0,0 @@
-This document describes how the STM32F0 port operates and how to work with
-tiny CAN-enabled boards.
-
-Required components
-===================
-
-#### MCP2515 module
-
-![MCP2515](img/mcp2515.jpg)
-or this
-![CAN/RS485 hat](img/canhat.jpg)
-
-#### St-link dongle
-
-![st-link v2](img/stlinkv2-700x700.jpg)
-
-
-Adding CAN bus to Raspberry Pi
-==============================
-(Based on Quick Guide https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=141052)
-
-First of all, (only if you have small CAN module) it’s necessary to modify the CAN-module from ebay, because it has
-only one VCC pin, but the MCP2515 needs to be powered from 3V3 and the TJA1050
-CAN-transceiver needs to be powered from 5V. Powering both chips from 5V would
-work, but then a level-shifter for the SPI would be needed. The Pi's GPIO pins
-are NOT 5V tolerant. Cut a trace on the PCB and soldered a pin onto the trace
-to deliver 5V only to the TJA1050. Be sure to cut the trace before the capacitor:
-
-![VCC cut](img/mcp2515_vcc_cut.png)
-
-Next connect the module:
-
-| MCP2515 | Raspberry Pi |
-| --- | --- |
-| VCC | 1 (3V3) |
-| TJA 1050 VCC | 2 (5V) |
-| GND | 6 (GND) |
-| CS | 24 (CE0) |
-| MISO | 21 (MISO) |
-| MOSI | 19 (MOSI) |
-| SCK | 23 (SCK) |
-| INT | 22 (GPIO25) |
-
-Install can-utils:
-> sudo apt-get install can-utils
-
-To activate the driver for the MCP2515 you have to add a kernel overlay, to do
-so edit the /boot/config.txt
-> sudo nano /boot/config.txt
-
-And add the following lines (set oscillator value according to crystal on your board):
-
-```
-dtparam=spi=on
-dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25
-dtoverlay=spi1-1cs
-```
-
-Now reboot, after the reboot try to setup the the can interface:
-> sudo ip link set can0 up type can bitrate 500000
-
-If no errors occurred, the can interface should be ready now.
-To make the CAN-interface permanent, add the following lines to /etc/network/interfaces
-
-```
-auto can0
-iface can0 can static
- bitrate 500000
-```
-
-Communicating over CAN
-======================
-
-Use "Serial over CAN" emulator software to establish connection:
-https://github.com/Delsian/CanSerial
-
-Install st-link on Raspberry Pi
-===============================
-
-> sudo apt-get update
-
-> sudo apt-get install cmake
-
-> sudo apt-get install libusb-1.0-0-dev
-
-> git clone https://github.com/texane/stlink stlink-repo
-
-> cd stlink-repo
-
-> make
-
-> cd build/Release/
-
-> sudo make install
-
-
-Copy to /etc/udev/rules.d/49-stlinkv2.rules:
-
-```
-# stm32 discovery boards, with onboard st/linkv2
-# ie, STM32L, STM32F4.
-# STM32VL has st/linkv1, which is quite different
-
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", \
- MODE:="0666", \
- SYMLINK+="stlinkv2_%n"
-
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
- KERNEL!="sd*", KERNEL!="sg*", KERNEL!="tty*", SUBSYSTEM!="bsg", \
- MODE:="0666", \
- SYMLINK+="stlinkv2_%n"
-
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
- KERNEL=="sd*", MODE:="0666", \
- SYMLINK+="stlinkv2_disk"
-
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
- KERNEL=="sg*", MODE:="0666", \
- SYMLINK+="stlinkv2_raw_scsi"
-
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
- SUBSYSTEM=="bsg", MODE:="0666", \
- SYMLINK+="stlinkv2_block_scsi"
-
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
- KERNEL=="tty*", MODE:="0666", \
- SYMLINK+="stlinkv2_console"
-
-# If you share your linux system with other users, or just don't like the
-# idea of write permission for everybody, you can replace MODE:="0666" with
-# OWNER:="yourusername" to create the device owned by you, or with
-# GROUP:="somegroupname" and control access using standard unix groups.
-```
-
-Now "make flash" command can upload HEX into connected board
-
-Pins allocation
-===============
-
-Configurations with CAN and Serial port uses different pins, and during enumeration
-process firmware reports all possible pin names. But actually you can use only
-existing pins, not involved in communication. Wrong pins will generate shutdown.