aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-07-05 13:21:02 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-07-05 14:21:32 -0400
commit2d173f51b1531ffbde3723655bae0adb9bca5ecb (patch)
tree781921bb209c5b116b8bf0c0bd7f5869734f9cbd
parentb32ba3727bf6b07bb1099cde694f9d55081855ca (diff)
downloadkutter-2d173f51b1531ffbde3723655bae0adb9bca5ecb.tar.gz
kutter-2d173f51b1531ffbde3723655bae0adb9bca5ecb.tar.xz
kutter-2d173f51b1531ffbde3723655bae0adb9bca5ecb.zip
pru: Add documentation and install scripts for running on the PRU
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--config/generic-cramps.cfg75
-rw-r--r--config/generic-replicape.cfg78
-rw-r--r--docs/beaglebone.md79
-rwxr-xr-xscripts/install-beaglebone.sh65
-rwxr-xr-xscripts/klipper-pru-start.sh36
5 files changed, 333 insertions, 0 deletions
diff --git a/config/generic-cramps.cfg b/config/generic-cramps.cfg
new file mode 100644
index 00000000..969faaf2
--- /dev/null
+++ b/config/generic-cramps.cfg
@@ -0,0 +1,75 @@
+# This file contains an example configuration for a Beaglebone PRU
+# micro-controller attached to a CRAMPS board.
+
+# THIS FILE HAS NOT BEEN TESTED - PROCEED WITH CAUTION!
+
+# See the example.cfg file for a description of available parameters.
+
+[stepper_x]
+step_pin: P8_13
+dir_pin: P8_12
+enable_pin: !P9_14
+step_distance: .0125
+endstop_pin: ^P8_8
+homing_speed: 50
+position_endstop: 0
+position_max: 200
+
+[stepper_y]
+step_pin: P8_15
+dir_pin: P8_14
+enable_pin: !P9_14
+step_distance: .0125
+endstop_pin: ^P8_10
+homing_speed: 50
+position_endstop: 0
+position_max: 200
+
+[stepper_z]
+step_pin: P8_19
+dir_pin: P8_18
+enable_pin: !P9_14
+step_distance: 0.00025
+endstop_pin: ^P9_13
+homing_speed: 5
+position_endstop: 0
+position_max: 200
+
+[extruder]
+step_pin: P9_16
+dir_pin: P9_12
+enable_pin: !P9_14
+step_distance: .002
+nozzle_diameter: 0.400
+filament_diameter: 1.750
+heater_pin: P9_15
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: P9_36
+control: pid
+pid_Kp: 22.2
+pid_Ki: 1.08
+pid_Kd: 114
+min_temp: 0
+max_temp: 250
+
+[heater_bed]
+heater_pin: P8_11
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: P9_33
+control: watermark
+min_temp: 0
+max_temp: 130
+
+[fan]
+pin: P9_41
+
+[mcu]
+serial: /dev/rpmsg_30
+pin_map: beaglebone
+
+[printer]
+kinematics: cartesian
+max_velocity: 300
+max_accel: 3000
+max_z_velocity: 5
+max_z_accel: 100
diff --git a/config/generic-replicape.cfg b/config/generic-replicape.cfg
new file mode 100644
index 00000000..82f72863
--- /dev/null
+++ b/config/generic-replicape.cfg
@@ -0,0 +1,78 @@
+# This file contains an example configuration for the Beaglebone PRU
+# micro-controller.
+
+# THIS FILE HAS NOT BEEN TESTED - PROCEED WITH CAUTION!
+
+# See the example.cfg file for a description of available parameters.
+
+[stepper_x]
+step_pin: P8_17
+dir_pin: P8_26
+enable_pin: !P9_41
+step_distance: .0125
+endstop_pin: ^P9_25
+homing_speed: 50
+position_endstop: 0
+position_max: 200
+
+[stepper_y]
+step_pin: P8_12
+dir_pin: P8_19
+enable_pin: !P9_41
+step_distance: .0125
+endstop_pin: ^P9_23
+homing_speed: 50
+position_endstop: 0
+position_max: 200
+
+[stepper_z]
+step_pin: P8_13
+dir_pin: P8_14
+enable_pin: !P9_41
+step_distance: 0.00025
+endstop_pin: ^P9_13
+homing_speed: 5
+position_endstop: 0
+position_max: 200
+
+# XXX - Extruder heater hooked up to i2c mosfet
+#[extruder]
+#step_pin: P9_12
+#dir_pin: P8_15
+#enable_pin: !P9_41
+#step_distance: .002
+#nozzle_diameter: 0.400
+#filament_diameter: 1.750
+#heater_pin: ?
+#sensor_type: EPCOS 100K B57560G104F
+#sensor_pin: P9_39
+#control: pid
+#pid_Kp: 22.2
+#pid_Ki: 1.08
+#pid_Kd: 114
+#min_temp: 0
+#max_temp: 250
+
+# XXX - Bed heater hooked up to i2c mosfet
+#[heater_bed]
+#heater_pin: ?
+#sensor_type: EPCOS 100K B57560G104F
+#sensor_pin: P9_40
+#control: watermark
+#min_temp: 0
+#max_temp: 130
+
+# XXX - Fan power hooked up to i2c mosfet
+#[fan]
+#pin: ?
+
+[mcu]
+serial: /dev/rpmsg_30
+pin_map: beaglebone
+
+[printer]
+kinematics: cartesian
+max_velocity: 300
+max_accel: 3000
+max_z_velocity: 5
+max_z_accel: 100
diff --git a/docs/beaglebone.md b/docs/beaglebone.md
new file mode 100644
index 00000000..2eea47a8
--- /dev/null
+++ b/docs/beaglebone.md
@@ -0,0 +1,79 @@
+This document describes the process of running Klipper on a Beaglebone
+PRU. The PRU support is experimental.
+
+Building an OS image
+====================
+
+Start by installing the
+[latest Jessie IoT](https://beagleboard.org/latest-images) image
+(2017-03-19 or later). One may run the image from either a micro-SD
+card or from builtin eMMC. If using the eMMC, install it to eMMC now
+by following the instructions from the above link.
+
+Then ssh into the beaglebone machine (ssh debian@beaglebone --
+password is "temppwd") and install Klipper by running the following
+commands:
+```
+git clone https://github.com/KevinOConnor/klipper
+./klipper/scripts/install-beaglebone.sh
+```
+
+Install Octoprint
+=================
+
+One may then install Octoprint:
+```
+git clone https://github.com/foosel/OctoPrint.git
+cd OctoPrint/
+virtualenv venv
+./venv/bin/python setup.py install
+```
+
+And setup OctoPrint to start at bootup:
+```
+sudo cp ~/OctoPrint/scripts/octoprint.init /etc/init.d/octoprint
+sudo chmod +x /etc/init.d/octoprint
+sudo cp ~/OctoPrint/scripts/octoprint.default /etc/default/octoprint
+sudo update-rc.d octoprint defaults
+```
+
+It is necessary to modify OctoPrint's **/etc/default/octoprint**
+configuration file. One must change the OCTOPRINT_USER user to
+"debian", uncomment the BASEDIR, CONFIGFILE, and DAEMON settings and
+change the references from "/home/pi/" to "/home/debian/":
+```
+sudo nano /etc/default/octoprint
+```
+
+Then start the Octoprint service:
+```
+sudo systemctl start octoprint
+```
+
+Make sure the octoprint web server is accessible - it should be at:
+[http://beaglebone:5000/](http://beaglebone:5000/)
+
+
+Building the micro-controller code
+==================================
+
+To compile the Klipper micro-controller code, start by configuring it
+for the "Beaglebone PRU":
+```
+cd ~/klipper/
+make menuconfig
+```
+
+To build and install the new micro-controller code, run:
+```
+sudo service klipper stop
+make flash
+sudo service klipper start
+```
+
+Remaining configuration
+=======================
+
+Complete the installation by configuring Klipper and Octoprint
+following the instructions in
+[the main installation document](Installation.md#Configuring_Klipper).
diff --git a/scripts/install-beaglebone.sh b/scripts/install-beaglebone.sh
new file mode 100755
index 00000000..209f6948
--- /dev/null
+++ b/scripts/install-beaglebone.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# This script installs Klipper on a Beaglebone running Debian Jessie
+# for use with its PRU micro-controller.
+
+# Step 1: Do main install
+install_main()
+{
+ # Run the octopi script - raspbian is close enough to debian for
+ # this to work.
+ ${SRCDIR}/scripts/install-octopi.sh
+}
+
+# Step 2: Install additional system packages
+install_packages()
+{
+ # Install desired packages
+ PKGLIST="gcc-pru"
+
+ report_status "Installing beaglebone packages..."
+ sudo apt-get install --yes ${PKGLIST}
+}
+
+# Step 3: Install startup script
+install_script()
+{
+ report_status "Installing pru start script..."
+ sudo cp "${SRCDIR}/scripts/klipper-pru-start.sh" /etc/init.d/klipper_pru
+ sudo update-rc.d klipper_pru defaults
+}
+
+# Step 4: Install pru udev rule
+install_udev()
+{
+ report_status "Installing pru udev rule..."
+ sudo /bin/sh -c "cat > /etc/udev/rules.d/pru.rules" <<EOF
+KERNEL=="rpmsg_pru30", MODE="0666"
+EOF
+}
+
+# Helper functions
+report_status()
+{
+ echo -e "\n\n###### $1"
+}
+
+verify_ready()
+{
+ if [ "$EUID" -eq 0 ]; then
+ echo "This script must not run as root"
+ exit -1
+ fi
+}
+
+# Force script to exit if an error occurs
+set -e
+
+# Find SRCDIR from the pathname of this script
+SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
+
+# Run installation steps defined above
+verify_ready
+install_main
+install_packages
+install_script
+install_udev
diff --git a/scripts/klipper-pru-start.sh b/scripts/klipper-pru-start.sh
new file mode 100755
index 00000000..747543a2
--- /dev/null
+++ b/scripts/klipper-pru-start.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# System startup script to start the PRU firmware
+
+### BEGIN INIT INFO
+# Provides: klipper_pru
+# Required-Start: $local_fs
+# Required-Stop:
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Klipper_PRU daemon
+# Description: Starts the PRU for Klipper.
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+DESC="klipper_pru startup"
+NAME="klipper_pru"
+
+. /lib/lsb/init-functions
+
+case "$1" in
+start) log_daemon_msg "Starting klipper_pru" $NAME
+ # Enable ADC module
+ echo 'BB-ADC' > /sys/devices/platform/bone_capemgr/slots
+ # Start PRU firmware
+ if [ ! -c /dev/rpmsg_pru30 ]; then
+ rmmod -f pru_rproc
+ modprobe pru_rproc
+ fi
+ ;;
+stop|restart|reload|force-reload|status)
+ ;;
+*) log_action_msg "Usage: /etc/init.d/klipper_pru {start|stop|status|restart|reload|force-reload}"
+ exit 2
+ ;;
+esac
+exit 0