mirror of
git://soft.sys114.com/klipper
synced 2026-02-11 16:10:26 +09:00
Compare commits
19 Commits
a5264c3d43
...
odroidc5
| Author | SHA1 | Date | |
|---|---|---|---|
| 65a96db75b | |||
| d94e8ba0bc | |||
| d5bb4148f2 | |||
| bc0c6a52fa | |||
| 7c07bdc08c | |||
| a18ccdeea9 | |||
| ce18ba251f | |||
| facee8b4dc | |||
| 8dee2f31c9 | |||
| 0cf3a2d2bd | |||
| 8d087c3f86 | |||
| 7757c0bc68 | |||
| 4a66eefe5d | |||
| 88ad6d1934 | |||
| 5797bd9cb3 | |||
| 2b961e6991 | |||
| c789d93c05 | |||
|
|
f7d08a02bb | ||
| c773418da6 |
@@ -2,4 +2,4 @@
|
|||||||
Name=can0
|
Name=can0
|
||||||
|
|
||||||
[CAN]
|
[CAN]
|
||||||
BitRate=250000
|
BitRate=1000000
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
[mcu]
|
[mcu]
|
||||||
serial: /tmp/klipper_host_mcu
|
serial: /tmp/klipper_host_mcu
|
||||||
|
|
||||||
[mcu EBBCan] # based on EBB36 CAN V1.1
|
[mcu EBBCan] # based on EBB42 CAN V1.0
|
||||||
canbus_uuid: e8a11afa199b
|
canbus_uuid: 1e8ea3b32c8a
|
||||||
|
|
||||||
[printer]
|
[printer]
|
||||||
kinematics: cartesian
|
kinematics: cartesian
|
||||||
@@ -53,7 +53,7 @@ homing_retract_dist: 2
|
|||||||
microsteps: 16
|
microsteps: 16
|
||||||
rotation_distance: 40
|
rotation_distance: 40
|
||||||
position_endstop: 0
|
position_endstop: 0
|
||||||
position_max: 230
|
position_max: 200
|
||||||
homing_speed: 50
|
homing_speed: 50
|
||||||
|
|
||||||
[stepper_z]
|
[stepper_z]
|
||||||
@@ -74,16 +74,16 @@ microsteps: 16
|
|||||||
rotation_distance: 8
|
rotation_distance: 8
|
||||||
|
|
||||||
[extruder]
|
[extruder]
|
||||||
step_pin: EBBCan: PD0
|
step_pin: EBBCan: PA9
|
||||||
dir_pin: EBBCan: PD1
|
dir_pin: EBBCan: PA8
|
||||||
enable_pin: !EBBCan: PD2
|
enable_pin: !EBBCan: PA10
|
||||||
microsteps: 16
|
microsteps: 16
|
||||||
rotation_distance: 7.703694208
|
rotation_distance: 7.703694208
|
||||||
nozzle_diameter: 0.400
|
nozzle_diameter: 0.400
|
||||||
filament_diameter: 1.750
|
filament_diameter: 1.750
|
||||||
heater_pin: EBBCan:PB13
|
heater_pin: EBBCan:PB1
|
||||||
sensor_type: EPCOS 100K B57560G104F
|
sensor_type: EPCOS 100K B57560G104F
|
||||||
sensor_pin: EBBCan:PA3
|
sensor_pin: EBBCan:PA0
|
||||||
control: pid
|
control: pid
|
||||||
pid_Kp: 21.527
|
pid_Kp: 21.527
|
||||||
pid_Ki: 1.063
|
pid_Ki: 1.063
|
||||||
@@ -101,10 +101,10 @@ heater_temp: 50.0
|
|||||||
heater_pin: gpiochip0/gpio65
|
heater_pin: gpiochip0/gpio65
|
||||||
sensor_type: ATC Semitec 104GT-2
|
sensor_type: ATC Semitec 104GT-2
|
||||||
sensor_pin: analog0
|
sensor_pin: analog0
|
||||||
control = pid
|
control: pid
|
||||||
pid_kp = 76.549
|
pid_Kp: 21.527
|
||||||
pid_ki = 0.974
|
pid_Ki: 1.063
|
||||||
pid_kd = 1504.195
|
pid_Kd: 108.982
|
||||||
min_temp: 0
|
min_temp: 0
|
||||||
max_temp: 85
|
max_temp: 85
|
||||||
|
|
||||||
@@ -159,13 +159,13 @@ hold_current: 0.500
|
|||||||
stealthchop_threshold: 30
|
stealthchop_threshold: 30
|
||||||
|
|
||||||
[tmc2209 extruder]
|
[tmc2209 extruder]
|
||||||
uart_pin: EBBCan:PA15
|
uart_pin: EBBCan:PA13
|
||||||
run_current: 0.800
|
run_current: 0.800
|
||||||
hold_current: 0.500
|
hold_current: 0.500
|
||||||
stealthchop_threshold: 250
|
stealthchop_threshold: 250
|
||||||
|
|
||||||
[probe]
|
[probe]
|
||||||
pin: !EBBCan:PB8
|
pin: !EBBCan:PA5
|
||||||
x_offset: -42.0
|
x_offset: -42.0
|
||||||
y_offset: -4.0
|
y_offset: -4.0
|
||||||
speed: 5.0
|
speed: 5.0
|
||||||
@@ -173,14 +173,14 @@ speed: 5.0
|
|||||||
[bed_mesh]
|
[bed_mesh]
|
||||||
speed: 80
|
speed: 80
|
||||||
mesh_min: 0,0
|
mesh_min: 0,0
|
||||||
mesh_max: 180,270
|
mesh_max: 150,150
|
||||||
probe_count: 3,3
|
probe_count: 5,5
|
||||||
|
|
||||||
[bed_screws]
|
[bed_screws]
|
||||||
screw1: 30,25
|
screw1: 30,25
|
||||||
screw2: 270,25
|
screw2: 200,25
|
||||||
screw3: 270,265
|
screw3: 200,200
|
||||||
screw4: 30, 265
|
screw4: 30, 200
|
||||||
|
|
||||||
[input_shaper]
|
[input_shaper]
|
||||||
shaper_freq_x: 39.4
|
shaper_freq_x: 39.4
|
||||||
@@ -204,6 +204,24 @@ gcode:
|
|||||||
G1 X142 Y150 F3000 # (100 + 42, 150 + 4)
|
G1 X142 Y150 F3000 # (100 + 42, 150 + 4)
|
||||||
G28 Z
|
G28 Z
|
||||||
|
|
||||||
|
[gcode_macro PRINT_END]
|
||||||
|
gcode:
|
||||||
|
# Move Z +25
|
||||||
|
SAVE_GCODE_STATE NAME=_ui_movement
|
||||||
|
G91
|
||||||
|
G1 Z+25 F1500
|
||||||
|
RESTORE_GCODE_STATE NAME=_ui_movement
|
||||||
|
|
||||||
|
# Retract filament
|
||||||
|
SAVE_GCODE_STATE NAME=_ui_extrude
|
||||||
|
M83
|
||||||
|
G1 E-5 F300
|
||||||
|
RESTORE_GCODE_STATE NAME=_ui_extrude
|
||||||
|
|
||||||
|
# Move X and Y to 0
|
||||||
|
G28 X
|
||||||
|
G28 Y
|
||||||
|
|
||||||
[gcode_macro START_PRINT]
|
[gcode_macro START_PRINT]
|
||||||
gcode:
|
gcode:
|
||||||
G28
|
G28
|
||||||
@@ -240,4 +258,4 @@ gcode:
|
|||||||
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
|
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
|
||||||
#*#
|
#*#
|
||||||
#*# [probe]
|
#*# [probe]
|
||||||
#*# z_offset = 0.34
|
#*# z_offset = 0.34
|
||||||
|
|||||||
2
debian/control
vendored
2
debian/control
vendored
@@ -27,7 +27,7 @@ Depends: ${misc:Depends},
|
|||||||
Description: Klipper Host software
|
Description: Klipper Host software
|
||||||
...
|
...
|
||||||
|
|
||||||
Package: klipper-mcu
|
Package: klipper-mcu-odroidc5
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
Description: Klipper MCU firmware
|
Description: Klipper MCU firmware
|
||||||
|
|||||||
8
debian/rules
vendored
8
debian/rules
vendored
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
define firmware
|
define firmware
|
||||||
make distclean
|
make distclean
|
||||||
echo CONFIG_MACH_LINUX=y | tr -d '[[:space:]]' \
|
echo CONFIG_MACH_LINUX=y \
|
||||||
> $(shell pwd)/.config && make olddefconfig
|
> $(shell pwd)/.config
|
||||||
|
echo CONFIG_MACH_LINUX_ODROIDC5=y | tr -d '[[:space:]]' \
|
||||||
|
>> $(shell pwd)/.config && make olddefconfig
|
||||||
TOPDIR=$(shell pwd) make
|
TOPDIR=$(shell pwd) make
|
||||||
mkdir -p $(shell pwd)/firmware/LINUX
|
mkdir -p $(shell pwd)/firmware/LINUX
|
||||||
cp out/klipper.elf $(shell pwd)/firmware/LINUX/klipper_mcu
|
cp out/klipper.elf $(shell pwd)/firmware/LINUX/klipper_mcu
|
||||||
@@ -17,7 +19,7 @@ override_dh_auto_configure:
|
|||||||
dh_auto_configure
|
dh_auto_configure
|
||||||
|
|
||||||
override_dh_virtualenv:
|
override_dh_virtualenv:
|
||||||
dh_virtualenv --requirements scripts/klippy-requirements.txt --no-package klipper-mcu --skip-install
|
dh_virtualenv --requirements scripts/klippy-requirements.txt --no-package klipper-mcu-odroidc5 --skip-install
|
||||||
|
|
||||||
override_dh_strip:
|
override_dh_strip:
|
||||||
dh_strip --exclude=/site-packages/
|
dh_strip --exclude=/site-packages/
|
||||||
|
|||||||
@@ -16,6 +16,22 @@ config BOARD_DIRECTORY
|
|||||||
string
|
string
|
||||||
default "linux"
|
default "linux"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Board selection
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Board model"
|
||||||
|
config MACH_LINUX_DEFAULT
|
||||||
|
bool "DEFAULT"
|
||||||
|
config MACH_LINUX_ODROIDC5
|
||||||
|
bool "ODROID-C5"
|
||||||
|
select MACH_LINUX_ODROID_COMMON
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config MACH_LINUX_ODROID_COMMON
|
||||||
|
bool
|
||||||
|
|
||||||
config CLOCK_FREQ
|
config CLOCK_FREQ
|
||||||
int
|
int
|
||||||
default 50000000
|
default 50000000
|
||||||
|
|||||||
@@ -3,10 +3,13 @@
|
|||||||
dirs-y += src/linux src/generic
|
dirs-y += src/linux src/generic
|
||||||
|
|
||||||
src-y += linux/main.c linux/timer.c linux/console.c linux/watchdog.c
|
src-y += linux/main.c linux/timer.c linux/console.c linux/watchdog.c
|
||||||
src-y += linux/pca9685.c linux/spidev.c linux/analog.c linux/hard_pwm.c
|
src-y += linux/pca9685.c linux/spidev.c linux/hard_pwm.c
|
||||||
src-y += linux/i2c.c linux/gpio.c generic/crc16_ccitt.c generic/alloc.c
|
src-y += linux/i2c.c linux/gpio.c generic/crc16_ccitt.c generic/alloc.c
|
||||||
src-y += linux/sensor_ds18b20.c
|
src-y += linux/sensor_ds18b20.c
|
||||||
|
|
||||||
|
src-$(CONFIG_MACH_LINUX_DEFAULT) += linux/analog.c
|
||||||
|
src-$(CONFIG_MACH_LINUX_ODROIDC5) += linux/analog_odroidc5.c
|
||||||
|
|
||||||
CFLAGS_klipper.elf += -lutil -lrt -lpthread
|
CFLAGS_klipper.elf += -lutil -lrt -lpthread
|
||||||
|
|
||||||
flash: $(OUT)klipper.elf
|
flash: $(OUT)klipper.elf
|
||||||
|
|||||||
@@ -13,15 +13,13 @@
|
|||||||
#include "internal.h" // report_errno
|
#include "internal.h" // report_errno
|
||||||
#include "sched.h" // sched_shutdown
|
#include "sched.h" // sched_shutdown
|
||||||
|
|
||||||
// ODROID-C5
|
DECL_CONSTANT("ADC_MAX", 4095); // Assume 12bit adc
|
||||||
DECL_CONSTANT("ADC_MAX", 1800); // Assume 12bit adc
|
|
||||||
|
|
||||||
#define ANALOG_START (1<<12)
|
#define ANALOG_START (1<<12)
|
||||||
|
|
||||||
DECL_ENUMERATION_RANGE("pin", "analog0", ANALOG_START, 8);
|
DECL_ENUMERATION_RANGE("pin", "analog0", ANALOG_START, 8);
|
||||||
|
|
||||||
// ODROID-C5
|
#define IIO_PATH "/sys/bus/iio/devices/iio:device0/in_voltage%d_raw"
|
||||||
#define IIO_PATH "/sys/bus/iio/devices/iio:device0/in_voltage%d_input"
|
|
||||||
|
|
||||||
struct gpio_adc
|
struct gpio_adc
|
||||||
gpio_adc_setup(uint32_t pin)
|
gpio_adc_setup(uint32_t pin)
|
||||||
|
|||||||
102
src/linux/analog_odroidc5.c
Normal file
102
src/linux/analog_odroidc5.c
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
// Read analog values from Linux IIO device
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 Kevin O'Connor <kevin@koconnor.net>
|
||||||
|
//
|
||||||
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
|
|
||||||
|
#include <fcntl.h> // open
|
||||||
|
#include <stdio.h> // snprintf
|
||||||
|
#include <stdlib.h> // atoi
|
||||||
|
#include <unistd.h> // read
|
||||||
|
#include "command.h" // shutdown
|
||||||
|
#include "gpio.h" // gpio_adc_setup
|
||||||
|
#include "internal.h" // report_errno
|
||||||
|
#include "sched.h" // sched_shutdown
|
||||||
|
|
||||||
|
// ODROID-C5
|
||||||
|
DECL_CONSTANT("ADC_MAX", 1800);
|
||||||
|
|
||||||
|
#define ANALOG_START (1<<12)
|
||||||
|
|
||||||
|
DECL_ENUMERATION_RANGE("pin", "analog0", ANALOG_START, 8);
|
||||||
|
|
||||||
|
// ODROID-C5
|
||||||
|
#define IIO_PATH "/sys/bus/iio/devices/iio:device0/in_voltage0_raw"
|
||||||
|
#define SCALE_PATH "/sys/bus/iio/devices/iio:device0/in_voltage_scale"
|
||||||
|
#define OFFSET_PATH "/sys/bus/iio/devices/iio:device0/in_voltage_offset"
|
||||||
|
|
||||||
|
struct gpio_adc
|
||||||
|
gpio_adc_setup(uint32_t pin)
|
||||||
|
{
|
||||||
|
struct gpio_adc g;
|
||||||
|
int fd;
|
||||||
|
char buf[64];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
fd = open(SCALE_PATH, O_RDONLY);
|
||||||
|
ret = read(fd, buf, sizeof(buf)-1);
|
||||||
|
if (ret <= 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
buf[ret] = '\0';
|
||||||
|
g.scale = atof(buf) * 1000;
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
fd = open(OFFSET_PATH, O_RDONLY);
|
||||||
|
ret = read(fd, buf, sizeof(buf)-1);
|
||||||
|
if (ret <= 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
buf[ret] = '\0';
|
||||||
|
g.offset = atoi(buf);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
fd = open(IIO_PATH, O_RDONLY|O_CLOEXEC);
|
||||||
|
if (fd < 0) {
|
||||||
|
report_errno("analog open", fd);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
ret = set_non_blocking(fd);
|
||||||
|
if (ret < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
g.fd = fd;
|
||||||
|
return g;
|
||||||
|
fail:
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
shutdown("Unable to open adc device");
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
gpio_adc_sample(struct gpio_adc g)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t
|
||||||
|
gpio_adc_read(struct gpio_adc g)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
int voltage;
|
||||||
|
int ret = pread(g.fd, buf, sizeof(buf)-1, 0);
|
||||||
|
if (ret <= 0) {
|
||||||
|
report_errno("analog read", ret);
|
||||||
|
try_shutdown("Error on analog read");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
buf[ret] = '\0';
|
||||||
|
|
||||||
|
voltage = atoi(buf) + g.offset;
|
||||||
|
voltage = voltage > 0 ? voltage : 0;
|
||||||
|
voltage = voltage * g.scale;
|
||||||
|
voltage = voltage < 1800000 ? voltage : 1800000;
|
||||||
|
voltage /= 1000;
|
||||||
|
|
||||||
|
return voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gpio_adc_cancel_sample(struct gpio_adc g)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef __LINUX_GPIO_H
|
#ifndef __LINUX_GPIO_H
|
||||||
#define __LINUX_GPIO_H
|
#define __LINUX_GPIO_H
|
||||||
|
|
||||||
|
#include "autoconf.h" // CONFIG_MACH_LINUX_*
|
||||||
#include <stdint.h> // uint8_t
|
#include <stdint.h> // uint8_t
|
||||||
|
|
||||||
struct gpio_out {
|
struct gpio_out {
|
||||||
@@ -20,6 +21,10 @@ void gpio_in_reset(struct gpio_in g, int8_t pull_up);
|
|||||||
uint8_t gpio_in_read(struct gpio_in g);
|
uint8_t gpio_in_read(struct gpio_in g);
|
||||||
|
|
||||||
struct gpio_adc {
|
struct gpio_adc {
|
||||||
|
#ifdef CONFIG_MACH_LINUX_ODROIDC5
|
||||||
|
int scale;
|
||||||
|
int offset;
|
||||||
|
#endif
|
||||||
int fd;
|
int fd;
|
||||||
};
|
};
|
||||||
struct gpio_adc gpio_adc_setup(uint32_t pin);
|
struct gpio_adc gpio_adc_setup(uint32_t pin);
|
||||||
|
|||||||
@@ -172,9 +172,9 @@ stepper_event_full(struct timer *t)
|
|||||||
if (ret == SF_DONE || !timer_is_before(s->time.waketime, min_next_time))
|
if (ret == SF_DONE || !timer_is_before(s->time.waketime, min_next_time))
|
||||||
return ret;
|
return ret;
|
||||||
// Next step event is too close to the last unstep
|
// Next step event is too close to the last unstep
|
||||||
int32_t diff = s->time.waketime - min_next_time;
|
// int32_t diff = s->time.waketime - min_next_time;
|
||||||
if (diff < (int32_t)-timer_from_us(1000))
|
// if (diff < (int32_t)-timer_from_us(1000))
|
||||||
shutdown("Stepper too far in past");
|
// shutdown("Stepper too far in past");
|
||||||
reschedule_min:
|
reschedule_min:
|
||||||
s->time.waketime = min_next_time;
|
s->time.waketime = min_next_time;
|
||||||
return SF_RESCHEDULE;
|
return SF_RESCHEDULE;
|
||||||
|
|||||||
Reference in New Issue
Block a user