Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update text header in grblUpload.ino #1474

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b3a53a4
v1.0 Beta Release.
chamnit Aug 28, 2015
9152d14
Update README
chamnit Aug 28, 2015
9575199
Optional line number reporting bug fix.
chamnit Aug 29, 2015
965e337
Parking motion bug fix.
chamnit Sep 5, 2015
dade712
Updated G28/G30 intermediate motion behavior.
chamnit Sep 24, 2015
b9c3461
Bug fixes.
chamnit Oct 1, 2015
5eee108
Pin state reporting of all pins. Flash optimization.
chamnit Nov 10, 2015
111d28d
Applied master branch bug fixes.
chamnit Mar 4, 2016
81adc20
Soft limit error bug fix.
chamnit Mar 11, 2016
5bfc3a1
No variable spindle and spindle speed fix.
Mar 19, 2016
ff5f8da
Update README
Mar 19, 2016
061e609
Removed 328p-related code. Enabled options by default.
chamnit Mar 20, 2016
b29b960
EEPROM string checks and re-added some compile options.
Mar 20, 2016
8693534
Sleep feature. General re-org and bug fixes.
Apr 4, 2016
e87f4ea
Update readme and sleep documentation.
chamnit Apr 4, 2016
d5decf8
Alarm and safety door bug fix.
Apr 10, 2016
2b82c42
Planner and printFloat update.
May 11, 2016
be5faf6
Minor bug fix to certain safety conditions.
Sep 1, 2016
5e3048f
Grbl v1.1e port to Mega2560 branch
chamnit Dec 19, 2016
e4dd12f
Spindle PWM update for Mega2560
chamnit Dec 20, 2016
c912b82
Alarm handling bug fix.
chamnit Dec 20, 2016
795d2f6
Pulled in Grbl-328p changes.
chamnit Jan 14, 2017
dd2f156
Update README.md
chamnit Mar 19, 2017
9e96e45
Update README.md
chamnit Mar 19, 2017
e0efa4b
Moved Grbl logo files to separate repo.
chamnit Mar 19, 2017
759ff61
Add Ramps 1.4 Board Support
docwelch Jun 27, 2017
4b8e411
Syncing mainstream v1.1f
chamnit Jul 18, 2017
e16b5fb
Merge branch 'edge' into Ramps-1.4
chamnit Jul 18, 2017
576a72c
Merge pull request #28 from docwelch/Ramps-1.4
chamnit Jul 18, 2017
e321c82
Fixed RAMPS control pin conflict
chamnit Aug 1, 2017
40fd602
Fixed a very rare but critical bug when reducing override rates.
chamnit Aug 2, 2017
68d9152
fixes gremlin where changing stepper direction mask didn't work corre…
bgort Aug 10, 2018
a311e2d
Merge pull request #68 from bgort/gremlinfix
chamnit Aug 10, 2018
0f15e66
Upstream updates. Spindle/coolant rare bug fixes.
chamnit Aug 13, 2018
bc05282
Merge branch 'edge' of https://github.com/gnea/grbl-Mega into edge
chamnit Aug 13, 2018
df87b36
Updated version.
chamnit Aug 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions grbl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#define DEFAULTS_GENERIC
#define CPU_MAP_2560_INITIAL

// To use with RAMPS 1.4 Board, comment out the above defines and uncomment the next two defines
//#define DEFAULTS_RAMPS_BOARD
//#define CPU_MAP_2560_RAMPS_BOARD

// Serial baud rate
// #define BAUD_RATE 230400
#define BAUD_RATE 115200
Expand Down Expand Up @@ -102,9 +106,15 @@
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
// will not be affected by pin sharing.
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
#define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.
// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable
#ifdef DEFAULTS_RAMPS_BOARD
#define HOMING_CYCLE_0 (1<<X_AXIS) // Home X axis
#define HOMING_CYCLE_1 (1<<Y_AXIS) // Home Y axis
#define HOMING_CYCLE_2 (1<<Z_AXIS) // OPTIONAL: Home Z axis
#else
#define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.
// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable
#endif // DEFAULTS_RAMPS_BOARD

// NOTE: The following are two examples to setup homing for 2-axis machines.
// #define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS)) // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.
Expand Down Expand Up @@ -193,6 +203,12 @@
// normally-open(NO) and normally-closed(NC) switches installed on their machine.
// NOTE: PLEASE DO NOT USE THIS, unless you have a situation that needs it.
// #define INVERT_LIMIT_PIN_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)) // Default disabled. Uncomment to enable.
#ifdef DEFAULTS_RAMPS_BOARD
// Only enable the following line if you have - (min) limit switches attached
//#define INVERT_MIN_LIMIT_PIN_MASK ((1<<X_AXIS) | (1<<Y_AXIS) | (1<<Z_AXIS))
// Only enable the following line if you have + (max) limit switches attached
//#define INVERT_MAX_LIMIT_PIN_MASK ((1<<X_AXIS) | (1<<Y_AXIS) | (1<<Z_AXIS))
#endif

// Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
// for some pre-built electronic boards.
Expand Down
151 changes: 151 additions & 0 deletions grbl/cpu_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,157 @@

#endif

#ifdef CPU_MAP_2560_RAMPS_BOARD // (Arduino Mega 2560) with Ramps 1.4 Board
#include "nuts_bolts.h"

// Serial port interrupt vectors
#define SERIAL_RX USART0_RX_vect
#define SERIAL_UDRE USART0_UDRE_vect

// Define ports and pins
#define DDR(port) DDR##port
#define _DDR(port) DDR(port)
#define PORT(port) PORT##port
#define _PORT(port) PORT(port)
#define PIN(pin) PIN##pin
#define _PIN(pin) PIN(pin)

// Define step pulse output pins.

#define STEP_PORT_0 F
#define STEP_PORT_1 F
#define STEP_PORT_2 L
#define STEP_BIT_0 0
#define STEP_BIT_1 6
#define STEP_BIT_2 3
#define _STEP_BIT(i) STEP_BIT_##i
#define STEP_BIT(i) _STEP_BIT(i)
#define STEP_DDR(i) _DDR(STEP_PORT_##i)
#define _STEP_PORT(i) _PORT(STEP_PORT_##i)
#define STEP_PORT(i) _STEP_PORT(i)
#define STEP_PIN(i) _PIN(STEP_PORT_##i)

// Define step direction output pins.
#define DIRECTION_PORT_0 F
#define DIRECTION_PORT_1 F
#define DIRECTION_PORT_2 L
#define DIRECTION_BIT_0 1
#define DIRECTION_BIT_1 7
#define DIRECTION_BIT_2 1
#define _DIRECTION_BIT(i) DIRECTION_BIT_##i
#define DIRECTION_BIT(i) _DIRECTION_BIT(i)
#define DIRECTION_DDR(i) _DDR(DIRECTION_PORT_##i)
#define _DIRECTION_PORT(i) _PORT(DIRECTION_PORT_##i)
#define DIRECTION_PORT(i) _DIRECTION_PORT(i)
#define DIRECTION_PIN(i) _PIN(DIRECTION_PORT_##i)

// Define stepper driver enable/disable output pin.
#define STEPPER_DISABLE_PORT_0 D
#define STEPPER_DISABLE_PORT_1 F
#define STEPPER_DISABLE_PORT_2 K
#define STEPPER_DISABLE_BIT_0 7
#define STEPPER_DISABLE_BIT_1 2
#define STEPPER_DISABLE_BIT_2 0
#define STEPPER_DISABLE_BIT(i) STEPPER_DISABLE_BIT_##i
#define STEPPER_DISABLE_DDR(i) _DDR(STEPPER_DISABLE_PORT_##i)
#define STEPPER_DISABLE_PORT(i) _PORT(STEPPER_DISABLE_PORT_##i)
#define STEPPER_DISABLE_PIN(i) _PIN(STEPPER_DISABLE_PORT_##i)

// Define homing/hard limit switch input pins and limit interrupt vectors.
#define MIN_LIMIT_PORT_0 E
#define MIN_LIMIT_PORT_1 J
#define MIN_LIMIT_PORT_2 D
#define MIN_LIMIT_BIT_0 5
#define MIN_LIMIT_BIT_1 1
#define MIN_LIMIT_BIT_2 3
#define _MIN_LIMIT_BIT(i) MIN_LIMIT_BIT_##i
#define MIN_LIMIT_BIT(i) _MIN_LIMIT_BIT(i)
#define MIN_LIMIT_DDR(i) _DDR(MIN_LIMIT_PORT_##i)
#define MIN_LIMIT_PORT(i) _PORT(MIN_LIMIT_PORT_##i)
#define MIN_LIMIT_PIN(i) _PIN(MIN_LIMIT_PORT_##i)

#define MAX_LIMIT_PORT_0 E
#define MAX_LIMIT_PORT_1 J
#define MAX_LIMIT_PORT_2 D
#define MAX_LIMIT_BIT_0 4
#define MAX_LIMIT_BIT_1 0
#define MAX_LIMIT_BIT_2 2
#define _MAX_LIMIT_BIT(i) MAX_LIMIT_BIT_##i
#define MAX_LIMIT_BIT(i) _MAX_LIMIT_BIT(i)
#define MAX_LIMIT_DDR(i) _DDR(MAX_LIMIT_PORT_##i)
#define MAX_LIMIT_PORT(i) _PORT(MAX_LIMIT_PORT_##i)
#define MAX_LIMIT_PIN(i) _PIN(MAX_LIMIT_PORT_##i)

// #define LIMIT_INT PCIE0 // Pin change interrupt enable pin
// #define LIMIT_INT_vect PCINT0_vect
// #define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
// #define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
#define DISABLE_HW_LIMITS

// Define spindle enable and spindle direction output pins.
#define SPINDLE_ENABLE_DDR DDRG
#define SPINDLE_ENABLE_PORT PORTG
#define SPINDLE_ENABLE_BIT 5 // MEGA2560 Digital Pin 4 - Ramps 1.4 Servo 4 Signal pin
#define SPINDLE_DIRECTION_DDR DDRE
#define SPINDLE_DIRECTION_PORT PORTE
#define SPINDLE_DIRECTION_BIT 3 // MEGA2560 Digital Pin 5 - Ramps 1.4 Servo 3 Signal pin

// Define flood and mist coolant enable output pins.
#define COOLANT_FLOOD_DDR DDRB
#define COOLANT_FLOOD_PORT PORTB
#define COOLANT_FLOOD_BIT 4 // MEGA2560 Digital Pin 10 - Ramps 1.4 12v output
#define COOLANT_MIST_DDR DDRH
#define COOLANT_MIST_PORT PORTH
#define COOLANT_MIST_BIT 6 // MEGA2560 Digital Pin 9 - Ramps 1.4 12v output

// Define user-control CONTROLs (cycle start, reset, feed hold) input pins.
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
#define CONTROL_DDR DDRK
#define CONTROL_PIN PINK
#define CONTROL_PORT PORTK
#define CONTROL_RESET_BIT 0 // MEGA2560 Analog Pin 8
#define CONTROL_FEED_HOLD_BIT 1 // MEGA2560 Analog Pin 9
#define CONTROL_CYCLE_START_BIT 2 // MEGA2560 Analog Pin 10
#define CONTROL_SAFETY_DOOR_BIT 3 // MEGA2560 Analog Pin 11
#define CONTROL_INT PCIE2 // Pin change interrupt enable pin
#define CONTROL_INT_vect PCINT2_vect
#define CONTROL_PCMSK PCMSK2 // Pin change interrupt register
#define CONTROL_MASK ((1<<CONTROL_RESET_BIT)|(1<<CONTROL_FEED_HOLD_BIT)|(1<<CONTROL_CYCLE_START_BIT)|(1<<CONTROL_SAFETY_DOOR_BIT))

// Define probe switch input pin.
#define PROBE_DDR DDRK
#define PROBE_PIN PINK
#define PROBE_PORT PORTK
#define PROBE_BIT 7 // MEGA2560 Analog Pin 15
#define PROBE_MASK (1<<PROBE_BIT)

// Advanced Configuration Below You should not need to touch these variables
// Set Timer up to use TIMER4B which is attached to Digital Pin 8 - Ramps 1.4 12v output with heat sink
#define SPINDLE_PWM_MAX_VALUE 1024.0 // Translates to about 1.9 kHz PWM frequency at 1/8 prescaler
#ifndef SPINDLE_PWM_MIN_VALUE
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
#endif
#define SPINDLE_PWM_OFF_VALUE 0
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)

//Control Digital Pin 6 which is Servo 2 signal pin on Ramps 1.4 board
#define SPINDLE_TCCRA_REGISTER TCCR4A
#define SPINDLE_TCCRB_REGISTER TCCR4B
#define SPINDLE_OCR_REGISTER OCR4C
#define SPINDLE_COMB_BIT COM4C1

// 1/8 Prescaler, 16-bit Fast PWM mode
#define SPINDLE_TCCRA_INIT_MASK ((1<<WGM40) | (1<<WGM41))
#define SPINDLE_TCCRB_INIT_MASK ((1<<WGM42) | (1<<WGM43) | (1<<CS41))
#define SPINDLE_OCRA_REGISTER OCR4A // 16-bit Fast PWM mode requires top reset value stored here.
#define SPINDLE_OCRA_TOP_VALUE 0x0400 // PWM counter reset value. Should be the same as PWM_MAX_VALUE in hex.

// Define spindle output pins.
#define SPINDLE_PWM_DDR DDRH
#define SPINDLE_PWM_PORT PORTH
#define SPINDLE_PWM_BIT 5 // MEGA2560 Digital Pin 8

#endif
/*
#ifdef CPU_MAP_CUSTOM_PROC
// For a custom pin map or different processor, copy and edit one of the available cpu
Expand Down
37 changes: 37 additions & 0 deletions grbl/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,41 @@
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#endif

#ifdef DEFAULTS_RAMPS_BOARD
#define DEFAULT_X_STEPS_PER_MM 80
#define DEFAULT_Y_STEPS_PER_MM 80
#define DEFAULT_Z_STEPS_PER_MM 4000
#define DEFAULT_X_MAX_RATE 18000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 18000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 300.0 // mm/min
#define DEFAULT_X_ACCELERATION 3000
#define DEFAULT_Y_ACCELERATION 3000
#define DEFAULT_Z_ACCELERATION 100
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
#define DEFAULT_STEPPING_INVERT_MASK 0
#define DEFAULT_DIRECTION_INVERT_MASK 0
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255 // msec (0-254, 255 keeps steppers enabled)
#define DEFAULT_STATUS_REPORT_MASK 1 // MPos enabled
#define DEFAULT_JUNCTION_DEVIATION 0.02 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_INVERT_ST_ENABLE 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // true
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_INVERT_PROBE_PIN 0 // false
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_HOMING_ENABLE 1 // true
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
#define DEFAULT_HOMING_FEED_RATE 500.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 2000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 5.0 // mm
#endif

#endif
Loading