Adapted the MK2 3.0.11 firmware to the MK2 with the Einsy board.
This commit is contained in:
parent
b037416306
commit
e3c5a22986
|
|
@ -267,11 +267,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
|
|||
#define DISABLE_E false // For all extruders
|
||||
#define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled
|
||||
|
||||
#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true
|
||||
#define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false
|
||||
#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true
|
||||
#define INVERT_E0_DIR true // for direct drive extruder v9 set to true, for geared extruder set to false
|
||||
#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
|
||||
#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true
|
||||
#define INVERT_Y_DIR true // for Mendel set to true, for Orca set to false
|
||||
#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true
|
||||
#define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
|
||||
#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
|
||||
#define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false
|
||||
|
||||
// ENDSTOP SETTINGS:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,401 @@
|
|||
#ifndef CONFIGURATION_PRUSA_H
|
||||
#define CONFIGURATION_PRUSA_H
|
||||
|
||||
/*------------------------------------
|
||||
GENERAL SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Printer revision
|
||||
#define FILAMENT_SIZE "1_75mm_MK2"
|
||||
#define NOZZLE_TYPE "E3Dv6full"
|
||||
|
||||
// Developer flag
|
||||
#define DEVELOPER
|
||||
|
||||
// Printer name
|
||||
#define CUSTOM_MENDEL_NAME "Prusa i3 MK2"
|
||||
|
||||
// Electronics
|
||||
#define MOTHERBOARD BOARD_EINSY_1_0a
|
||||
|
||||
// Prusa Single extruder multiple material suport
|
||||
//#define SNMM
|
||||
|
||||
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)
|
||||
//#define E3D_PT100_EXTRUDER_WITH_AMP
|
||||
//#define E3D_PT100_EXTRUDER_NO_AMP
|
||||
//#define E3D_PT100_BED_WITH_AMP
|
||||
//#define E3D_PT100_BED_NO_AMP
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
AXIS SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Steps per unit {X,Y,Z,E}
|
||||
#ifdef SNMM
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140}
|
||||
#else
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3}
|
||||
#endif
|
||||
|
||||
|
||||
// Endstop inverting
|
||||
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
|
||||
// Home position
|
||||
#define MANUAL_X_HOME_POS 0
|
||||
#define MANUAL_Y_HOME_POS -2.2
|
||||
#define MANUAL_Z_HOME_POS 0.15
|
||||
|
||||
// Travel limits after homing
|
||||
#define X_MAX_POS 250
|
||||
#define X_MIN_POS 0
|
||||
#define Y_MAX_POS 210
|
||||
#define Y_MIN_POS -2.2
|
||||
#define Z_MAX_POS 210
|
||||
#define Z_MIN_POS 0.15
|
||||
|
||||
// Canceled home position
|
||||
#define X_CANCEL_POS 50
|
||||
#define Y_CANCEL_POS 190
|
||||
|
||||
//Pause print position
|
||||
#define X_PAUSE_POS 50
|
||||
#define Y_PAUSE_POS 190
|
||||
#define Z_PAUSE_LIFT 20
|
||||
|
||||
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
|
||||
#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min)
|
||||
|
||||
#define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec)
|
||||
#define DEFAULT_MAX_ACCELERATION {9000,9000,500,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.
|
||||
|
||||
#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
|
||||
#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts
|
||||
|
||||
|
||||
#define MANUAL_FEEDRATE {3000, 3000, 1000, 100} // set the speeds for manual moves (mm/min)
|
||||
|
||||
#define Z_AXIS_ALWAYS_ON 1
|
||||
|
||||
/*------------------------------------
|
||||
EXTRUDER SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Mintemps
|
||||
#define HEATER_0_MINTEMP 15
|
||||
#define HEATER_1_MINTEMP 5
|
||||
#define HEATER_2_MINTEMP 5
|
||||
#define BED_MINTEMP 15
|
||||
|
||||
// Maxtemps
|
||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
|
||||
#define HEATER_0_MAXTEMP 410
|
||||
#else
|
||||
#define HEATER_0_MAXTEMP 305
|
||||
#endif
|
||||
#define HEATER_1_MAXTEMP 305
|
||||
#define HEATER_2_MAXTEMP 305
|
||||
#define BED_MAXTEMP 150
|
||||
|
||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
|
||||
// Define PID constants for extruder with PT100
|
||||
#define DEFAULT_Kp 21.70
|
||||
#define DEFAULT_Ki 1.60
|
||||
#define DEFAULT_Kd 73.76
|
||||
#else
|
||||
// Define PID constants for extruder
|
||||
#define DEFAULT_Kp 40.925
|
||||
#define DEFAULT_Ki 4.875
|
||||
#define DEFAULT_Kd 86.085
|
||||
#endif
|
||||
|
||||
// Extrude mintemp
|
||||
#define EXTRUDE_MINTEMP 130
|
||||
|
||||
// Extruder cooling fans
|
||||
#define EXTRUDER_0_AUTO_FAN_PIN 8
|
||||
#define EXTRUDER_1_AUTO_FAN_PIN -1
|
||||
#define EXTRUDER_2_AUTO_FAN_PIN -1
|
||||
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
|
||||
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SNMM
|
||||
//#define BOWDEN_LENGTH 408
|
||||
#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu
|
||||
#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle
|
||||
#define FIL_COOLING 10 //length for cooling moves
|
||||
#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code
|
||||
#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming
|
||||
#endif //SNMM
|
||||
|
||||
//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
CHANGE FILAMENT SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Filament change configuration
|
||||
#define FILAMENTCHANGEENABLE
|
||||
#ifdef FILAMENTCHANGEENABLE
|
||||
#define FILAMENTCHANGE_XPOS 211
|
||||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70
|
||||
#define FILAMENTCHANGE_FINALFEED 50
|
||||
#define FILAMENTCHANGE_RECFEED 5
|
||||
|
||||
#define FILAMENTCHANGE_XYFEED 50
|
||||
#define FILAMENTCHANGE_EFEED 20
|
||||
#define FILAMENTCHANGE_RFEED 400
|
||||
#define FILAMENTCHANGE_EXFEED 2
|
||||
#define FILAMENTCHANGE_ZFEED 15
|
||||
|
||||
#endif
|
||||
|
||||
/*------------------------------------
|
||||
ADDITIONAL FEATURES SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Define Prusa filament runout sensor
|
||||
//#define FILAMENT_RUNOUT_SUPPORT
|
||||
|
||||
#ifdef FILAMENT_RUNOUT_SUPPORT
|
||||
#define FILAMENT_RUNOUT_SENSOR 1
|
||||
#endif
|
||||
|
||||
// temperature runaway
|
||||
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
|
||||
#define TEMP_RUNAWAY_BED_TIMEOUT 360
|
||||
|
||||
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
|
||||
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45
|
||||
|
||||
/*------------------------------------
|
||||
MOTOR CURRENT SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Motor Current setting for BIG RAMBo
|
||||
#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
|
||||
#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135}
|
||||
|
||||
// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range
|
||||
//#if MOTHERBOARD == 102 || MOTHERBOARD == 302
|
||||
#define MOTOR_CURRENT_PWM_RANGE 2000
|
||||
#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E}
|
||||
#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E}
|
||||
//#endif
|
||||
|
||||
/*------------------------------------
|
||||
BED SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Define Mesh Bed Leveling system to enable it
|
||||
#define MESH_BED_LEVELING
|
||||
#ifdef MESH_BED_LEVELING
|
||||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 35
|
||||
#define MESH_MAX_X 238
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 202
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
// Mesh measure definition
|
||||
#define MESH_MEAS_NUM_X_POINTS 3
|
||||
#define MESH_MEAS_NUM_Y_POINTS 3
|
||||
|
||||
#define MESH_HOME_Z_CALIB 0.2
|
||||
#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc.
|
||||
|
||||
#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right
|
||||
#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind
|
||||
#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!)
|
||||
#endif
|
||||
|
||||
// Bed Temperature Control
|
||||
// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
|
||||
//
|
||||
// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
|
||||
// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
|
||||
// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
|
||||
// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
|
||||
// If your configuration is significantly different than this and you don't understand the issues involved, you probably
|
||||
// shouldn't use bed PID until someone else verifies your hardware works.
|
||||
// If this is enabled, find your own PID constants below.
|
||||
#define PIDTEMPBED
|
||||
//
|
||||
//#define BED_LIMIT_SWITCHING
|
||||
|
||||
// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
|
||||
// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
|
||||
// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
|
||||
// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED)
|
||||
#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
|
||||
|
||||
// Bed temperature compensation settings
|
||||
#define BED_OFFSET 10
|
||||
#define BED_OFFSET_START 40
|
||||
#define BED_OFFSET_CENTER 50
|
||||
|
||||
|
||||
#ifdef PIDTEMPBED
|
||||
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
|
||||
#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP)
|
||||
// Define PID constants for extruder with PT100
|
||||
#define DEFAULT_bedKp 21.70
|
||||
#define DEFAULT_bedKi 1.60
|
||||
#define DEFAULT_bedKd 73.76
|
||||
#else
|
||||
#define DEFAULT_bedKp 126.13
|
||||
#define DEFAULT_bedKi 4.30
|
||||
#define DEFAULT_bedKd 924.76
|
||||
#endif
|
||||
|
||||
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||
//from pidautotune
|
||||
// #define DEFAULT_bedKp 97.1
|
||||
// #define DEFAULT_bedKi 1.41
|
||||
// #define DEFAULT_bedKd 1675.16
|
||||
|
||||
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
|
||||
#endif // PIDTEMPBED
|
||||
|
||||
|
||||
/*-----------------------------------
|
||||
PREHEAT SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
#define PLA_PREHEAT_HOTEND_TEMP 215
|
||||
#define PLA_PREHEAT_HPB_TEMP 55
|
||||
#define PLA_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define ABS_PREHEAT_HOTEND_TEMP 255
|
||||
#define ABS_PREHEAT_HPB_TEMP 100
|
||||
#define ABS_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define HIPS_PREHEAT_HOTEND_TEMP 220
|
||||
#define HIPS_PREHEAT_HPB_TEMP 100
|
||||
#define HIPS_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define PP_PREHEAT_HOTEND_TEMP 254
|
||||
#define PP_PREHEAT_HPB_TEMP 100
|
||||
#define PP_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define PET_PREHEAT_HOTEND_TEMP 240
|
||||
#define PET_PREHEAT_HPB_TEMP 90
|
||||
#define PET_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define FLEX_PREHEAT_HOTEND_TEMP 230
|
||||
#define FLEX_PREHEAT_HPB_TEMP 50
|
||||
#define FLEX_PREHEAT_FAN_SPEED 0
|
||||
|
||||
/*------------------------------------
|
||||
THERMISTORS SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
//
|
||||
//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
|
||||
//
|
||||
//// Temperature sensor settings:
|
||||
// -2 is thermocouple with MAX6675 (only for sensor 0)
|
||||
// -1 is thermocouple with AD595
|
||||
// 0 is not used
|
||||
// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
|
||||
// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
|
||||
// 3 is Mendel-parts thermistor (4.7k pullup)
|
||||
// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
|
||||
// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
|
||||
// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
|
||||
// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
|
||||
// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
|
||||
// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
|
||||
// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
|
||||
// 10 is 100k RS thermistor 198-961 (4.7k pullup)
|
||||
// 11 is 100k beta 3950 1% thermistor (4.7k pullup)
|
||||
// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
|
||||
// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
|
||||
// 20 is the PT100 circuit found in the Ultimainboard V2.x
|
||||
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
||||
//
|
||||
// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
|
||||
// (but gives greater accuracy and more stable PID)
|
||||
// 51 is 100k thermistor - EPCOS (1k pullup)
|
||||
// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
|
||||
// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
|
||||
//
|
||||
// 1047 is Pt1000 with 4k7 pullup
|
||||
// 1010 is Pt1000 with 1k pullup (non standard)
|
||||
// 147 is Pt100 with 4k7 pullup
|
||||
// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a
|
||||
// 247 is Pt100 with 4k7 pullup and PT100 Amplifier
|
||||
// 110 is Pt100 with 1k pullup (non standard)
|
||||
|
||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP)
|
||||
#define TEMP_SENSOR_0 247
|
||||
#elif defined(E3D_PT100_EXTRUDER_NO_AMP)
|
||||
#define TEMP_SENSOR_0 148
|
||||
#else
|
||||
#define TEMP_SENSOR_0 5
|
||||
#endif
|
||||
#define TEMP_SENSOR_1 0
|
||||
#define TEMP_SENSOR_2 0
|
||||
#if defined(E3D_PT100_BED_WITH_AMP)
|
||||
#define TEMP_SENSOR_BED 247
|
||||
#elif defined(E3D_PT100_BED_NO_AMP)
|
||||
#define TEMP_SENSOR_BED 148
|
||||
#else
|
||||
#define TEMP_SENSOR_BED 1
|
||||
#endif
|
||||
|
||||
#define STACK_GUARD_TEST_VALUE 0xA2A2
|
||||
|
||||
#define MAX_BED_TEMP_CALIBRATION 50
|
||||
#define MAX_HOTEND_TEMP_CALIBRATION 50
|
||||
|
||||
#define MAX_E_STEPS_PER_UNIT 250
|
||||
#define MIN_E_STEPS_PER_UNIT 100
|
||||
|
||||
#define Z_BABYSTEP_MIN -3999
|
||||
#define Z_BABYSTEP_MAX 0
|
||||
|
||||
#define PINDA_PREHEAT_X 70
|
||||
#define PINDA_PREHEAT_Y -3
|
||||
#define PINDA_PREHEAT_Z 1
|
||||
#define PINDA_HEAT_T 120 //time in s
|
||||
|
||||
#define PINDA_MIN_T 50
|
||||
#define PINDA_STEP_T 10
|
||||
#define PINDA_MAX_T 100
|
||||
|
||||
#define PING_TIME 60 //time in s
|
||||
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes
|
||||
#define PING_ALLERT_PERIOD 60 //time in s
|
||||
|
||||
#define LONG_PRESS_TIME 1000 //time in ms for button long press
|
||||
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
|
||||
|
||||
#define PAUSE_RETRACT 1
|
||||
|
||||
#define DEFAULT_PID_TEMP 210
|
||||
|
||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
// Arduino build process:
|
||||
// https://www.arduino.cc/en/Hacking/BuildProcess
|
||||
"shell_cmd": "\"c:\\Program Files (x86)\\Arduino\\arduino_debug.exe\" --pref build.path=..\\output --verify --board marlinAddon:avr:rambo -v --preserve-temp-files Firmware.ino"
|
||||
"shell_cmd": "\"D:\\bin\\arduino-1.6.8\\arduino_debug.exe\" --pref build.path=..\\output --verify --board marlin:avr:rambo -v --preserve-temp-files Firmware.ino"
|
||||
},
|
||||
{
|
||||
"name": "compile & upload",
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
// avrdude -F -v -pm168 -cstk500v1 -P\\.\COM4 -b19200 -D -Uflash:w:"file.hex":i
|
||||
// may need add path to avrdude config file: -C"c:\utils\arduino-0016\hardware\tools\avr\etc\avrdude.conf" if Arduino IDE installed in "c:\utils\arduino-0016\"
|
||||
// https://typeunsafe.wordpress.com/2011/07/22/programming-arduino-with-avrdude/
|
||||
"shell_cmd": "\"c:\\Program Files (x86)\\Arduino\\arduino_debug.exe\" --pref build.path=..\\output --upload --port COM9 --board marlinAddon:avr:rambo -v --preserve-temp-files Firmware.ino"
|
||||
"shell_cmd": "\"D:\\bin\\arduino-1.6.8\\arduino_debug.exe\" --pref build.path=..\\output --upload --port COM19 --board marlin:avr:rambo -v --preserve-temp-files Firmware.ino"
|
||||
},
|
||||
{
|
||||
"name": "map-data",
|
||||
|
|
@ -27,25 +27,25 @@
|
|||
// https://sourceware.org/binutils/docs-2.21/binutils/objdump.html
|
||||
// Maybe it is better to generate map files by the linker?
|
||||
// avr-gcc -g -mmcu=atmega8 -Wl,-Map,demo.map -o demo.elf demo.o
|
||||
"shell_cmd": "\"c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -x -S -C -j .data ..\\output\\Firmware.ino.elf > ..\\output\\Firmware-data.map"
|
||||
"shell_cmd": "\"D:\\bin\\arduino-1.6.8\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -x -S -C -j .data ..\\output\\Firmware.ino.elf > ..\\output\\Firmware-data.map"
|
||||
},
|
||||
{
|
||||
"name": "map-bss",
|
||||
"working_dir": "$project_path",
|
||||
// https://sourceware.org/binutils/docs-2.21/binutils/objdump.html
|
||||
"shell_cmd": "\"c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -x -S -C -j .bss ..\\output\\Firmware.ino.elf > ..\\output\\Firmware-bss.map"
|
||||
"shell_cmd": "\"D:\\bin\\arduino-1.6.8\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -x -S -C -j .bss ..\\output\\Firmware.ino.elf > ..\\output\\Firmware-bss.map"
|
||||
},
|
||||
{
|
||||
"name": "map-all",
|
||||
"working_dir": "$project_path",
|
||||
// https://sourceware.org/binutils/docs-2.21/binutils/objdump.html
|
||||
"shell_cmd": "\"c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -x -S -C ..\\output\\Firmware.ino.elf > ..\\output\\Firmware-all.map"
|
||||
"shell_cmd": "\"D:\\bin\\arduino-1.6.8\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -x -S -C ..\\output\\Firmware.ino.elf > ..\\output\\Firmware-all.map"
|
||||
},
|
||||
{
|
||||
"name": "disassemble",
|
||||
"working_dir": "$project_path",
|
||||
// https://sourceware.org/binutils/docs-2.21/binutils/objdump.html
|
||||
"shell_cmd": "\"c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -h -w -S ..\\output\\Firmware.ino.elf > ..\\output\\Firmware.asm"
|
||||
"shell_cmd": "\"D:\\bin\\arduino-1.6.8\\hardware\\tools\\avr\\bin\\avr-objdump.exe\" -h -w -S ..\\output\\Firmware.ino.elf > ..\\output\\Firmware.asm"
|
||||
}
|
||||
],
|
||||
"folders":
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@
|
|||
#include "pins_arduino.h"
|
||||
#include "math.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "tmc2130.h"
|
||||
#include "spi.h"
|
||||
|
||||
#ifdef BLINKM
|
||||
#include "BlinkM.h"
|
||||
|
|
@ -990,6 +991,19 @@ void factory_reset(char level, bool quiet)
|
|||
// are initialized by the main() routine provided by the Arduino framework.
|
||||
void setup()
|
||||
{
|
||||
WRITE(X_TMC2130_CS, HIGH);
|
||||
WRITE(Y_TMC2130_CS, HIGH);
|
||||
WRITE(Z_TMC2130_CS, HIGH);
|
||||
WRITE(E0_TMC2130_CS, HIGH);
|
||||
SET_OUTPUT(X_TMC2130_CS);
|
||||
SET_OUTPUT(Y_TMC2130_CS);
|
||||
SET_OUTPUT(Z_TMC2130_CS);
|
||||
SET_OUTPUT(E0_TMC2130_CS);
|
||||
SET_INPUT(X_TMC2130_DIAG);
|
||||
SET_INPUT(Y_TMC2130_DIAG);
|
||||
SET_INPUT(Z_TMC2130_DIAG);
|
||||
SET_INPUT(E0_TMC2130_DIAG);
|
||||
|
||||
setup_killpin();
|
||||
setup_powerhold();
|
||||
MYSERIAL.begin(BAUDRATE);
|
||||
|
|
@ -1046,7 +1060,26 @@ void setup()
|
|||
tp_init(); // Initialize temperature loop
|
||||
plan_init(); // Initialize planner;
|
||||
watchdog_init();
|
||||
|
||||
#ifdef TMC2130_LINEARITY_CORRECTION
|
||||
tmc2130_wave_fac[E_AXIS] = eeprom_read_word((uint16_t*)EEPROM_TMC2130_WAVE_E_FAC);
|
||||
if (tmc2130_wave_fac[X_AXIS] == 0xff) tmc2130_wave_fac[X_AXIS] = 0;
|
||||
if (tmc2130_wave_fac[Y_AXIS] == 0xff) tmc2130_wave_fac[Y_AXIS] = 0;
|
||||
if (tmc2130_wave_fac[Z_AXIS] == 0xff) tmc2130_wave_fac[Z_AXIS] = 0;
|
||||
if (tmc2130_wave_fac[E_AXIS] == 0xff) tmc2130_wave_fac[E_AXIS] = 0;
|
||||
#endif //TMC2130_LINEARITY_CORRECTION
|
||||
|
||||
tmc2130_mres[X_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY);
|
||||
tmc2130_mres[Y_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY);
|
||||
tmc2130_mres[Z_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_Z);
|
||||
tmc2130_mres[E_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_E);
|
||||
|
||||
spi_init();
|
||||
st_init(); // Initialize stepper, this enables interrupts!
|
||||
|
||||
tmc2130_mode = TMC2130_MODE_NORMAL;
|
||||
tmc2130_init();
|
||||
|
||||
setup_photpin();
|
||||
servo_init();
|
||||
// Reset the machine correction matrix.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#define BOARD_RAMBO 301 // Rambo
|
||||
#define BOARD_RAMBO_MINI_1_3 302 // Rambo-mini 1.3
|
||||
#define BOARD_RAMBO_MINI_1_0 102 // Rambo-mini 1.0
|
||||
#define BOARD_EINSY_1_0a 310 // EINSy 1.0a - 310 (new)
|
||||
|
||||
|
||||
#define BOARD_99 99 // This is in pins.h but...?
|
||||
|
|
|
|||
302
Firmware/pins.h
302
Firmware/pins.h
|
|
@ -22,302 +22,18 @@
|
|||
/*****************************************************************
|
||||
* Rambo Pin Assignments 1.3
|
||||
******************************************************************/
|
||||
#if MOTHERBOARD == 302
|
||||
#define MINI_RAMBO
|
||||
|
||||
#endif
|
||||
#if MOTHERBOARD == 301 || MOTHERBOARD == 302
|
||||
#define KNOWN_BOARD
|
||||
#ifndef __AVR_ATmega2560__
|
||||
#error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
|
||||
#endif
|
||||
|
||||
|
||||
#define FR_SENS 21
|
||||
|
||||
|
||||
#define X_STEP_PIN 37
|
||||
#define X_DIR_PIN 48
|
||||
#define X_MIN_PIN 12
|
||||
#define X_MAX_PIN 30
|
||||
#define X_ENABLE_PIN 29
|
||||
#define X_MS1_PIN 40
|
||||
#define X_MS2_PIN 41
|
||||
#define Y_STEP_PIN 36
|
||||
#define Y_DIR_PIN 49
|
||||
#define Y_MIN_PIN 11
|
||||
#define Y_MAX_PIN 24
|
||||
#define Y_ENABLE_PIN 28
|
||||
#define Y_MS1_PIN 69
|
||||
#define Y_MS2_PIN 39
|
||||
#define Z_STEP_PIN 35
|
||||
#define Z_DIR_PIN 47
|
||||
#define Z_MIN_PIN 10
|
||||
#define Z_MAX_PIN 23
|
||||
#define Z_ENABLE_PIN 27
|
||||
#define Z_MS1_PIN 68
|
||||
#define Z_MS2_PIN 67
|
||||
#define TEMP_BED_PIN 2
|
||||
#define TEMP_0_PIN 0
|
||||
#define HEATER_1_PIN 7
|
||||
#define TEMP_1_PIN 1
|
||||
#define TEMP_2_PIN -1
|
||||
|
||||
#ifdef SNMM
|
||||
|
||||
#define E_MUX0_PIN 17
|
||||
#define E_MUX1_PIN 16
|
||||
#define E_MUX2_PIN 84
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DIS
|
||||
#define D_REQUIRE 30
|
||||
#define D_DATA 20
|
||||
#define D_DATACLOCK 21
|
||||
|
||||
#endif
|
||||
|
||||
// The SDSS pin uses a different pin mapping from file Sd2PinMap.h
|
||||
#define SDSS 53
|
||||
|
||||
#ifndef SDSUPPORT
|
||||
// these pins are defined in the SD library if building with SD support
|
||||
#define SCK_PIN 52
|
||||
#define MISO_PIN 50
|
||||
#define MOSI_PIN 51
|
||||
#endif
|
||||
|
||||
#define BEEPER 84
|
||||
|
||||
#define BTN_EN1 72
|
||||
#define BTN_EN2 14
|
||||
#define BTN_ENC 9
|
||||
|
||||
#define SDCARDDETECT 15
|
||||
|
||||
#define LCD_PINS_RS 82
|
||||
#define LCD_PINS_ENABLE 18
|
||||
#define LCD_PINS_D4 19
|
||||
#define LCD_PINS_D5 70
|
||||
#define LCD_PINS_D6 85
|
||||
#define LCD_PINS_D7 71
|
||||
|
||||
|
||||
|
||||
#define E0_STEP_PIN 34
|
||||
#define E0_DIR_PIN 43
|
||||
#define E0_ENABLE_PIN 26
|
||||
#define E0_MS1_PIN 65
|
||||
#define E0_MS2_PIN 66
|
||||
#define LED_PIN 13
|
||||
#ifdef THREEMM_PRINTER
|
||||
#define FAN_PIN 8
|
||||
#else
|
||||
#define FAN_PIN 6
|
||||
#endif
|
||||
#define KILL_PIN -1 //80 with Smart Controller LCD
|
||||
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
|
||||
#define SDPOWER -1
|
||||
#define HEATER_2_PIN -1
|
||||
#ifdef MINI_RAMBO
|
||||
|
||||
#define ELECTRONICS "RAMBo13a"
|
||||
|
||||
#define HEATER_0_PIN 3
|
||||
#define HEATER_BED_PIN 4
|
||||
#define FAN_1_PIN -1 //6
|
||||
#define PS_ON_PIN 71
|
||||
#define MOTOR_CURRENT_PWM_XY_PIN 46
|
||||
#define MOTOR_CURRENT_PWM_Z_PIN 45
|
||||
#define MOTOR_CURRENT_PWM_E_PIN 44
|
||||
|
||||
#else //RAMBo
|
||||
#define ELECTRONICS "RAMBoBig"
|
||||
|
||||
#define E1_STEP_PIN 33
|
||||
#define E1_DIR_PIN 42
|
||||
#define E1_ENABLE_PIN 25
|
||||
#define E1_MS1_PIN 63
|
||||
#define E1_MS2_PIN 64
|
||||
#define DIGIPOTSS_PIN 38
|
||||
#define DIGIPOT_CHANNELS {4,5,3,0,1} // X Y Z E0 E1 digipot channels to stepper driver mapping
|
||||
#define HEATER_0_PIN 9
|
||||
#define HEATER_BED_PIN 3
|
||||
#define PS_ON_PIN 4
|
||||
#define SDSS 53
|
||||
#ifdef ULTRA_LCD
|
||||
#define KILL_PIN 80
|
||||
#ifdef NEWPANEL
|
||||
//arduino pin which triggers an piezzo beeper
|
||||
#define BEEPER 84 // Beeper on AUX-4
|
||||
#define LCD_PINS_RS 82
|
||||
#define LCD_PINS_ENABLE 18
|
||||
#define LCD_PINS_D4 19
|
||||
#define LCD_PINS_D5 70
|
||||
#define LCD_PINS_D6 85
|
||||
#define LCD_PINS_D7 71
|
||||
//buttons are directly attached using AUX-2
|
||||
#define BTN_EN1 76
|
||||
#define BTN_EN2 77
|
||||
#define BTN_ENC 78 //the click
|
||||
#define BLEN_C 2
|
||||
#define BLEN_B 1
|
||||
#define BLEN_A 0
|
||||
#define SDCARDDETECT 81 // Ramps does not use this port
|
||||
//encoder rotation values
|
||||
#define encrot0 0
|
||||
#define encrot1 2
|
||||
#define encrot2 3
|
||||
#define encrot3 1
|
||||
#else //old style panel with shift register
|
||||
//arduino pin witch triggers an piezzo beeper
|
||||
#define BEEPER 84 //No Beeper added
|
||||
//buttons are attached to a shift register
|
||||
// Not wired this yet
|
||||
// #define SHIFT_CLK 38
|
||||
// #define SHIFT_LD 42
|
||||
// #define SHIFT_OUT 40
|
||||
// #define SHIFT_EN 17
|
||||
#define LCD_PINS_RS 82
|
||||
#define LCD_PINS_ENABLE 18
|
||||
#define LCD_PINS_D4 19
|
||||
#define LCD_PINS_D5 70
|
||||
#define LCD_PINS_D6 85
|
||||
#define LCD_PINS_D7 71
|
||||
//encoder rotation values
|
||||
#define encrot0 0
|
||||
#define encrot1 2
|
||||
#define encrot2 3
|
||||
#define encrot3 1
|
||||
//bits in the shift register that carry the buttons for:
|
||||
// left up center down right red
|
||||
#define BL_LE 7
|
||||
#define BL_UP 6
|
||||
#define BL_MI 5
|
||||
#define BL_DW 4
|
||||
#define BL_RI 3
|
||||
#define BL_ST 2
|
||||
#define BLEN_B 1
|
||||
#define BLEN_A 0
|
||||
#endif
|
||||
#endif //ULTRA_LCD
|
||||
#endif //RAMBo/MiniRambo option
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* Rambo mini Pin Assignments 1.0
|
||||
******************************************************************/
|
||||
#if MOTHERBOARD == 102
|
||||
#define ELECTRONICS "RAMBo10a"
|
||||
#define KNOWN_BOARD
|
||||
#ifndef __AVR_ATmega2560__
|
||||
#error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
|
||||
#endif
|
||||
|
||||
#define FR_SENS 21
|
||||
|
||||
#ifdef SNMM
|
||||
|
||||
#define E_MUX0_PIN 17
|
||||
#define E_MUX1_PIN 16
|
||||
#define E_MUX2_PIN 84
|
||||
|
||||
|
||||
#endif
|
||||
#define LARGE_FLASH true
|
||||
#define X_STEP_PIN 37
|
||||
#define X_DIR_PIN 48
|
||||
#define X_MIN_PIN 12
|
||||
#define X_MAX_PIN 30
|
||||
#define X_ENABLE_PIN 29
|
||||
#define X_MS1_PIN 40
|
||||
#define X_MS2_PIN 41
|
||||
#define Y_STEP_PIN 36
|
||||
#define Y_DIR_PIN 49
|
||||
#define Y_MIN_PIN 11
|
||||
#define Y_MAX_PIN 24
|
||||
#define Y_ENABLE_PIN 28
|
||||
#define Y_MS1_PIN 69
|
||||
#define Y_MS2_PIN 39
|
||||
#define Z_STEP_PIN 35
|
||||
#define Z_DIR_PIN 47
|
||||
#define Z_MIN_PIN 10
|
||||
#define Z_MAX_PIN 23
|
||||
#define Z_ENABLE_PIN 27
|
||||
#define Z_MS1_PIN 68
|
||||
#define Z_MS2_PIN 67
|
||||
#define TEMP_BED_PIN 2
|
||||
#define TEMP_0_PIN 0
|
||||
#define HEATER_1_PIN 7
|
||||
#define TEMP_1_PIN 1
|
||||
#define TEMP_2_PIN -1
|
||||
|
||||
// The SDSS pin uses a different pin mapping from file Sd2PinMap.h
|
||||
#define SDSS 53
|
||||
|
||||
#ifndef SDSUPPORT
|
||||
// these pins are defined in the SD library if building with SD support
|
||||
#define SCK_PIN 52
|
||||
#define MISO_PIN 50
|
||||
#define MOSI_PIN 51
|
||||
#endif
|
||||
|
||||
#define BEEPER 78
|
||||
|
||||
#define BTN_EN1 80
|
||||
#define BTN_EN2 73
|
||||
#define BTN_ENC 21
|
||||
|
||||
#define SDCARDDETECT 72
|
||||
|
||||
#define LCD_PINS_RS 38
|
||||
#define LCD_PINS_ENABLE 5
|
||||
#define LCD_PINS_D4 14
|
||||
#define LCD_PINS_D5 15
|
||||
#define LCD_PINS_D6 32
|
||||
#define LCD_PINS_D7 31
|
||||
|
||||
|
||||
|
||||
#define E0_STEP_PIN 34
|
||||
#define E0_DIR_PIN 43
|
||||
#define E0_ENABLE_PIN 26
|
||||
#define E0_MS1_PIN 65
|
||||
#define E0_MS2_PIN 66
|
||||
#define LED_PIN 13
|
||||
#ifdef THREEMM_PRINTER
|
||||
#define FAN_PIN 8
|
||||
#else
|
||||
#define FAN_PIN 6
|
||||
#endif
|
||||
#define KILL_PIN -1 //80 with Smart Controller LCD
|
||||
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
|
||||
#define SDPOWER -1
|
||||
#define HEATER_2_PIN -1
|
||||
|
||||
#define HEATER_0_PIN 3
|
||||
#define HEATER_BED_PIN 4
|
||||
#define FAN_1_PIN -1 //6
|
||||
#define PS_ON_PIN 71
|
||||
#define MOTOR_CURRENT_PWM_XY_PIN 46
|
||||
#define MOTOR_CURRENT_PWM_Z_PIN 45
|
||||
#define MOTOR_CURRENT_PWM_E_PIN 44
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if MOTHERBOARD == BOARD_RAMBO_MINI_1_0 //200 - orig 102
|
||||
#include "pins_Rambo_1_0.h"
|
||||
#endif //MOTHERBOARD == BOARD_RAMBO_MINI_1_0
|
||||
|
||||
#if MOTHERBOARD == BOARD_RAMBO_MINI_1_3 //203 - orig 302
|
||||
#include "pins_Rambo_1_3.h"
|
||||
#endif //MOTHERBOARD == BOARD_RAMBO_MINI_1_3
|
||||
|
||||
#if MOTHERBOARD == BOARD_EINSY_1_0a //310 - new
|
||||
#include "pins_Einsy_1_0.h"
|
||||
#endif //MOTHERBOARD == BOARD_EINSY_1_0a
|
||||
|
||||
#ifndef KNOWN_BOARD
|
||||
#error Unknown MOTHERBOARD value in configuration.h
|
||||
|
|
|
|||
|
|
@ -0,0 +1,166 @@
|
|||
/*****************************************************************
|
||||
* EINSY Rambo 1.0a Pin Assignments
|
||||
******************************************************************/
|
||||
|
||||
#define ELECTRONICS "EINSy_10a"
|
||||
|
||||
#define KNOWN_BOARD
|
||||
#ifndef __AVR_ATmega2560__
|
||||
#error Oops! Make sure you have 'Arduino Mega 2560 or Rambo' selected from the 'Tools -> Boards' menu.
|
||||
#endif
|
||||
|
||||
#define TMC2130
|
||||
#define UVLO_SUPPORT
|
||||
|
||||
#define AMBIENT_THERMISTOR
|
||||
#define PINDA_THERMISTOR
|
||||
|
||||
|
||||
#define SWI2C // enable software i2c
|
||||
#define SWI2C_A8 // 8bit address functions
|
||||
|
||||
#define PAT9125_SWI2C
|
||||
#define PAT9125_SWI2C_SDA 20 //SDA on P3
|
||||
#define PAT9125_SWI2C_SCL 21 //SCL on P3
|
||||
#define PAT9125_SWI2C_CFG 0xb1 //2us clock delay, 2048 cycles timeout
|
||||
|
||||
//#define PAT9125_HWI2C
|
||||
|
||||
#define X_TMC2130_CS 41
|
||||
#define X_TMC2130_DIAG 64 // !!! changed from 40 (EINY03)
|
||||
#define X_STEP_PIN 37
|
||||
#define X_DIR_PIN 49
|
||||
#define X_MIN_PIN 12
|
||||
//#define X_MAX_PIN 30
|
||||
//#define X_MIN_PIN X_TMC2130_DIAG
|
||||
#define X_MAX_PIN X_TMC2130_DIAG
|
||||
#define X_ENABLE_PIN 29
|
||||
#define X_MS1_PIN -1
|
||||
#define X_MS2_PIN -1
|
||||
|
||||
#define Y_TMC2130_CS 39
|
||||
#define Y_TMC2130_DIAG 69
|
||||
#define Y_STEP_PIN 36
|
||||
#define Y_DIR_PIN 48
|
||||
#define Y_MIN_PIN 11
|
||||
//#define Y_MAX_PIN 24
|
||||
//#define Y_MIN_PIN Y_TMC2130_DIAG
|
||||
#define Y_MAX_PIN Y_TMC2130_DIAG
|
||||
#define Y_ENABLE_PIN 28
|
||||
#define Y_MS1_PIN -1
|
||||
#define Y_MS2_PIN -1
|
||||
|
||||
#define Z_TMC2130_CS 67
|
||||
#define Z_TMC2130_DIAG 68
|
||||
#define Z_STEP_PIN 35
|
||||
#define Z_DIR_PIN 47
|
||||
#define Z_MIN_PIN 10
|
||||
#define Z_MAX_PIN 23
|
||||
//#define Z_MAX_PIN Z_TMC2130_DIAG
|
||||
#define Z_ENABLE_PIN 27
|
||||
#define Z_MS1_PIN -1
|
||||
#define Z_MS2_PIN -1
|
||||
|
||||
#define HEATER_BED_PIN 4 //PG5
|
||||
#define TEMP_BED_PIN 2 //A2
|
||||
|
||||
#define HEATER_0_PIN 3 //PE5
|
||||
#define TEMP_0_PIN 0 //A0
|
||||
|
||||
#define HEATER_1_PIN -1
|
||||
#define TEMP_1_PIN 1 //A1
|
||||
|
||||
#define HEATER_2_PIN -1
|
||||
#define TEMP_2_PIN -1
|
||||
|
||||
#define TEMP_AMBIENT_PIN 5 //A5
|
||||
|
||||
#define TEMP_PINDA_PIN 3 //A3
|
||||
|
||||
#define VOLT_PWR_PIN 4 //A4
|
||||
#define VOLT_BED_PIN 9 //A9
|
||||
|
||||
|
||||
#define E0_TMC2130_CS 66
|
||||
#define E0_TMC2130_DIAG 65
|
||||
#define E0_STEP_PIN 34
|
||||
#define E0_DIR_PIN 43
|
||||
#define E0_ENABLE_PIN 26
|
||||
#define E0_MS1_PIN -1
|
||||
#define E0_MS2_PIN -1
|
||||
|
||||
#define SDPOWER -1
|
||||
#define SDSS 77
|
||||
#define LED_PIN 13
|
||||
#define FAN_PIN 6
|
||||
#define FAN_1_PIN -1
|
||||
#define PS_ON_PIN -1
|
||||
#define KILL_PIN -1 // 80 with Smart Controller LCD
|
||||
#define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing.
|
||||
|
||||
#ifdef ULTRA_LCD
|
||||
|
||||
//#define KILL_PIN 32
|
||||
|
||||
#ifdef NEWPANEL
|
||||
|
||||
//#define LCD_PWM_PIN -1//32 // lcd backlight brightnes pwm control pin
|
||||
//#define LCD_PWM_MAX 0x0f // lcd pwm maximum value (0x07=64Hz, 0x0f=32Hz, 0x1f=16Hz)
|
||||
|
||||
#define BEEPER 84 // Beeper on AUX-4
|
||||
#define LCD_PINS_RS 82
|
||||
#define LCD_PINS_ENABLE 61 // !!! changed from 18 (EINY03)
|
||||
#define LCD_PINS_D4 59 // !!! changed from 19 (EINY03)
|
||||
#define LCD_PINS_D5 70
|
||||
#define LCD_PINS_D6 85
|
||||
#define LCD_PINS_D7 71
|
||||
|
||||
//buttons are directly attached using AUX-2
|
||||
#define BTN_EN1 72
|
||||
#define BTN_EN2 14
|
||||
#define BTN_ENC 9 // the click
|
||||
|
||||
#define SDCARDDETECT 15
|
||||
|
||||
#define TACH_0 79 // !!! changed from 81 (EINY03)
|
||||
#define TACH_1 80
|
||||
|
||||
#endif //NEWPANEL
|
||||
#endif //ULTRA_LCD
|
||||
|
||||
// Support for an 8 bit logic analyzer, for example the Saleae.
|
||||
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.
|
||||
#define LOGIC_ANALYZER_CH0 X_MIN_PIN // PB6
|
||||
#define LOGIC_ANALYZER_CH1 Y_MIN_PIN // PB5
|
||||
#define LOGIC_ANALYZER_CH2 53 // PB0 (PROC_nCS)
|
||||
// Channels 3-7 are slow, they could generate
|
||||
// 0.889Mhz waveform with a software loop and interrupt locking,
|
||||
// 1.333MHz waveform without interrupt locking.
|
||||
#define LOGIC_ANALYZER_CH3 73 // PJ3
|
||||
// PK0 has no Arduino digital pin assigned, so we set it directly.
|
||||
#define WRITE_LOGIC_ANALYZER_CH4(value) if (value) PORTK |= (1 << 0); else PORTK &= ~(1 << 0) // PK0
|
||||
#define LOGIC_ANALYZER_CH5 16 // PH0 (RXD2)
|
||||
#define LOGIC_ANALYZER_CH6 17 // PH1 (TXD2)
|
||||
#define LOGIC_ANALYZER_CH7 76 // PJ5
|
||||
|
||||
#define LOGIC_ANALYZER_CH0_ENABLE do { SET_OUTPUT(LOGIC_ANALYZER_CH0); WRITE(LOGIC_ANALYZER_CH0, false); } while (0)
|
||||
#define LOGIC_ANALYZER_CH1_ENABLE do { SET_OUTPUT(LOGIC_ANALYZER_CH1); WRITE(LOGIC_ANALYZER_CH1, false); } while (0)
|
||||
#define LOGIC_ANALYZER_CH2_ENABLE do { SET_OUTPUT(LOGIC_ANALYZER_CH2); WRITE(LOGIC_ANALYZER_CH2, false); } while (0)
|
||||
#define LOGIC_ANALYZER_CH3_ENABLE do { SET_OUTPUT(LOGIC_ANALYZER_CH3); WRITE(LOGIC_ANALYZER_CH3, false); } while (0)
|
||||
#define LOGIC_ANALYZER_CH4_ENABLE do { DDRK |= 1 << 0; WRITE_LOGIC_ANALYZER_CH4(false); } while (0)
|
||||
#define LOGIC_ANALYZER_CH5_ENABLE do { cbi(UCSR2B, TXEN2); cbi(UCSR2B, RXEN2); cbi(UCSR2B, RXCIE2); SET_OUTPUT(LOGIC_ANALYZER_CH5); WRITE(LOGIC_ANALYZER_CH5, false); } while (0)
|
||||
#define LOGIC_ANALYZER_CH6_ENABLE do { cbi(UCSR2B, TXEN2); cbi(UCSR2B, RXEN2); cbi(UCSR2B, RXCIE2); SET_OUTPUT(LOGIC_ANALYZER_CH6); WRITE(LOGIC_ANALYZER_CH6, false); } while (0)
|
||||
#define LOGIC_ANALYZER_CH7_ENABLE do { SET_OUTPUT(LOGIC_ANALYZER_CH7); WRITE(LOGIC_ANALYZER_CH7, false); } while (0)
|
||||
|
||||
// Async output on channel 5 of the logical analyzer.
|
||||
// Baud rate 2MBit, 9 bits, 1 stop bit.
|
||||
#define LOGIC_ANALYZER_SERIAL_TX_ENABLE do { UBRR2H = 0; UBRR2L = 0; UCSR2B = (1 << TXEN2) | (1 << UCSZ02); UCSR2C = 0x06; } while (0)
|
||||
// Non-checked (quicker) variant. Use it if you are sure that the transmit buffer is already empty.
|
||||
#define LOGIC_ANALYZER_SERIAL_TX_WRITE_NC(C) do { if (C & 0x100) UCSR2B |= 1; else UCSR2B &= ~1; UDR2 = C; } while (0)
|
||||
#define LOGIC_ANALYZER_SERIAL_TX_WRITE(C) do { \
|
||||
/* Wait for empty transmit buffer */ \
|
||||
while (!(UCSR2A & (1<<UDRE2))); \
|
||||
/* Put data into buffer, sends the data */ \
|
||||
LOGIC_ANALYZER_SERIAL_TX_WRITE_NC(C); \
|
||||
} while (0)
|
||||
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
/*****************************************************************
|
||||
* Rambo mini 1.0 Pin Assignments
|
||||
******************************************************************/
|
||||
|
||||
#define ELECTRONICS "RAMBo10a"
|
||||
|
||||
#define KNOWN_BOARD
|
||||
#ifndef __AVR_ATmega2560__
|
||||
#error Oops! Make sure you have 'Arduino Mega 2560 or Rambo' selected from the 'Tools -> Boards' menu.
|
||||
#endif
|
||||
|
||||
#define PINDA_THERMISTOR
|
||||
|
||||
#define SWI2C // enable software i2c
|
||||
#define SWI2C_A8 // 8bit address functions
|
||||
|
||||
#define PAT9125_SWI2C
|
||||
#define PAT9125_SWI2C_SDA 20 //SDA on P3
|
||||
#define PAT9125_SWI2C_SCL 21 //SCL on P3
|
||||
#define PAT9125_SWI2C_CFG 0xb1 //2us clock delay, 2048 cycles timeout
|
||||
|
||||
//#define PAT9125_HWI2C
|
||||
|
||||
#define X_STEP_PIN 37
|
||||
#define X_DIR_PIN 48
|
||||
#define X_MIN_PIN 12
|
||||
#define X_MAX_PIN -1
|
||||
#define X_ENABLE_PIN 29
|
||||
#define X_MS1_PIN 40
|
||||
#define X_MS2_PIN 41
|
||||
|
||||
#define Y_STEP_PIN 36
|
||||
#define Y_DIR_PIN 49
|
||||
#define Y_MIN_PIN 11
|
||||
#define Y_MAX_PIN -1
|
||||
#define Y_ENABLE_PIN 28
|
||||
#define Y_MS1_PIN 69
|
||||
#define Y_MS2_PIN 39
|
||||
|
||||
#define Z_STEP_PIN 35
|
||||
#define Z_DIR_PIN 47
|
||||
#define Z_MIN_PIN 10
|
||||
#define Z_MAX_PIN 23
|
||||
#define Z_ENABLE_PIN 27
|
||||
#define Z_MS1_PIN 68
|
||||
#define Z_MS2_PIN 67
|
||||
|
||||
#define HEATER_BED_PIN 4 //PG5
|
||||
#define TEMP_BED_PIN 2 //A2
|
||||
|
||||
#define HEATER_0_PIN 3 //PE5
|
||||
#define TEMP_0_PIN 0 //A0
|
||||
|
||||
#define HEATER_1_PIN -1
|
||||
#define TEMP_1_PIN -1 //A1
|
||||
|
||||
#define HEATER_2_PIN -1
|
||||
#define TEMP_2_PIN -1
|
||||
|
||||
#define TEMP_AMBIENT_PIN 6 //A6
|
||||
|
||||
#define TEMP_PINDA_PIN 1 //A1
|
||||
|
||||
|
||||
|
||||
#define E0_STEP_PIN 34
|
||||
#define E0_DIR_PIN 43
|
||||
#define E0_ENABLE_PIN 26
|
||||
#define E0_MS1_PIN 65
|
||||
#define E0_MS2_PIN 66
|
||||
|
||||
#ifdef SNMM
|
||||
#define E_MUX0_PIN 17
|
||||
#define E_MUX1_PIN 16
|
||||
#endif
|
||||
|
||||
|
||||
#define MOTOR_CURRENT_PWM_XY_PIN 46
|
||||
#define MOTOR_CURRENT_PWM_Z_PIN 45
|
||||
#define MOTOR_CURRENT_PWM_E_PIN 44
|
||||
#define SDPOWER -1
|
||||
#define SDSS 53
|
||||
#define LED_PIN 13
|
||||
#define FAN_PIN 6
|
||||
#define FAN_1_PIN -1
|
||||
#define PS_ON_PIN -1
|
||||
#define KILL_PIN -1 // 80 with Smart Controller LCD
|
||||
#define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing.
|
||||
#define TACH_0 30 // noctua extruder fan
|
||||
|
||||
#ifdef ULTRA_LCD
|
||||
|
||||
//#define KILL_PIN 32
|
||||
|
||||
#ifdef NEWPANEL
|
||||
|
||||
#define BEEPER 78 // Beeper on AUX-4
|
||||
#define LCD_PINS_RS 38
|
||||
#define LCD_PINS_ENABLE 5
|
||||
#define LCD_PINS_D4 14
|
||||
#define LCD_PINS_D5 15
|
||||
#define LCD_PINS_D6 32
|
||||
#define LCD_PINS_D7 31
|
||||
|
||||
//buttons are directly attached using AUX-2
|
||||
#define BTN_EN1 80
|
||||
#define BTN_EN2 73
|
||||
#define BTN_ENC 21 // the click
|
||||
|
||||
#define SDCARDDETECT 72
|
||||
|
||||
|
||||
#endif //NEWPANEL
|
||||
#endif //ULTRA_LCD
|
||||
|
||||
// Support for an 8 bit logic analyzer, for example the Saleae.
|
||||
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.
|
||||
#define LOGIC_ANALYZER_CH0 X_MIN_PIN // PB6
|
||||
#define LOGIC_ANALYZER_CH1 Y_MIN_PIN // PB5
|
||||
#define LOGIC_ANALYZER_CH2 53 // PB0 (PROC_nCS)
|
||||
// Channels 3-7 are slow, they could generate
|
||||
// 0.889Mhz waveform with a software loop and interrupt locking,
|
||||
// 1.333MHz waveform without interrupt locking.
|
||||
#define LOGIC_ANALYZER_CH3 73 // PJ3
|
||||
// PK0 has no Arduino digital pin assigned, so we set it directly.
|
||||
#define WRITE_LOGIC_ANALYZER_CH4(value) if (value) PORTK |= (1 << 0); else PORTK &= ~(1 << 0) // PK0
|
||||
#define LOGIC_ANALYZER_CH5 16 // PH0 (RXD2)
|
||||
#define LOGIC_ANALYZER_CH6 17 // PH1 (TXD2)
|
||||
#define LOGIC_ANALYZER_CH7 76 // PJ5
|
||||
|
||||
#define LOGIC_ANALYZER_CH0_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH0)
|
||||
#define LOGIC_ANALYZER_CH1_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH1)
|
||||
#define LOGIC_ANALYZER_CH2_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH2)
|
||||
#define LOGIC_ANALYZER_CH3_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH3)
|
||||
#define LOGIC_ANALYZER_CH4_ENABLE do { DDRK |= 1 << 0; } while (0)
|
||||
#define LOGIC_ANALYZER_CH5_ENABLE do { cbi(UCSR2B, TXEN2); cbi(UCSR2B, RXEN2); cbi(UCSR2B, RXCIE2); SET_OUTPUT(LOGIC_ANALYZER_CH5); } while (0)
|
||||
#define LOGIC_ANALYZER_CH6_ENABLE do { cbi(UCSR2B, TXEN2); cbi(UCSR2B, RXEN2); cbi(UCSR2B, RXCIE2); SET_OUTPUT(LOGIC_ANALYZER_CH6); } while (0)
|
||||
#define LOGIC_ANALYZER_CH7_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH7)
|
||||
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
/*****************************************************************
|
||||
* Rambo mini 1.3 Pin Assignments
|
||||
******************************************************************/
|
||||
|
||||
#define ELECTRONICS "RAMBo13a"
|
||||
|
||||
#define KNOWN_BOARD
|
||||
#ifndef __AVR_ATmega2560__
|
||||
#error Oops! Make sure you have 'Arduino Mega 2560 or Rambo' selected from the 'Tools -> Boards' menu.
|
||||
#endif
|
||||
|
||||
#define PINDA_THERMISTOR
|
||||
|
||||
#define SWI2C // enable software i2c
|
||||
#define SWI2C_A8 // 8bit address functions
|
||||
|
||||
#define PAT9125_SWI2C
|
||||
#define PAT9125_SWI2C_SDA 20 //SDA on P3
|
||||
#define PAT9125_SWI2C_SCL 21 //SCL on P3
|
||||
#define PAT9125_SWI2C_CFG 0xb1 //2us clock delay, 2048 cycles timeout
|
||||
|
||||
//#define PAT9125_HWI2C
|
||||
|
||||
#define X_STEP_PIN 37
|
||||
#define X_DIR_PIN 48
|
||||
#define X_MIN_PIN 12
|
||||
#define X_MAX_PIN -1
|
||||
#define X_ENABLE_PIN 29
|
||||
#define X_MS1_PIN 40
|
||||
#define X_MS2_PIN 41
|
||||
|
||||
#define Y_STEP_PIN 36
|
||||
#define Y_DIR_PIN 49
|
||||
#define Y_MIN_PIN 11
|
||||
#define Y_MAX_PIN -1
|
||||
#define Y_ENABLE_PIN 28
|
||||
#define Y_MS1_PIN 69
|
||||
#define Y_MS2_PIN 39
|
||||
|
||||
#define Z_STEP_PIN 35
|
||||
#define Z_DIR_PIN 47
|
||||
#define Z_MIN_PIN 10
|
||||
#define Z_MAX_PIN 23
|
||||
#define Z_ENABLE_PIN 27
|
||||
#define Z_MS1_PIN 68
|
||||
#define Z_MS2_PIN 67
|
||||
|
||||
#define HEATER_BED_PIN 4 //PG5
|
||||
#define TEMP_BED_PIN 2 //A2
|
||||
|
||||
#define HEATER_0_PIN 3 //PE5
|
||||
#define TEMP_0_PIN 0 //A0
|
||||
|
||||
#define HEATER_1_PIN -1
|
||||
#define TEMP_1_PIN -1 //A1
|
||||
|
||||
#define HEATER_2_PIN -1
|
||||
#define TEMP_2_PIN -1
|
||||
|
||||
#define TEMP_AMBIENT_PIN 6 //A6
|
||||
|
||||
#define TEMP_PINDA_PIN 1 //A1
|
||||
|
||||
|
||||
|
||||
#define E0_STEP_PIN 34
|
||||
#define E0_DIR_PIN 43
|
||||
#define E0_ENABLE_PIN 26
|
||||
#define E0_MS1_PIN 65
|
||||
#define E0_MS2_PIN 66
|
||||
|
||||
#ifdef SNMM
|
||||
#define E_MUX0_PIN 17
|
||||
#define E_MUX1_PIN 16
|
||||
#endif
|
||||
|
||||
|
||||
#define MOTOR_CURRENT_PWM_XY_PIN 46
|
||||
#define MOTOR_CURRENT_PWM_Z_PIN 45
|
||||
#define MOTOR_CURRENT_PWM_E_PIN 44
|
||||
#define SDPOWER -1
|
||||
#define SDSS 53
|
||||
#define LED_PIN 13
|
||||
#define FAN_PIN 6
|
||||
#define FAN_1_PIN -1
|
||||
#define PS_ON_PIN -1
|
||||
#define KILL_PIN -1 // 80 with Smart Controller LCD
|
||||
#define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing.
|
||||
#define TACH_0 30 // noctua extruder fan
|
||||
|
||||
#ifdef ULTRA_LCD
|
||||
|
||||
//#define KILL_PIN 32
|
||||
|
||||
#ifdef NEWPANEL
|
||||
|
||||
#define BEEPER 84 // Beeper on AUX-4
|
||||
#define LCD_PINS_RS 82
|
||||
#define LCD_PINS_ENABLE 18
|
||||
#define LCD_PINS_D4 19
|
||||
#define LCD_PINS_D5 70
|
||||
#define LCD_PINS_D6 85
|
||||
#define LCD_PINS_D7 71
|
||||
|
||||
//buttons are directly attached using AUX-2
|
||||
#define BTN_EN1 72
|
||||
#define BTN_EN2 14
|
||||
#define BTN_ENC 9 // the click
|
||||
|
||||
#define SDCARDDETECT 15
|
||||
|
||||
|
||||
#endif //NEWPANEL
|
||||
#endif //ULTRA_LCD
|
||||
|
||||
// Support for an 8 bit logic analyzer, for example the Saleae.
|
||||
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.
|
||||
#define LOGIC_ANALYZER_CH0 X_MIN_PIN // PB6
|
||||
#define LOGIC_ANALYZER_CH1 Y_MIN_PIN // PB5
|
||||
#define LOGIC_ANALYZER_CH2 53 // PB0 (PROC_nCS)
|
||||
// Channels 3-7 are slow, they could generate
|
||||
// 0.889Mhz waveform with a software loop and interrupt locking,
|
||||
// 1.333MHz waveform without interrupt locking.
|
||||
#define LOGIC_ANALYZER_CH3 73 // PJ3
|
||||
// PK0 has no Arduino digital pin assigned, so we set it directly.
|
||||
#define WRITE_LOGIC_ANALYZER_CH4(value) if (value) PORTK |= (1 << 0); else PORTK &= ~(1 << 0) // PK0
|
||||
#define LOGIC_ANALYZER_CH5 16 // PH0 (RXD2)
|
||||
#define LOGIC_ANALYZER_CH6 17 // PH1 (TXD2)
|
||||
#define LOGIC_ANALYZER_CH7 76 // PJ5
|
||||
|
||||
#define LOGIC_ANALYZER_CH0_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH0)
|
||||
#define LOGIC_ANALYZER_CH1_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH1)
|
||||
#define LOGIC_ANALYZER_CH2_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH2)
|
||||
#define LOGIC_ANALYZER_CH3_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH3)
|
||||
#define LOGIC_ANALYZER_CH4_ENABLE do { DDRK |= 1 << 0; } while (0)
|
||||
#define LOGIC_ANALYZER_CH5_ENABLE do { cbi(UCSR2B, TXEN2); cbi(UCSR2B, RXEN2); cbi(UCSR2B, RXCIE2); SET_OUTPUT(LOGIC_ANALYZER_CH5); } while (0)
|
||||
#define LOGIC_ANALYZER_CH6_ENABLE do { cbi(UCSR2B, TXEN2); cbi(UCSR2B, RXEN2); cbi(UCSR2B, RXCIE2); SET_OUTPUT(LOGIC_ANALYZER_CH6); } while (0)
|
||||
#define LOGIC_ANALYZER_CH7_ENABLE SET_OUTPUT(LOGIC_ANALYZER_CH7)
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
//spi.c - hardware SPI
|
||||
//#ifdef __SPI
|
||||
|
||||
#include "spi.h"
|
||||
#include <avr/io.h>
|
||||
|
||||
|
||||
//#endif //__SPI
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//spi.h - hardware SPI
|
||||
#ifndef SPI_H
|
||||
#define SPI_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
//TMC2130 - Trinamic stepper driver
|
||||
//pinout - hardcoded
|
||||
//spi:
|
||||
#define TMC2130_SPI_RATE 0 // fosc/4 = 4MHz
|
||||
#define TMC2130_SPCR SPI_SPCR(TMC2130_SPI_RATE, 1, 1, 1, 0)
|
||||
#define TMC2130_SPSR SPI_SPSR(TMC2130_SPI_RATE)
|
||||
|
||||
#define SPI_SPCR(rat, pha, pol, mst, dor) ((rat & 3) | (pha?(1<<CPHA):0) | (pol?(1<<CPOL):0) | (mst?(1<<MSTR):0) | (dor?(1<<DORD):0) | (1<<SPE))
|
||||
#define SPI_SPSR(rat) ((rat & 4)?(1<<SPI2X):0)
|
||||
|
||||
#define DD_SS 0
|
||||
#define DD_SCK 1
|
||||
#define DD_MOSI 2
|
||||
#define DD_MISO 3
|
||||
|
||||
inline void spi_init()
|
||||
{
|
||||
DDRB &= ~((1 << DD_SCK) | (1 << DD_MOSI) | (1 << DD_MISO));
|
||||
DDRB |= (1 << DD_SS) | (1 << DD_SCK) | (1 << DD_MOSI);
|
||||
PORTB &= ~((1 << DD_SCK) | (1 << DD_MOSI) | (1 << DD_MISO));
|
||||
PORTB |= (1 << DD_SS);
|
||||
SPCR = SPI_SPCR(0, 0, 0, 1, 0); //SPE=1, MSTR=1 (0x50)
|
||||
SPSR = 0x00;
|
||||
}
|
||||
|
||||
inline void spi_setup(uint8_t spcr, uint8_t spsr)
|
||||
{
|
||||
SPCR = spcr;
|
||||
SPSR = spsr;
|
||||
}
|
||||
|
||||
inline uint8_t spi_txrx(uint8_t tx)
|
||||
{
|
||||
SPDR = tx;
|
||||
while (!(SPSR & (1 << SPIF)));
|
||||
return SPDR;
|
||||
}
|
||||
|
||||
#endif //SPI_H
|
||||
|
|
@ -0,0 +1,696 @@
|
|||
#include "Marlin.h"
|
||||
|
||||
#ifdef TMC2130
|
||||
|
||||
#include "tmc2130.h"
|
||||
#include "ultralcd.h"
|
||||
#include "spi.h"
|
||||
|
||||
#define TMC2130_GCONF_NORMAL 0x00000000 // spreadCycle
|
||||
#define TMC2130_GCONF_SGSENS 0x00003180 // spreadCycle with stallguard (stall activates DIAG0 and DIAG1 [pushpull])
|
||||
#define TMC2130_GCONF_SILENT 0x00000004 // stealthChop
|
||||
|
||||
//externals for debuging
|
||||
extern float current_position[4];
|
||||
extern void st_get_position_xy(long &x, long &y);
|
||||
extern long st_get_position(uint8_t axis);
|
||||
extern void crashdet_stop_and_save_print();
|
||||
extern void crashdet_stop_and_save_print2();
|
||||
|
||||
#define X_AXIS_MASK 1
|
||||
#define Y_AXIS_MASK 2
|
||||
#define Z_AXIS_MASK 4
|
||||
#define E_AXIS_MASK 8
|
||||
|
||||
//mode
|
||||
uint8_t tmc2130_mode = TMC2130_MODE_NORMAL;
|
||||
//running and holding currents
|
||||
uint8_t tmc2130_current[4] = TMC2130_CURRENTS;
|
||||
|
||||
//pwm_ampl
|
||||
uint8_t tmc2130_pwm_ampl[4] = {TMC2130_PWM_AMPL_X, TMC2130_PWM_AMPL_Y, TMC2130_PWM_AMPL_Z, TMC2130_PWM_AMPL_E};
|
||||
//pwm_grad
|
||||
uint8_t tmc2130_pwm_grad[4] = {TMC2130_PWM_GRAD_X, TMC2130_PWM_GRAD_Y, TMC2130_PWM_GRAD_Z, TMC2130_PWM_GRAD_E};
|
||||
//pwm_auto
|
||||
uint8_t tmc2130_pwm_auto[4] = {TMC2130_PWM_AUTO_X, TMC2130_PWM_AUTO_Y, TMC2130_PWM_AUTO_Z, TMC2130_PWM_AUTO_E};
|
||||
//pwm_freq
|
||||
uint8_t tmc2130_pwm_freq[4] = {TMC2130_PWM_FREQ_X, TMC2130_PWM_FREQ_Y, TMC2130_PWM_FREQ_Z, TMC2130_PWM_FREQ_E};
|
||||
|
||||
uint8_t tmc2130_mres[4] = {0, 0, 0, 0}; //will be filed at begin of init
|
||||
|
||||
uint8_t tmc2130_sg_thr[4] = {TMC2130_SG_THRS_X, TMC2130_SG_THRS_Y, TMC2130_SG_THRS_Z, TMC2130_SG_THRS_E};
|
||||
uint8_t tmc2130_sg_thr_home[4] = {3, 3, TMC2130_SG_THRS_Z, TMC2130_SG_THRS_E};
|
||||
|
||||
uint8_t tmc2130_sg_homing_axes_mask = 0x00;
|
||||
|
||||
uint8_t tmc2130_sg_meassure = 0xff;
|
||||
uint32_t tmc2130_sg_meassure_cnt = 0;
|
||||
uint32_t tmc2130_sg_meassure_val = 0;
|
||||
|
||||
uint8_t tmc2130_home_enabled = 0;
|
||||
uint8_t tmc2130_home_origin[2] = {0, 0};
|
||||
uint8_t tmc2130_home_bsteps[2] = {48, 48};
|
||||
uint8_t tmc2130_home_fsteps[2] = {48, 48};
|
||||
|
||||
uint8_t tmc2130_wave_fac[4] = {0, 0, 0, 0};
|
||||
|
||||
bool tmc2130_sg_stop_on_crash = true;
|
||||
uint8_t tmc2130_sg_diag_mask = 0x00;
|
||||
uint8_t tmc2130_sg_crash = 0;
|
||||
uint16_t tmc2130_sg_err[4] = {0, 0, 0, 0};
|
||||
uint16_t tmc2130_sg_cnt[4] = {0, 0, 0, 0};
|
||||
bool tmc2130_sg_change = false;
|
||||
|
||||
|
||||
bool skip_debug_msg = false;
|
||||
|
||||
//#define DBG(args...) printf_P(args)
|
||||
#define DBG(args...)
|
||||
#define _n PSTR
|
||||
#define _i PSTR
|
||||
|
||||
//TMC2130 registers
|
||||
#define TMC2130_REG_GCONF 0x00 // 17 bits
|
||||
#define TMC2130_REG_GSTAT 0x01 // 3 bits
|
||||
#define TMC2130_REG_IOIN 0x04 // 8+8 bits
|
||||
#define TMC2130_REG_IHOLD_IRUN 0x10 // 5+5+4 bits
|
||||
#define TMC2130_REG_TPOWERDOWN 0x11 // 8 bits
|
||||
#define TMC2130_REG_TSTEP 0x12 // 20 bits
|
||||
#define TMC2130_REG_TPWMTHRS 0x13 // 20 bits
|
||||
#define TMC2130_REG_TCOOLTHRS 0x14 // 20 bits
|
||||
#define TMC2130_REG_THIGH 0x15 // 20 bits
|
||||
#define TMC2130_REG_XDIRECT 0x2d // 32 bits
|
||||
#define TMC2130_REG_VDCMIN 0x33 // 23 bits
|
||||
#define TMC2130_REG_MSLUT0 0x60 // 32 bits
|
||||
#define TMC2130_REG_MSLUT1 0x61 // 32 bits
|
||||
#define TMC2130_REG_MSLUT2 0x62 // 32 bits
|
||||
#define TMC2130_REG_MSLUT3 0x63 // 32 bits
|
||||
#define TMC2130_REG_MSLUT4 0x64 // 32 bits
|
||||
#define TMC2130_REG_MSLUT5 0x65 // 32 bits
|
||||
#define TMC2130_REG_MSLUT6 0x66 // 32 bits
|
||||
#define TMC2130_REG_MSLUT7 0x67 // 32 bits
|
||||
#define TMC2130_REG_MSLUTSEL 0x68 // 32 bits
|
||||
#define TMC2130_REG_MSLUTSTART 0x69 // 8+8 bits
|
||||
#define TMC2130_REG_MSCNT 0x6a // 10 bits
|
||||
#define TMC2130_REG_MSCURACT 0x6b // 9+9 bits
|
||||
#define TMC2130_REG_CHOPCONF 0x6c // 32 bits
|
||||
#define TMC2130_REG_COOLCONF 0x6d // 25 bits
|
||||
#define TMC2130_REG_DCCTRL 0x6e // 24 bits
|
||||
#define TMC2130_REG_DRV_STATUS 0x6f // 32 bits
|
||||
#define TMC2130_REG_PWMCONF 0x70 // 22 bits
|
||||
#define TMC2130_REG_PWM_SCALE 0x71 // 8 bits
|
||||
#define TMC2130_REG_ENCM_CTRL 0x72 // 2 bits
|
||||
#define TMC2130_REG_LOST_STEPS 0x73 // 20 bits
|
||||
|
||||
|
||||
uint16_t tmc2130_rd_TSTEP(uint8_t axis);
|
||||
uint16_t tmc2130_rd_MSCNT(uint8_t axis);
|
||||
uint32_t tmc2130_rd_MSCURACT(uint8_t axis);
|
||||
|
||||
void tmc2130_wr_CHOPCONF(uint8_t axis, uint8_t toff = 3, uint8_t hstrt = 4, uint8_t hend = 1, uint8_t fd3 = 0, uint8_t disfdcc = 0, uint8_t rndtf = 0, uint8_t chm = 0, uint8_t tbl = 2, uint8_t vsense = 0, uint8_t vhighfs = 0, uint8_t vhighchm = 0, uint8_t sync = 0, uint8_t mres = 0b0100, uint8_t intpol = 1, uint8_t dedge = 0, uint8_t diss2g = 0);
|
||||
void tmc2130_wr_PWMCONF(uint8_t axis, uint8_t pwm_ampl, uint8_t pwm_grad, uint8_t pwm_freq, uint8_t pwm_auto, uint8_t pwm_symm, uint8_t freewheel);
|
||||
void tmc2130_wr_TPWMTHRS(uint8_t axis, uint32_t val32);
|
||||
void tmc2130_wr_THIGH(uint8_t axis, uint32_t val32);
|
||||
|
||||
#define tmc2130_rd(axis, addr, rval) tmc2130_rx(axis, addr, rval)
|
||||
#define tmc2130_wr(axis, addr, wval) tmc2130_tx(axis, addr | 0x80, wval)
|
||||
|
||||
uint8_t tmc2130_tx(uint8_t axis, uint8_t addr, uint32_t wval);
|
||||
uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval);
|
||||
|
||||
|
||||
void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, uint8_t current_h, uint8_t current_r);
|
||||
|
||||
uint16_t __tcoolthrs(uint8_t axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: return TMC2130_TCOOLTHRS_X;
|
||||
case Y_AXIS: return TMC2130_TCOOLTHRS_Y;
|
||||
case Z_AXIS: return TMC2130_TCOOLTHRS_Z;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tmc2130_init()
|
||||
{
|
||||
for (int axis = 0; axis < 4; axis++) // X Y axes
|
||||
{
|
||||
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current[axis], tmc2130_current[axis]);
|
||||
tmc2130_wr(axis, TMC2130_REG_TPOWERDOWN, 0x00000000);
|
||||
// tmc2130_wr(axis, TMC2130_REG_COOLCONF, (((uint32_t)tmc2130_sg_thr[axis]) << 16));
|
||||
// tmc2130_wr(axis, TMC2130_REG_TCOOLTHRS, __tcoolthrs(axis));
|
||||
tmc2130_wr(axis, TMC2130_REG_GCONF, /* (axis < 2) ? TMC2130_GCONF_SGSENS : */ TMC2130_GCONF_NORMAL);
|
||||
// tmc2130_wr_PWMCONF(axis, tmc2130_pwm_ampl[axis], tmc2130_pwm_grad[axis], tmc2130_pwm_freq[axis], tmc2130_pwm_auto[axis], 0, 0);
|
||||
// tmc2130_wr_TPWMTHRS(axis, TMC2130_TPWMTHRS);
|
||||
//tmc2130_wr_THIGH(axis, TMC2130_THIGH);
|
||||
}
|
||||
|
||||
tmc2130_sg_err[0] = 0;
|
||||
tmc2130_sg_err[1] = 0;
|
||||
tmc2130_sg_err[2] = 0;
|
||||
tmc2130_sg_err[3] = 0;
|
||||
tmc2130_sg_cnt[0] = 0;
|
||||
tmc2130_sg_cnt[1] = 0;
|
||||
tmc2130_sg_cnt[2] = 0;
|
||||
tmc2130_sg_cnt[3] = 0;
|
||||
|
||||
#ifdef TMC2130_LINEARITY_CORRECTION
|
||||
// tmc2130_set_wave(X_AXIS, 247, tmc2130_wave_fac[X_AXIS]);
|
||||
// tmc2130_set_wave(Y_AXIS, 247, tmc2130_wave_fac[Y_AXIS]);
|
||||
// tmc2130_set_wave(Z_AXIS, 247, tmc2130_wave_fac[Z_AXIS]);
|
||||
// tmc2130_set_wave(E_AXIS, 247, tmc2130_wave_fac[E_AXIS]);
|
||||
#endif //TMC2130_LINEARITY_CORRECTION
|
||||
}
|
||||
|
||||
void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, uint8_t current_h, uint8_t current_r)
|
||||
{
|
||||
// Settings compatible with the Allegro drivers:
|
||||
// ROSC tied directly to ground — off-time internally set to 30 µs, (9us fast decay, then 21us slow decay),
|
||||
// for both the raising and falling quadrants of the current sine wave.
|
||||
// This means the PWM frequency is roughly between 16 and 25kHz.
|
||||
// The waveform has to be verified on the scope, as a long fast decay / short slow decay causes a lot of noise and motor heating,
|
||||
// while a short fast decay / long slow decay may lead to skipped microsteps at the quadrants of the sine wave with a falling current.
|
||||
// toff = 3 (3: fchop = 27.778kHz, 4: 21.429kHz, 5: 17.442kHz
|
||||
uint8_t toff = 8; // slow decay time: Nclk = 12 + 32 * toff = 268. At 13MHz, that makes 20.61us
|
||||
uint8_t hstrt = 4; // fast decay time: Nclk = 32 * hstrt = 128. At 13MHz, that makes 9.85us
|
||||
// uint8_t toff = 7; // slow decay time: Nclk = 12 + 32 * toff = 236. At 13MHz, that makes 18.15us
|
||||
// uint8_t hstrt = 3; // fast decay time: Nclk = 32 * hstrt = 96. At 13MHz, that makes 7.38us
|
||||
uint8_t hend = 9; // offset, added to each sine wave entry?
|
||||
uint8_t fd3 = 0; // MSb of the fast decay time
|
||||
uint8_t disfdcc = 1; // Disable current comparator usage for termination of the fast decay cycle.
|
||||
uint8_t rndtf = 0; // Random off time. 0 - no modulation, 1 - random modulation of TOFF.
|
||||
uint8_t chm = 1; // Constant off time mod, similar to the Allegro.
|
||||
uint8_t tbl = 2; // blanking time
|
||||
uint8_t vsense = current_r <= 31; // Which internal resistor to enable to compare the motor current to?
|
||||
uint8_t vhighfs = 0;
|
||||
uint8_t vhighchm = 0;
|
||||
uint8_t sync = 0; // This register allows synchronization of the chopper for both phases of a two phase motor in order to avoid the occurrence of a beat, especially at low motor velocities.
|
||||
uint8_t intpol = 0; // Interpolate to 256 micro steps
|
||||
uint8_t dedge = 0;
|
||||
uint8_t diss2g = 0;
|
||||
tmc2130_wr_CHOPCONF(axis, toff, hstrt, hend, fd3, disfdcc, rndtf, chm, tbl, vsense, vhighfs, vhighchm, sync, mres, intpol, dedge, diss2g);
|
||||
// Set the hold and run current.
|
||||
tmc2130_wr(axis, TMC2130_REG_IHOLD_IRUN,
|
||||
// Scale the current based on the internal reference resistor selected.
|
||||
vsense ? (0x000f0000 | ( (current_r & 0x1f) << 8) | (current_h & 0x1f)) :
|
||||
(0x000f0000 | (((current_r >> 1) & 0x1f) << 8) | ((current_h >> 1) & 0x1f)) );
|
||||
}
|
||||
|
||||
void tmc2130_set_pwm_ampl(uint8_t axis, uint8_t pwm_ampl)
|
||||
{
|
||||
MYSERIAL.print("tmc2130_set_pwm_ampl ");
|
||||
MYSERIAL.print((int)axis);
|
||||
MYSERIAL.print(" ");
|
||||
MYSERIAL.println((int)pwm_ampl);
|
||||
tmc2130_pwm_ampl[axis] = pwm_ampl;
|
||||
if (((axis == 0) || (axis == 1)) && (tmc2130_mode == TMC2130_MODE_SILENT))
|
||||
tmc2130_wr_PWMCONF(axis, tmc2130_pwm_ampl[axis], tmc2130_pwm_grad[axis], tmc2130_pwm_freq[axis], tmc2130_pwm_auto[axis], 0, 0);
|
||||
}
|
||||
|
||||
void tmc2130_set_pwm_grad(uint8_t axis, uint8_t pwm_grad)
|
||||
{
|
||||
MYSERIAL.print("tmc2130_set_pwm_grad ");
|
||||
MYSERIAL.print((int)axis);
|
||||
MYSERIAL.print(" ");
|
||||
MYSERIAL.println((int)pwm_grad);
|
||||
tmc2130_pwm_grad[axis] = pwm_grad;
|
||||
if (((axis == 0) || (axis == 1)) && (tmc2130_mode == TMC2130_MODE_SILENT))
|
||||
tmc2130_wr_PWMCONF(axis, tmc2130_pwm_ampl[axis], tmc2130_pwm_grad[axis], tmc2130_pwm_freq[axis], tmc2130_pwm_auto[axis], 0, 0);
|
||||
}
|
||||
|
||||
uint16_t tmc2130_rd_TSTEP(uint8_t axis)
|
||||
{
|
||||
uint32_t val32 = 0;
|
||||
tmc2130_rd(axis, TMC2130_REG_TSTEP, &val32);
|
||||
if (val32 & 0x000f0000) return 0xffff;
|
||||
return val32 & 0xffff;
|
||||
}
|
||||
|
||||
uint16_t tmc2130_rd_MSCNT(uint8_t axis)
|
||||
{
|
||||
uint32_t val32 = 0;
|
||||
tmc2130_rd(axis, TMC2130_REG_MSCNT, &val32);
|
||||
return val32 & 0x3ff;
|
||||
}
|
||||
|
||||
uint32_t tmc2130_rd_MSCURACT(uint8_t axis)
|
||||
{
|
||||
uint32_t val32 = 0;
|
||||
tmc2130_rd(axis, TMC2130_REG_MSCURACT, &val32);
|
||||
return val32;
|
||||
}
|
||||
|
||||
void tmc2130_wr_MSLUTSTART(uint8_t axis, uint8_t start_sin, uint8_t start_sin90)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
val |= (uint32_t)start_sin;
|
||||
val |= ((uint32_t)start_sin90) << 16;
|
||||
tmc2130_wr(axis, TMC2130_REG_MSLUTSTART, val);
|
||||
//printf_P(PSTR("MSLUTSTART=%08lx (start_sin=%d start_sin90=%d)\n"), val, start_sin, start_sin90);
|
||||
}
|
||||
|
||||
void tmc2130_wr_MSLUTSEL(uint8_t axis, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t w0, uint8_t w1, uint8_t w2, uint8_t w3)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
val |= ((uint32_t)w0);
|
||||
val |= ((uint32_t)w1) << 2;
|
||||
val |= ((uint32_t)w2) << 4;
|
||||
val |= ((uint32_t)w3) << 6;
|
||||
val |= ((uint32_t)x1) << 8;
|
||||
val |= ((uint32_t)x2) << 16;
|
||||
val |= ((uint32_t)x3) << 24;
|
||||
tmc2130_wr(axis, TMC2130_REG_MSLUTSEL, val);
|
||||
//printf_P(PSTR("MSLUTSEL=%08lx (x1=%d x2=%d x3=%d w0=%d w1=%d w2=%d w3=%d)\n"), val, x1, x2, x3, w0, w1, w2, w3);
|
||||
}
|
||||
|
||||
void tmc2130_wr_MSLUT(uint8_t axis, uint8_t i, uint32_t val)
|
||||
{
|
||||
tmc2130_wr(axis, TMC2130_REG_MSLUT0 + (i & 7), val);
|
||||
//printf_P(PSTR("MSLUT[%d]=%08lx\n"), i, val);
|
||||
}
|
||||
|
||||
void tmc2130_wr_CHOPCONF(uint8_t axis, uint8_t toff, uint8_t hstrt, uint8_t hend, uint8_t fd3, uint8_t disfdcc, uint8_t rndtf, uint8_t chm, uint8_t tbl, uint8_t vsense, uint8_t vhighfs, uint8_t vhighchm, uint8_t sync, uint8_t mres, uint8_t intpol, uint8_t dedge, uint8_t diss2g)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
val |= (uint32_t)(toff & 15);
|
||||
val |= (uint32_t)(hstrt & 7) << 4;
|
||||
val |= (uint32_t)(hend & 15) << 7;
|
||||
val |= (uint32_t)(fd3 & 1) << 11;
|
||||
val |= (uint32_t)(disfdcc & 1) << 12;
|
||||
val |= (uint32_t)(rndtf & 1) << 13;
|
||||
val |= (uint32_t)(chm & 1) << 14;
|
||||
val |= (uint32_t)(tbl & 3) << 15;
|
||||
val |= (uint32_t)(vsense & 1) << 17;
|
||||
val |= (uint32_t)(vhighfs & 1) << 18;
|
||||
val |= (uint32_t)(vhighchm & 1) << 19;
|
||||
val |= (uint32_t)(sync & 15) << 20;
|
||||
val |= (uint32_t)(mres & 15) << 24;
|
||||
val |= (uint32_t)(intpol & 1) << 28;
|
||||
val |= (uint32_t)(dedge & 1) << 29;
|
||||
val |= (uint32_t)(diss2g & 1) << 30;
|
||||
tmc2130_wr(axis, TMC2130_REG_CHOPCONF, val);
|
||||
}
|
||||
|
||||
//void tmc2130_wr_PWMCONF(uint8_t axis, uint8_t PWMautoScale, uint8_t PWMfreq, uint8_t PWMgrad, uint8_t PWMampl)
|
||||
void tmc2130_wr_PWMCONF(uint8_t axis, uint8_t pwm_ampl, uint8_t pwm_grad, uint8_t pwm_freq, uint8_t pwm_auto, uint8_t pwm_symm, uint8_t freewheel)
|
||||
{
|
||||
uint32_t val = 0;
|
||||
val |= (uint32_t)(pwm_ampl & 255);
|
||||
val |= (uint32_t)(pwm_grad & 255) << 8;
|
||||
val |= (uint32_t)(pwm_freq & 3) << 16;
|
||||
val |= (uint32_t)(pwm_auto & 1) << 18;
|
||||
val |= (uint32_t)(pwm_symm & 1) << 19;
|
||||
val |= (uint32_t)(freewheel & 3) << 20;
|
||||
tmc2130_wr(axis, TMC2130_REG_PWMCONF, val);
|
||||
// tmc2130_wr(axis, TMC2130_REG_PWMCONF, ((uint32_t)(PWMautoScale+PWMfreq) << 16) | ((uint32_t)PWMgrad << 8) | PWMampl); // TMC LJ -> For better readability changed to 0x00 and added PWMautoScale and PWMfreq
|
||||
}
|
||||
|
||||
void tmc2130_wr_TPWMTHRS(uint8_t axis, uint32_t val32)
|
||||
{
|
||||
tmc2130_wr(axis, TMC2130_REG_TPWMTHRS, val32);
|
||||
}
|
||||
|
||||
void tmc2130_wr_THIGH(uint8_t axis, uint32_t val32)
|
||||
{
|
||||
tmc2130_wr(axis, TMC2130_REG_THIGH, val32);
|
||||
}
|
||||
|
||||
uint8_t tmc2130_usteps2mres(uint16_t usteps)
|
||||
{
|
||||
uint8_t mres = 8; while (mres && (usteps >>= 1)) mres--;
|
||||
return mres;
|
||||
}
|
||||
|
||||
|
||||
inline void tmc2130_cs_low(uint8_t axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: WRITE(X_TMC2130_CS, LOW); break;
|
||||
case Y_AXIS: WRITE(Y_TMC2130_CS, LOW); break;
|
||||
case Z_AXIS: WRITE(Z_TMC2130_CS, LOW); break;
|
||||
case E_AXIS: WRITE(E0_TMC2130_CS, LOW); break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void tmc2130_cs_high(uint8_t axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: WRITE(X_TMC2130_CS, HIGH); break;
|
||||
case Y_AXIS: WRITE(Y_TMC2130_CS, HIGH); break;
|
||||
case Z_AXIS: WRITE(Z_TMC2130_CS, HIGH); break;
|
||||
case E_AXIS: WRITE(E0_TMC2130_CS, HIGH); break;
|
||||
}
|
||||
}
|
||||
|
||||
//Arduino SPI
|
||||
//#define TMC2130_SPI_ENTER() SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3))
|
||||
//#define TMC2130_SPI_TXRX SPI.transfer
|
||||
//#define TMC2130_SPI_LEAVE SPI.endTransaction
|
||||
|
||||
//spi
|
||||
#define TMC2130_SPI_ENTER() spi_setup(TMC2130_SPCR, TMC2130_SPSR)
|
||||
#define TMC2130_SPI_TXRX spi_txrx
|
||||
#define TMC2130_SPI_LEAVE()
|
||||
|
||||
uint8_t tmc2130_tx(uint8_t axis, uint8_t addr, uint32_t wval)
|
||||
{
|
||||
//datagram1 - request
|
||||
TMC2130_SPI_ENTER();
|
||||
tmc2130_cs_low(axis);
|
||||
TMC2130_SPI_TXRX(addr); // address
|
||||
TMC2130_SPI_TXRX((wval >> 24) & 0xff); // MSB
|
||||
TMC2130_SPI_TXRX((wval >> 16) & 0xff);
|
||||
TMC2130_SPI_TXRX((wval >> 8) & 0xff);
|
||||
TMC2130_SPI_TXRX(wval & 0xff); // LSB
|
||||
tmc2130_cs_high(axis);
|
||||
TMC2130_SPI_LEAVE();
|
||||
}
|
||||
|
||||
uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval)
|
||||
{
|
||||
//datagram1 - request
|
||||
TMC2130_SPI_ENTER();
|
||||
tmc2130_cs_low(axis);
|
||||
TMC2130_SPI_TXRX(addr); // address
|
||||
TMC2130_SPI_TXRX(0); // MSB
|
||||
TMC2130_SPI_TXRX(0);
|
||||
TMC2130_SPI_TXRX(0);
|
||||
TMC2130_SPI_TXRX(0); // LSB
|
||||
tmc2130_cs_high(axis);
|
||||
TMC2130_SPI_LEAVE();
|
||||
//datagram2 - response
|
||||
TMC2130_SPI_ENTER();
|
||||
tmc2130_cs_low(axis);
|
||||
uint8_t stat = TMC2130_SPI_TXRX(0); // status
|
||||
uint32_t val32 = 0;
|
||||
val32 = TMC2130_SPI_TXRX(0); // MSB
|
||||
val32 = (val32 << 8) | TMC2130_SPI_TXRX(0);
|
||||
val32 = (val32 << 8) | TMC2130_SPI_TXRX(0);
|
||||
val32 = (val32 << 8) | TMC2130_SPI_TXRX(0); // LSB
|
||||
tmc2130_cs_high(axis);
|
||||
TMC2130_SPI_LEAVE();
|
||||
if (rval != 0) *rval = val32;
|
||||
return stat;
|
||||
}
|
||||
|
||||
#define _GET_PWR_X (READ(X_ENABLE_PIN) == X_ENABLE_ON)
|
||||
#define _GET_PWR_Y (READ(Y_ENABLE_PIN) == Y_ENABLE_ON)
|
||||
#define _GET_PWR_Z (READ(Z_ENABLE_PIN) == Z_ENABLE_ON)
|
||||
#define _GET_PWR_E (READ(E0_ENABLE_PIN) == E_ENABLE_ON)
|
||||
|
||||
#define _SET_PWR_X(ena) { WRITE(X_ENABLE_PIN, ena?X_ENABLE_ON:!X_ENABLE_ON); asm("nop"); }
|
||||
#define _SET_PWR_Y(ena) { WRITE(Y_ENABLE_PIN, ena?Y_ENABLE_ON:!Y_ENABLE_ON); asm("nop"); }
|
||||
#define _SET_PWR_Z(ena) { WRITE(Z_ENABLE_PIN, ena?Z_ENABLE_ON:!Z_ENABLE_ON); asm("nop"); }
|
||||
#define _SET_PWR_E(ena) { WRITE(E0_ENABLE_PIN, ena?E_ENABLE_ON:!E_ENABLE_ON); asm("nop"); }
|
||||
|
||||
#define _GET_DIR_X (READ(X_DIR_PIN) == INVERT_X_DIR)
|
||||
#define _GET_DIR_Y (READ(Y_DIR_PIN) == INVERT_Y_DIR)
|
||||
#define _GET_DIR_Z (READ(Z_DIR_PIN) == INVERT_Z_DIR)
|
||||
#define _GET_DIR_E (READ(E0_DIR_PIN) == INVERT_E0_DIR)
|
||||
|
||||
#define _SET_DIR_X(dir) { WRITE(X_DIR_PIN, dir?INVERT_X_DIR:!INVERT_X_DIR); asm("nop"); }
|
||||
#define _SET_DIR_Y(dir) { WRITE(Y_DIR_PIN, dir?INVERT_Y_DIR:!INVERT_Y_DIR); asm("nop"); }
|
||||
#define _SET_DIR_Z(dir) { WRITE(Z_DIR_PIN, dir?INVERT_Z_DIR:!INVERT_Z_DIR); asm("nop"); }
|
||||
#define _SET_DIR_E(dir) { WRITE(E0_DIR_PIN, dir?INVERT_E0_DIR:!INVERT_E0_DIR); asm("nop"); }
|
||||
|
||||
#define _DO_STEP_X { WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); asm("nop"); WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); asm("nop"); }
|
||||
#define _DO_STEP_Y { WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); asm("nop"); WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); asm("nop"); }
|
||||
#define _DO_STEP_Z { WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); asm("nop"); WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); asm("nop"); }
|
||||
#define _DO_STEP_E { WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); asm("nop"); WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); asm("nop"); }
|
||||
|
||||
uint8_t tmc2130_get_pwr(uint8_t axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: return _GET_PWR_X;
|
||||
case Y_AXIS: return _GET_PWR_Y;
|
||||
case Z_AXIS: return _GET_PWR_Z;
|
||||
case E_AXIS: return _GET_PWR_E;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tmc2130_set_pwr(uint8_t axis, uint8_t pwr)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: _SET_PWR_X(pwr); break;
|
||||
case Y_AXIS: _SET_PWR_Y(pwr); break;
|
||||
case Z_AXIS: _SET_PWR_Z(pwr); break;
|
||||
case E_AXIS: _SET_PWR_E(pwr); break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t tmc2130_get_inv(uint8_t axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: return INVERT_X_DIR;
|
||||
case Y_AXIS: return INVERT_Y_DIR;
|
||||
case Z_AXIS: return INVERT_Z_DIR;
|
||||
case E_AXIS: return INVERT_E0_DIR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t tmc2130_get_dir(uint8_t axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: return _GET_DIR_X;
|
||||
case Y_AXIS: return _GET_DIR_Y;
|
||||
case Z_AXIS: return _GET_DIR_Z;
|
||||
case E_AXIS: return _GET_DIR_E;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void tmc2130_set_dir(uint8_t axis, uint8_t dir)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: _SET_DIR_X(dir); break;
|
||||
case Y_AXIS: _SET_DIR_Y(dir); break;
|
||||
case Z_AXIS: _SET_DIR_Z(dir); break;
|
||||
case E_AXIS: _SET_DIR_E(dir); break;
|
||||
}
|
||||
}
|
||||
|
||||
void tmc2130_do_step(uint8_t axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS: _DO_STEP_X; break;
|
||||
case Y_AXIS: _DO_STEP_Y; break;
|
||||
case Z_AXIS: _DO_STEP_Z; break;
|
||||
case E_AXIS: _DO_STEP_E; break;
|
||||
}
|
||||
}
|
||||
|
||||
void tmc2130_do_steps(uint8_t axis, uint16_t steps, uint8_t dir, uint16_t delay_us)
|
||||
{
|
||||
tmc2130_set_dir(axis, dir);
|
||||
delayMicroseconds(100);
|
||||
while (steps--)
|
||||
{
|
||||
tmc2130_do_step(axis);
|
||||
delayMicroseconds(delay_us);
|
||||
}
|
||||
}
|
||||
|
||||
void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_us, uint16_t microstep_resolution)
|
||||
{
|
||||
printf_P(PSTR("tmc2130_goto_step %d %d %d %d \n"), axis, step, dir, delay_us, microstep_resolution);
|
||||
uint8_t shift; for (shift = 0; shift < 8; shift++) if (microstep_resolution == (256 >> shift)) break;
|
||||
uint16_t cnt = 4 * (1 << (8 - shift));
|
||||
uint16_t mscnt = tmc2130_rd_MSCNT(axis);
|
||||
if (dir == 2)
|
||||
{
|
||||
dir = tmc2130_get_inv(axis)?0:1;
|
||||
int steps = (int)step - (int)(mscnt >> shift);
|
||||
if (steps < 0)
|
||||
{
|
||||
dir ^= 1;
|
||||
steps = -steps;
|
||||
}
|
||||
if (steps > (cnt / 2))
|
||||
{
|
||||
dir ^= 1;
|
||||
steps = cnt - steps;
|
||||
}
|
||||
cnt = steps;
|
||||
}
|
||||
tmc2130_set_dir(axis, dir);
|
||||
delayMicroseconds(100);
|
||||
mscnt = tmc2130_rd_MSCNT(axis);
|
||||
while ((cnt--) && ((mscnt >> shift) != step))
|
||||
{
|
||||
tmc2130_do_step(axis);
|
||||
delayMicroseconds(delay_us);
|
||||
mscnt = tmc2130_rd_MSCNT(axis);
|
||||
}
|
||||
}
|
||||
|
||||
void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream)
|
||||
{
|
||||
uint8_t pwr = tmc2130_get_pwr(axis);
|
||||
tmc2130_set_pwr(axis, 0);
|
||||
tmc2130_setup_chopper(axis, tmc2130_usteps2mres(256), tmc2130_current[axis], tmc2130_current[axis]);
|
||||
tmc2130_goto_step(axis, 0, 2, 100, 256);
|
||||
tmc2130_set_dir(axis, tmc2130_get_inv(axis)?0:1);
|
||||
for (int i = 0; i <= 255; i++)
|
||||
{
|
||||
uint32_t val = tmc2130_rd_MSCURACT(axis);
|
||||
uint16_t mscnt = tmc2130_rd_MSCNT(axis);
|
||||
int curA = (val & 0xff) | ((val << 7) & 0x8000);
|
||||
if (stream)
|
||||
{
|
||||
if (mscnt == i)
|
||||
fprintf_P(stream, PSTR("%d\t%d\n"), i, curA);
|
||||
else //TODO - remove this check
|
||||
fprintf_P(stream, PSTR("!! (i=%d MSCNT=%d)\n"), i, mscnt);
|
||||
}
|
||||
if (data) *(data++) = curA;
|
||||
tmc2130_do_step(axis);
|
||||
delayMicroseconds(100);
|
||||
}
|
||||
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current[axis], tmc2130_current[axis]);
|
||||
}
|
||||
|
||||
void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000)
|
||||
{
|
||||
// TMC2130 wave compression algorithm
|
||||
// optimized for minimal memory requirements
|
||||
printf_P(PSTR("tmc2130_set_wave %hhd %hhd\n"), axis, fac1000);
|
||||
if (fac1000 < TMC2130_WAVE_FAC1000_MIN) fac1000 = 0;
|
||||
if (fac1000 > TMC2130_WAVE_FAC1000_MAX) fac1000 = TMC2130_WAVE_FAC1000_MAX;
|
||||
float fac = 0;
|
||||
if (fac1000) fac = (float)((uint16_t)fac1000 + 1000) / 1000; //correction factor
|
||||
printf_P(PSTR(" factor: %s\n"), ftostr43(fac));
|
||||
uint8_t vA = 0; //value of currentA
|
||||
uint8_t va = 0; //previous vA
|
||||
uint8_t d0 = 0; //delta0
|
||||
uint8_t d1 = 1; //delta1
|
||||
uint8_t w[4] = {1,1,1,1}; //W bits (MSLUTSEL)
|
||||
uint8_t x[3] = {255,255,255}; //X segment bounds (MSLUTSEL)
|
||||
uint8_t s = 0; //current segment
|
||||
int8_t b; //encoded bit value
|
||||
uint8_t dA; //delta value
|
||||
int i; //microstep index
|
||||
uint32_t reg; //tmc2130 register
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, amp);
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
if ((i & 31) == 0)
|
||||
reg = 0;
|
||||
// calculate value
|
||||
if (fac == 0) // default TMC wave
|
||||
vA = (uint8_t)((amp+1) * sin((2*PI*i + PI)/1024) + 0.5) - 1;
|
||||
else // corrected wave
|
||||
vA = (uint8_t)(amp * pow(sin(2*PI*i/1024), fac) + 0.5);
|
||||
dA = vA - va; // calculate delta
|
||||
va = vA;
|
||||
b = -1;
|
||||
if (dA == d0) b = 0; //delta == delta0 => bit=0
|
||||
else if (dA == d1) b = 1; //delta == delta1 => bit=1
|
||||
else
|
||||
{
|
||||
if (dA < d0) // delta < delta0 => switch wbit down
|
||||
{
|
||||
//printf("dn\n");
|
||||
b = 0;
|
||||
switch (dA)
|
||||
{
|
||||
case -1: d0 = -1; d1 = 0; w[s+1] = 0; break;
|
||||
case 0: d0 = 0; d1 = 1; w[s+1] = 1; break;
|
||||
case 1: d0 = 1; d1 = 2; w[s+1] = 2; break;
|
||||
default: b = -1; break;
|
||||
}
|
||||
if (b >= 0) { x[s] = i; s++; }
|
||||
}
|
||||
else if (dA > d1) // delta > delta0 => switch wbit up
|
||||
{
|
||||
//printf("up\n");
|
||||
b = 1;
|
||||
switch (dA)
|
||||
{
|
||||
case 1: d0 = 0; d1 = 1; w[s+1] = 1; break;
|
||||
case 2: d0 = 1; d1 = 2; w[s+1] = 2; break;
|
||||
case 3: d0 = 2; d1 = 3; w[s+1] = 3; break;
|
||||
default: b = -1; break;
|
||||
}
|
||||
if (b >= 0) { x[s] = i; s++; }
|
||||
}
|
||||
}
|
||||
if (b < 0) break; // delta out of range (<-1 or >3)
|
||||
if (s > 3) break; // segment out of range (> 3)
|
||||
//printf("%d\n", vA);
|
||||
if (b == 1) reg |= 0x80000000;
|
||||
if ((i & 31) == 31)
|
||||
tmc2130_wr_MSLUT(axis, (uint8_t)(i >> 5), reg);
|
||||
else
|
||||
reg >>= 1;
|
||||
// printf("%3d\t%3d\t%2d\t%2d\t%2d\t%2d %08x\n", i, vA, dA, b, w[s], s, reg);
|
||||
}
|
||||
tmc2130_wr_MSLUTSEL(axis, x[0], x[1], x[2], w[0], w[1], w[2], w[3]);
|
||||
}
|
||||
|
||||
void bubblesort_uint8(uint8_t* data, uint8_t size, uint8_t* data2)
|
||||
{
|
||||
uint8_t changed = 1;
|
||||
while (changed)
|
||||
{
|
||||
changed = 0;
|
||||
for (uint8_t i = 0; i < (size - 1); i++)
|
||||
if (data[i] > data[i+1])
|
||||
{
|
||||
uint8_t register d = data[i];
|
||||
data[i] = data[i+1];
|
||||
data[i+1] = d;
|
||||
if (data2)
|
||||
{
|
||||
d = data2[i];
|
||||
data2[i] = data2[i+1];
|
||||
data2[i+1] = d;
|
||||
}
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t clusterize_uint8(uint8_t* data, uint8_t size, uint8_t* ccnt, uint8_t* cval, uint8_t tol)
|
||||
{
|
||||
uint8_t cnt = 1;
|
||||
uint16_t sum = data[0];
|
||||
uint8_t cl = 0;
|
||||
for (uint8_t i = 1; i < size; i++)
|
||||
{
|
||||
uint8_t d = data[i];
|
||||
uint8_t val = sum / cnt;
|
||||
uint8_t dif = 0;
|
||||
if (val > d) dif = val - d;
|
||||
else dif = d - val;
|
||||
if (dif <= tol)
|
||||
{
|
||||
cnt += 1;
|
||||
sum += d;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ccnt) ccnt[cl] = cnt;
|
||||
if (cval) cval[cl] = val;
|
||||
cnt = 1;
|
||||
sum = d;
|
||||
cl += 1;
|
||||
}
|
||||
}
|
||||
if (ccnt) ccnt[cl] = cnt;
|
||||
if (cval) cval[cl] = sum / cnt;
|
||||
return ++cl;
|
||||
}
|
||||
|
||||
#endif //TMC2130
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
#ifndef TMC2130_H
|
||||
#define TMC2130_H
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
TMC2130 default settings
|
||||
*------------------------------------*/
|
||||
|
||||
#define TMC2130_FCLK 12000000 // fclk = 12MHz
|
||||
|
||||
#define TMC2130_USTEPS_XY 16 // microstep resolution for XY axes
|
||||
#define TMC2130_USTEPS_Z 16 // microstep resolution for Z axis
|
||||
//#define TMC2130_USTEPS_E 32 // microstep resolution for E axis
|
||||
#define TMC2130_USTEPS_E 16 // microstep resolution for E axis
|
||||
#define TMC2130_INTPOL_XY 1 // extrapolate 256 for XY axes
|
||||
#define TMC2130_INTPOL_Z 1 // extrapolate 256 for Z axis
|
||||
#define TMC2130_INTPOL_E 1 // extrapolate 256 for E axis
|
||||
|
||||
#define TMC2130_PWM_GRAD_X 2 // PWMCONF
|
||||
#define TMC2130_PWM_AMPL_X 230 // PWMCONF
|
||||
#define TMC2130_PWM_AUTO_X 1 // PWMCONF
|
||||
#define TMC2130_PWM_FREQ_X 2 // PWMCONF
|
||||
|
||||
#define TMC2130_PWM_GRAD_Y 2 // PWMCONF
|
||||
#define TMC2130_PWM_AMPL_Y 235 // PWMCONF
|
||||
#define TMC2130_PWM_AUTO_Y 1 // PWMCONF
|
||||
#define TMC2130_PWM_FREQ_Y 2 // PWMCONF
|
||||
|
||||
#define TMC2130_PWM_GRAD_E 2 // PWMCONF
|
||||
#define TMC2130_PWM_AMPL_E 235 // PWMCONF
|
||||
#define TMC2130_PWM_AUTO_E 1 // PWMCONF
|
||||
#define TMC2130_PWM_FREQ_E 2 // PWMCONF
|
||||
|
||||
#define TMC2130_PWM_GRAD_Z 4 // PWMCONF
|
||||
#define TMC2130_PWM_AMPL_Z 200 // PWMCONF
|
||||
#define TMC2130_PWM_AUTO_Z 1 // PWMCONF
|
||||
#define TMC2130_PWM_FREQ_Z 2 // PWMCONF
|
||||
|
||||
#define TMC2130_PWM_GRAD_E 4 // PWMCONF
|
||||
#define TMC2130_PWM_AMPL_E 240 // PWMCONF
|
||||
#define TMC2130_PWM_AUTO_E 1 // PWMCONF
|
||||
#define TMC2130_PWM_FREQ_E 2 // PWMCONF
|
||||
|
||||
#define TMC2130_TOFF_XYZ 3 // CHOPCONF // fchop = 27.778kHz
|
||||
#define TMC2130_TOFF_E 3 // CHOPCONF // fchop = 27.778kHz
|
||||
//#define TMC2130_TOFF_E 4 // CHOPCONF // fchop = 21.429kHz
|
||||
//#define TMC2130_TOFF_E 5 // CHOPCONF // fchop = 17.442kHz
|
||||
|
||||
//#define TMC2130_STEALTH_E // Extruder stealthChop mode
|
||||
//#define TMC2130_CNSTOFF_E // Extruder constant-off-time mode (similar to MK2)
|
||||
|
||||
//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410)
|
||||
#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410)
|
||||
#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk)
|
||||
|
||||
#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode
|
||||
#define TMC2130_THIGH 0 // THIGH - unused
|
||||
|
||||
//#define TMC2130_TCOOLTHRS_X 450 // TCOOLTHRS - coolstep treshold
|
||||
//#define TMC2130_TCOOLTHRS_Y 450 // TCOOLTHRS - coolstep treshold
|
||||
#define TMC2130_TCOOLTHRS_X 430 // TCOOLTHRS - coolstep treshold
|
||||
#define TMC2130_TCOOLTHRS_Y 430 // TCOOLTHRS - coolstep treshold
|
||||
#define TMC2130_TCOOLTHRS_Z 500 // TCOOLTHRS - coolstep treshold
|
||||
#define TMC2130_TCOOLTHRS_E 500 // TCOOLTHRS - coolstep treshold
|
||||
|
||||
#define TMC2130_SG_HOMING 1 // stallguard homing
|
||||
#define TMC2130_SG_THRS_X 3 // stallguard sensitivity for X axis
|
||||
#define TMC2130_SG_THRS_Y 3 // stallguard sensitivity for Y axis
|
||||
#define TMC2130_SG_THRS_Z 3 // stallguard sensitivity for Z axis
|
||||
#define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis
|
||||
|
||||
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
|
||||
//#define TMC2130_CURRENTS {25, 25, 31, 25} // default running currents for all axes
|
||||
#define TMC2130_CURRENTS {25, 25, 39, 26} // default running currents for all axes
|
||||
|
||||
//mode
|
||||
extern uint8_t tmc2130_mode;
|
||||
//microstep resolution (0 means 256usteps, 8 means 1ustep
|
||||
extern uint8_t tmc2130_mres[4];
|
||||
|
||||
//flags for axis stall detection
|
||||
extern uint8_t tmc2130_sg_thr[4];
|
||||
|
||||
extern bool tmc2130_sg_stop_on_crash;
|
||||
extern uint8_t tmc2130_sg_crash; //crash mask
|
||||
|
||||
extern uint8_t tmc2130_sg_meassure;
|
||||
extern uint32_t tmc2130_sg_meassure_cnt;
|
||||
extern uint32_t tmc2130_sg_meassure_val;
|
||||
|
||||
extern uint8_t tmc2130_sg_homing_axes_mask;
|
||||
|
||||
#define TMC2130_MODE_NORMAL 0
|
||||
#define TMC2130_MODE_SILENT 1
|
||||
|
||||
#define TMC2130_WAVE_FAC1000_MIN 30
|
||||
#define TMC2130_WAVE_FAC1000_MAX 200
|
||||
#define TMC2130_WAVE_FAC1000_STP 1
|
||||
|
||||
extern uint8_t tmc2130_home_enabled;
|
||||
extern uint8_t tmc2130_home_origin[2];
|
||||
extern uint8_t tmc2130_home_bsteps[2];
|
||||
extern uint8_t tmc2130_home_fsteps[2];
|
||||
|
||||
extern uint8_t tmc2130_wave_fac[4];
|
||||
|
||||
|
||||
//initialize tmc2130
|
||||
extern void tmc2130_init();
|
||||
//check diag pins (called from stepper isr)
|
||||
extern void tmc2130_st_isr(uint8_t last_step_mask);
|
||||
//update stall guard (called from st_synchronize inside the loop)
|
||||
extern bool tmc2130_update_sg();
|
||||
//temperature watching (called from )
|
||||
extern void tmc2130_check_overtemp();
|
||||
//enter homing (called from homeaxis before homing starts)
|
||||
extern void tmc2130_home_enter(uint8_t axes_mask);
|
||||
//exit homing (called from homeaxis after homing ends)
|
||||
extern void tmc2130_home_exit();
|
||||
|
||||
//start stallguard meassuring for single axis
|
||||
extern void tmc2130_sg_meassure_start(uint8_t axis);
|
||||
//stop current stallguard meassuring and report result
|
||||
extern uint16_t tmc2130_sg_meassure_stop();
|
||||
|
||||
|
||||
//set holding current for any axis (M911)
|
||||
extern void tmc2130_set_current_h(uint8_t axis, uint8_t current);
|
||||
//set running current for any axis (M912)
|
||||
extern void tmc2130_set_current_r(uint8_t axis, uint8_t current);
|
||||
//print currents (M913)
|
||||
extern void tmc2130_print_currents();
|
||||
|
||||
//set PWM_AMPL for any axis (M917)
|
||||
extern void tmc2130_set_pwm_ampl(uint8_t axis, uint8_t pwm_ampl);
|
||||
//set PWM_GRAD for any axis (M918)
|
||||
extern void tmc2130_set_pwm_grad(uint8_t axis, uint8_t pwm_ampl);
|
||||
|
||||
|
||||
extern uint16_t tmc2130_rd_MSCNT(uint8_t axis);
|
||||
extern uint32_t tmc2130_rd_MSCURACT(uint8_t axis);
|
||||
|
||||
extern uint8_t tmc2130_usteps2mres(uint16_t usteps);
|
||||
#define tmc2130_mres2usteps(mres) ((uint16_t)256 >> mres)
|
||||
|
||||
extern bool tmc2130_wait_standstill_xy(int timeout);
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
struct
|
||||
{
|
||||
uint8_t mres:5; // mres - byte 0, bit 0..4 microstep resolution
|
||||
uint8_t reserved_0_0:2; // reserved - byte 0, bit 5..6
|
||||
uint8_t intpol:1; // intpol - byte 0, bit 7 linear interpolation to 255 usteps
|
||||
uint8_t pwm_ampl:8; // pwm_ampl - byte 1, bit 0..7 pwm amplitude for silent mode
|
||||
uint8_t pwm_grad:4; // pwm_grad - byte 2, bit 0..3 pwm gradient for silent mode
|
||||
uint8_t pwm_freq:2; // pwm_freq - byte 2, bit 4..5 pwm frequency for silent mode
|
||||
uint8_t reserved_2_0:2; // reserved - byte 2, bit 6..7
|
||||
uint16_t tcoolthrs:16; // tcoolthrs - byte 3..4 coolstep threshold / middle sensitivity
|
||||
int8_t sg_thrs:8; // sg_thrs - byte 5, bit 0..7 stallguard sensitivity in high power / middle sensitivity
|
||||
int8_t current_h:6; // current_h - byte 6, bit 0..5 holding current for high power mode
|
||||
uint8_t reserved_6_0:2; // reserved - byte 6, bit 6..7
|
||||
int8_t current_r:6; // current_r - byte 7, bit 0..5 running current for high power mode
|
||||
uint8_t reserved_7_0:2; // reserved - byte 7, bit 6..7
|
||||
int8_t home_sg_thrs:8; // sg_thrs - byte 8, bit 0..7 stallguard sensitivity for homing
|
||||
int8_t home_current:6; // current_r - byte 9, bit 0..5 running current for homing
|
||||
uint8_t reserved_9_0:2; // reserved - byte 9, bit 6..7
|
||||
int8_t home_dtcoolthrs:8; // dtcoolthrs - byte 10, bit 0..7 delta tcoolthrs for homing
|
||||
int8_t dtcoolthrs_low:8; // dtcoolthrs - byte 11, bit 0..7 delta tcoolthrs for low sensitivity (based on value for middle sensitivity)
|
||||
int8_t dtcoolthrs_high:8; // dtcoolthrs - byte 12, bit 0..7 delta tcoolthrs for high sensitivity (based on value for middle sensitivity)
|
||||
int8_t sg_thrs_low:8; // sg_thrs - byte 13, bit 0..7 stallguard sensitivity in high power / low sensitivity
|
||||
int8_t sg_thrs_high:8; // sg_thrs - byte 14, bit 0..7 stallguard sensitivity in high power / high sensitivity
|
||||
} tmc2130_axis_config;
|
||||
#pragma pack(pop)
|
||||
|
||||
extern uint16_t tmc2130_get_res(uint8_t axis);
|
||||
extern void tmc2130_set_res(uint8_t axis, uint16_t res);
|
||||
extern uint8_t tmc2130_get_pwr(uint8_t axis);
|
||||
extern void tmc2130_set_pwr(uint8_t axis, uint8_t pwr);
|
||||
extern uint8_t tmc2130_get_inv(uint8_t axis);
|
||||
extern uint8_t tmc2130_get_dir(uint8_t axis);
|
||||
extern void tmc2130_set_dir(uint8_t axis, uint8_t dir);
|
||||
extern void tmc2130_do_step(uint8_t axis);
|
||||
extern void tmc2130_do_steps(uint8_t axis, uint16_t steps, uint8_t dir, uint16_t delay_us);
|
||||
extern void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_us, uint16_t microstep_resolution);
|
||||
extern void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream);
|
||||
extern void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000);
|
||||
|
||||
extern bool tmc2130_home_calibrate(uint8_t axis);
|
||||
|
||||
#endif //TMC2130_H
|
||||
|
|
@ -0,0 +1,401 @@
|
|||
#ifndef CONFIGURATION_PRUSA_H
|
||||
#define CONFIGURATION_PRUSA_H
|
||||
|
||||
/*------------------------------------
|
||||
GENERAL SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Printer revision
|
||||
#define FILAMENT_SIZE "1_75mm_MK2"
|
||||
#define NOZZLE_TYPE "E3Dv6full"
|
||||
|
||||
// Developer flag
|
||||
#define DEVELOPER
|
||||
|
||||
// Printer name
|
||||
#define CUSTOM_MENDEL_NAME "Prusa i3 MK2"
|
||||
|
||||
// Electronics
|
||||
#define MOTHERBOARD BOARD_EINSY_1_0a
|
||||
|
||||
// Prusa Single extruder multiple material suport
|
||||
//#define SNMM
|
||||
|
||||
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)
|
||||
//#define E3D_PT100_EXTRUDER_WITH_AMP
|
||||
//#define E3D_PT100_EXTRUDER_NO_AMP
|
||||
//#define E3D_PT100_BED_WITH_AMP
|
||||
//#define E3D_PT100_BED_NO_AMP
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
AXIS SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Steps per unit {X,Y,Z,E}
|
||||
#ifdef SNMM
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140}
|
||||
#else
|
||||
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3}
|
||||
#endif
|
||||
|
||||
|
||||
// Endstop inverting
|
||||
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
|
||||
|
||||
// Home position
|
||||
#define MANUAL_X_HOME_POS 0
|
||||
#define MANUAL_Y_HOME_POS -2.2
|
||||
#define MANUAL_Z_HOME_POS 0.15
|
||||
|
||||
// Travel limits after homing
|
||||
#define X_MAX_POS 250
|
||||
#define X_MIN_POS 0
|
||||
#define Y_MAX_POS 210
|
||||
#define Y_MIN_POS -2.2
|
||||
#define Z_MAX_POS 210
|
||||
#define Z_MIN_POS 0.15
|
||||
|
||||
// Canceled home position
|
||||
#define X_CANCEL_POS 50
|
||||
#define Y_CANCEL_POS 190
|
||||
|
||||
//Pause print position
|
||||
#define X_PAUSE_POS 50
|
||||
#define Y_PAUSE_POS 190
|
||||
#define Z_PAUSE_LIFT 20
|
||||
|
||||
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
|
||||
#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min)
|
||||
|
||||
#define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec)
|
||||
#define DEFAULT_MAX_ACCELERATION {9000,9000,500,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.
|
||||
|
||||
#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
|
||||
#define DEFAULT_RETRACT_ACCELERATION 1500 // X, Y, Z and E max acceleration in mm/s^2 for retracts
|
||||
|
||||
|
||||
#define MANUAL_FEEDRATE {3000, 3000, 1000, 100} // set the speeds for manual moves (mm/min)
|
||||
|
||||
#define Z_AXIS_ALWAYS_ON 1
|
||||
|
||||
/*------------------------------------
|
||||
EXTRUDER SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Mintemps
|
||||
#define HEATER_0_MINTEMP 15
|
||||
#define HEATER_1_MINTEMP 5
|
||||
#define HEATER_2_MINTEMP 5
|
||||
#define BED_MINTEMP 15
|
||||
|
||||
// Maxtemps
|
||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
|
||||
#define HEATER_0_MAXTEMP 410
|
||||
#else
|
||||
#define HEATER_0_MAXTEMP 305
|
||||
#endif
|
||||
#define HEATER_1_MAXTEMP 305
|
||||
#define HEATER_2_MAXTEMP 305
|
||||
#define BED_MAXTEMP 150
|
||||
|
||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
|
||||
// Define PID constants for extruder with PT100
|
||||
#define DEFAULT_Kp 21.70
|
||||
#define DEFAULT_Ki 1.60
|
||||
#define DEFAULT_Kd 73.76
|
||||
#else
|
||||
// Define PID constants for extruder
|
||||
#define DEFAULT_Kp 40.925
|
||||
#define DEFAULT_Ki 4.875
|
||||
#define DEFAULT_Kd 86.085
|
||||
#endif
|
||||
|
||||
// Extrude mintemp
|
||||
#define EXTRUDE_MINTEMP 130
|
||||
|
||||
// Extruder cooling fans
|
||||
#define EXTRUDER_0_AUTO_FAN_PIN 8
|
||||
#define EXTRUDER_1_AUTO_FAN_PIN -1
|
||||
#define EXTRUDER_2_AUTO_FAN_PIN -1
|
||||
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
|
||||
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SNMM
|
||||
//#define BOWDEN_LENGTH 408
|
||||
#define BOWDEN_LENGTH 433 //default total length for filament fast loading part; max length for extrusion is 465 mm!; this length can be adjusted in service menu
|
||||
#define FIL_LOAD_LENGTH 102 //length for loading filament into the nozzle
|
||||
#define FIL_COOLING 10 //length for cooling moves
|
||||
#define E_MOTOR_LOW_CURRENT 350 // current for PRUSAY code
|
||||
#define E_MOTOR_HIGH_CURRENT 700 //current for unloading filament, stop print, PRUSAY ramming
|
||||
#endif //SNMM
|
||||
|
||||
//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function
|
||||
|
||||
|
||||
/*------------------------------------
|
||||
CHANGE FILAMENT SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Filament change configuration
|
||||
#define FILAMENTCHANGEENABLE
|
||||
#ifdef FILAMENTCHANGEENABLE
|
||||
#define FILAMENTCHANGE_XPOS 211
|
||||
#define FILAMENTCHANGE_YPOS 0
|
||||
#define FILAMENTCHANGE_ZADD 2
|
||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
||||
|
||||
#define FILAMENTCHANGE_FIRSTFEED 70
|
||||
#define FILAMENTCHANGE_FINALFEED 50
|
||||
#define FILAMENTCHANGE_RECFEED 5
|
||||
|
||||
#define FILAMENTCHANGE_XYFEED 50
|
||||
#define FILAMENTCHANGE_EFEED 20
|
||||
#define FILAMENTCHANGE_RFEED 400
|
||||
#define FILAMENTCHANGE_EXFEED 2
|
||||
#define FILAMENTCHANGE_ZFEED 15
|
||||
|
||||
#endif
|
||||
|
||||
/*------------------------------------
|
||||
ADDITIONAL FEATURES SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Define Prusa filament runout sensor
|
||||
//#define FILAMENT_RUNOUT_SUPPORT
|
||||
|
||||
#ifdef FILAMENT_RUNOUT_SUPPORT
|
||||
#define FILAMENT_RUNOUT_SENSOR 1
|
||||
#endif
|
||||
|
||||
// temperature runaway
|
||||
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
|
||||
#define TEMP_RUNAWAY_BED_TIMEOUT 360
|
||||
|
||||
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
|
||||
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45
|
||||
|
||||
/*------------------------------------
|
||||
MOTOR CURRENT SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Motor Current setting for BIG RAMBo
|
||||
#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
|
||||
#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135}
|
||||
|
||||
// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range
|
||||
//#if MOTHERBOARD == 102 || MOTHERBOARD == 302
|
||||
#define MOTOR_CURRENT_PWM_RANGE 2000
|
||||
#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E}
|
||||
#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E}
|
||||
//#endif
|
||||
|
||||
/*------------------------------------
|
||||
BED SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
// Define Mesh Bed Leveling system to enable it
|
||||
#define MESH_BED_LEVELING
|
||||
#ifdef MESH_BED_LEVELING
|
||||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 35
|
||||
#define MESH_MAX_X 238
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 202
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
// Mesh measure definition
|
||||
#define MESH_MEAS_NUM_X_POINTS 3
|
||||
#define MESH_MEAS_NUM_Y_POINTS 3
|
||||
|
||||
#define MESH_HOME_Z_CALIB 0.2
|
||||
#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc.
|
||||
|
||||
#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right
|
||||
#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind
|
||||
#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!)
|
||||
#endif
|
||||
|
||||
// Bed Temperature Control
|
||||
// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
|
||||
//
|
||||
// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
|
||||
// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
|
||||
// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
|
||||
// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
|
||||
// If your configuration is significantly different than this and you don't understand the issues involved, you probably
|
||||
// shouldn't use bed PID until someone else verifies your hardware works.
|
||||
// If this is enabled, find your own PID constants below.
|
||||
#define PIDTEMPBED
|
||||
//
|
||||
//#define BED_LIMIT_SWITCHING
|
||||
|
||||
// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
|
||||
// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
|
||||
// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
|
||||
// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED)
|
||||
#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
|
||||
|
||||
// Bed temperature compensation settings
|
||||
#define BED_OFFSET 10
|
||||
#define BED_OFFSET_START 40
|
||||
#define BED_OFFSET_CENTER 50
|
||||
|
||||
|
||||
#ifdef PIDTEMPBED
|
||||
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
|
||||
#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP)
|
||||
// Define PID constants for extruder with PT100
|
||||
#define DEFAULT_bedKp 21.70
|
||||
#define DEFAULT_bedKi 1.60
|
||||
#define DEFAULT_bedKd 73.76
|
||||
#else
|
||||
#define DEFAULT_bedKp 126.13
|
||||
#define DEFAULT_bedKi 4.30
|
||||
#define DEFAULT_bedKd 924.76
|
||||
#endif
|
||||
|
||||
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
||||
//from pidautotune
|
||||
// #define DEFAULT_bedKp 97.1
|
||||
// #define DEFAULT_bedKi 1.41
|
||||
// #define DEFAULT_bedKd 1675.16
|
||||
|
||||
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
|
||||
#endif // PIDTEMPBED
|
||||
|
||||
|
||||
/*-----------------------------------
|
||||
PREHEAT SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
#define PLA_PREHEAT_HOTEND_TEMP 215
|
||||
#define PLA_PREHEAT_HPB_TEMP 55
|
||||
#define PLA_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define ABS_PREHEAT_HOTEND_TEMP 255
|
||||
#define ABS_PREHEAT_HPB_TEMP 100
|
||||
#define ABS_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define HIPS_PREHEAT_HOTEND_TEMP 220
|
||||
#define HIPS_PREHEAT_HPB_TEMP 100
|
||||
#define HIPS_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define PP_PREHEAT_HOTEND_TEMP 254
|
||||
#define PP_PREHEAT_HPB_TEMP 100
|
||||
#define PP_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define PET_PREHEAT_HOTEND_TEMP 240
|
||||
#define PET_PREHEAT_HPB_TEMP 90
|
||||
#define PET_PREHEAT_FAN_SPEED 0
|
||||
|
||||
#define FLEX_PREHEAT_HOTEND_TEMP 230
|
||||
#define FLEX_PREHEAT_HPB_TEMP 50
|
||||
#define FLEX_PREHEAT_FAN_SPEED 0
|
||||
|
||||
/*------------------------------------
|
||||
THERMISTORS SETTINGS
|
||||
*------------------------------------*/
|
||||
|
||||
//
|
||||
//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
|
||||
//
|
||||
//// Temperature sensor settings:
|
||||
// -2 is thermocouple with MAX6675 (only for sensor 0)
|
||||
// -1 is thermocouple with AD595
|
||||
// 0 is not used
|
||||
// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
|
||||
// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
|
||||
// 3 is Mendel-parts thermistor (4.7k pullup)
|
||||
// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
|
||||
// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
|
||||
// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
|
||||
// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
|
||||
// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
|
||||
// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
|
||||
// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
|
||||
// 10 is 100k RS thermistor 198-961 (4.7k pullup)
|
||||
// 11 is 100k beta 3950 1% thermistor (4.7k pullup)
|
||||
// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
|
||||
// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
|
||||
// 20 is the PT100 circuit found in the Ultimainboard V2.x
|
||||
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
||||
//
|
||||
// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
|
||||
// (but gives greater accuracy and more stable PID)
|
||||
// 51 is 100k thermistor - EPCOS (1k pullup)
|
||||
// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
|
||||
// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
|
||||
//
|
||||
// 1047 is Pt1000 with 4k7 pullup
|
||||
// 1010 is Pt1000 with 1k pullup (non standard)
|
||||
// 147 is Pt100 with 4k7 pullup
|
||||
// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a
|
||||
// 247 is Pt100 with 4k7 pullup and PT100 Amplifier
|
||||
// 110 is Pt100 with 1k pullup (non standard)
|
||||
|
||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP)
|
||||
#define TEMP_SENSOR_0 247
|
||||
#elif defined(E3D_PT100_EXTRUDER_NO_AMP)
|
||||
#define TEMP_SENSOR_0 148
|
||||
#else
|
||||
#define TEMP_SENSOR_0 5
|
||||
#endif
|
||||
#define TEMP_SENSOR_1 0
|
||||
#define TEMP_SENSOR_2 0
|
||||
#if defined(E3D_PT100_BED_WITH_AMP)
|
||||
#define TEMP_SENSOR_BED 247
|
||||
#elif defined(E3D_PT100_BED_NO_AMP)
|
||||
#define TEMP_SENSOR_BED 148
|
||||
#else
|
||||
#define TEMP_SENSOR_BED 1
|
||||
#endif
|
||||
|
||||
#define STACK_GUARD_TEST_VALUE 0xA2A2
|
||||
|
||||
#define MAX_BED_TEMP_CALIBRATION 50
|
||||
#define MAX_HOTEND_TEMP_CALIBRATION 50
|
||||
|
||||
#define MAX_E_STEPS_PER_UNIT 250
|
||||
#define MIN_E_STEPS_PER_UNIT 100
|
||||
|
||||
#define Z_BABYSTEP_MIN -3999
|
||||
#define Z_BABYSTEP_MAX 0
|
||||
|
||||
#define PINDA_PREHEAT_X 70
|
||||
#define PINDA_PREHEAT_Y -3
|
||||
#define PINDA_PREHEAT_Z 1
|
||||
#define PINDA_HEAT_T 120 //time in s
|
||||
|
||||
#define PINDA_MIN_T 50
|
||||
#define PINDA_STEP_T 10
|
||||
#define PINDA_MAX_T 100
|
||||
|
||||
#define PING_TIME 60 //time in s
|
||||
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes
|
||||
#define PING_ALLERT_PERIOD 60 //time in s
|
||||
|
||||
#define LONG_PRESS_TIME 1000 //time in ms for button long press
|
||||
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
|
||||
|
||||
#define PAUSE_RETRACT 1
|
||||
|
||||
#define DEFAULT_PID_TEMP 210
|
||||
|
||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
Loading…
Reference in New Issue