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

GRBL RAMPS 1.4 port #929

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
@@ -1,7 +1,11 @@
*.hex
*.zip
*.o
*.elf
*.DS_Store
*.d
build/*
src/*
.pio/*

README.md
55 changes: 55 additions & 0 deletions .vscode/c_cpp_properties.json
@@ -0,0 +1,55 @@
{
"configurations": [
{
"name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
},
{
"name": "Win32",
"includePath": [
"c:/Users/perner/My Projects/grblForRAMPS/grbl",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/cores/arduino",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/variants/mega",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/EEPROM/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/HID/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/SPI/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/SoftwareSerial/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/Wire/src",
"C:/Users/perner/.platformio/packages/tool-unity",
""
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"path": [
"c:/Users/perner/My Projects/grblForRAMPS/grbl",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/cores/arduino",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/variants/mega",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/EEPROM/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/HID/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/SPI/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/SoftwareSerial/src",
"C:/Users/perner/.platformio/packages/framework-arduino-avr/libraries/Wire/src",
"C:/Users/perner/.platformio/packages/tool-unity",
""
]
},
"defines": [
"PLATFORMIO=40304",
"ARDUINO_AVR_MEGA2560",
"F_CPU=16000000L",
"ARDUINO_ARCH_AVR",
"ARDUINO=10808",
"__AVR_ATmega2560__",
""
],
"intelliSenseMode": "clang-x64",
"cStandard": "c11",
"cppStandard": "c++11",
"compilerPath": "C:/Users/perner/.platformio/packages/toolchain-atmelavr/bin/avr-gcc.exe",
"compilerArgs": [
"-mmcu=atmega2560",
""
]
}
],
"version": 4
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
32 changes: 32 additions & 0 deletions .vscode/launch.json
@@ -0,0 +1,32 @@
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY

// PIO Unified Debugger
//
// Documentation: https://docs.platformio.org/page/plus/debugging.html
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html

{
"version": "0.2.0",
"configurations": [
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "c:/Users/perner/My Projects/grblForRAMPS/build/build/megaatmega2560/firmware.elf",
"toolchainBinDir": "C:/Users/perner/.platformio/packages/toolchain-atmelavr/bin",
"preLaunchTask": {
"type": "PlatformIO",
"task": "Pre-Debug"
},
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (skip Pre-Debug)",
"executable": "c:/Users/perner/My Projects/grblForRAMPS/build/build/megaatmega2560/firmware.elf",
"toolchainBinDir": "C:/Users/perner/.platformio/packages/toolchain-atmelavr/bin",
"internalConsoleOptions": "openOnSessionStart"
}
]
}
100 changes: 0 additions & 100 deletions Makefile

This file was deleted.

135 changes: 39 additions & 96 deletions README.md
@@ -1,109 +1,52 @@
![GitHub Logo](/doc/media/Grbl Logo 250px.png)
## GRBL 0.9j for Arduino Mega 2560 and RAMPS 1.4

This port was initally developed by ArSi arsi@arsi.sk but has been enhanced to also support Arduino Mega 2560 + RAMPS 1.4 Board (including limit switches, homing and probing support).
It's based on Grbl v0.9j Atmega328p 16mhz 115200baud with generic defaults (2016-03-17).

***

Grbl is a no-compromise, high performance, low cost alternative to parallel-port-based motion control for CNC milling. It will run on a vanilla Arduino (Duemillanove/Uno) as long as it sports an Atmega 328.

The controller is written in highly optimized C utilizing every clever feature of the AVR-chips to achieve precise timing and asynchronous operation. It is able to maintain up to 30kHz of stable, jitter free control pulses.

It accepts standards-compliant g-code and has been tested with the output of several CAM tools with no problems. Arcs, circles and helical motion are fully supported, as well as, all other primary g-code commands. Macro functions, variables, and most canned cycles are not supported, but we think GUIs can do a much better job at translating them into straight g-code anyhow.

Grbl includes full acceleration management with look ahead. That means the controller will look up to 18 motions into the future and plan its velocities ahead to deliver smooth acceleration and jerk-free cornering.

* [Licensing](https://github.com/grbl/grbl/wiki/Licensing): Grbl is free software, released under the GPLv3 license.

* For more information and help, check out our **[Wiki pages!](https://github.com/grbl/grbl/wiki)** If you find that the information is out-dated, please to help us keep it updated by editing it or notifying our community! Thanks!

* Lead Developer [_2011 - Current_]: Sungeun(Sonny) K. Jeon, Ph.D. (USA) aka @chamnit

* Lead Developer [_2009 - 2011_]: Simen Svale Skogsrud (Norway). aka The Originator/Creator/Pioneer/Father of Grbl.

***

### Official Supporters of the Grbl CNC Project
![Official Supporters](https://dl.dropboxusercontent.com/u/2221997/Contributors.png)
For my home made CNC machine I have connected the limit switches as per the RAMPS 1.4 standard connection and not the grbl standard:
I.e.
![grbl for ramps limit and probe connection](https://user-images.githubusercontent.com/942356/51804562-c217f480-2262-11e9-9f21-33e7b92b00d6.png)

***
This is the key configuration parameters for making both limit switching and probing working on my RAMPS 1.4 CNC machine:
[grbl RAMPS 1.4 config parameters](/grbl/defaults/defaults_pulpitrockcnc.h)
```
#define DEFAULT_INVERT_ST_ENABLE 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 0 // false
// Uses software limits in the firmware to keep the printer from going too far in the opposite direction and hardware endstops for min
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // true
#define DEFAULT_HARD_LIMIT_ENABLE 1 // true
#define DEFAULT_HOMING_ENABLE 1 // true
#define DEFAULT_HOMING_DIR_MASK ((1<<X_AXIS)|(1<<Y_AXIS)|(0<<Z_AXIS)) // X and Y endstop installed to the minimum (zero point). Z max installed and Z Min used for probe
```

_**Master Branch:**_
* [Grbl v0.9j Atmega328p 16mhz 115200baud with generic defaults](http://bit.ly/1I8Ey4S) _(2016-03-17)_
- **IMPORTANT INFO WHEN UPGRADING TO GRBL v0.9 :**
- Baudrate is now **115200** (Up from 9600).
- Homing cycle updated. Located based on switch trigger, rather than release point.
- Variable spindle is now enabled by default. Z-limit(D12) and spindle enable(D11) have switched to access the hardware PWM on D11. Homing will not work if you do not re-wire your Z-limit switch to D12.
On the RAMPS board the spindle direction output pins can be found under SERVOS
- SPINDLE_ENABLE_BIT = MEGA2560 Digital Pin 6
- SPINDLE_DIRECTION_BIT = MEGA2560 Digital Pin 5

_**Archives:**_
* [Grbl v0.9i Atmega328p 16mhz 115200baud with generic defaults](http://bit.ly/1EiviDk)
* [Grbl v0.9g Atmega328p 16mhz 115200baud with generic defaults](http://bit.ly/1m8E1Qa)
* [Grbl v0.8c Atmega328p 16mhz 9600baud](http://bit.ly/SSdCJE)
* [Grbl v0.7d Atmega328p 16mhz 9600baud](http://bit.ly/ZhL15G)
* [Grbl v0.6b Atmega328p 16mhz 9600baud](http://bit.ly/VD04A5)
* [Grbl v0.51 Atmega328p 16mhz 9600baud](http://bit.ly/W75BS1)
* [Grbl v0.6b Atmega168 16mhz 9600baud](http://bit.ly/SScWnE)
* [Grbl v0.51 Atmega168 16mhz 9600baud](http://bit.ly/VXyrYu)
On the RAMPS board the flood and mist coolant enable output pins can be found under AUX-1
- COOLANT_FLOOD_BIT = MEGA2560 Digital Pin 0
- COOLANT_MIST_BIT = MEGA2560 Digital Pin 1

On the RAMPS board user-control CONTROLs (cycle start, reset, feed hold) input pins can be found under AUX-2
- RESET_BIT = MEGA2560 Analog Pin 9
- FEED_HOLD_BIT = MEGA2560 Analog Pin 10
- CYCLE_START_BIT = MEGA2560 Analog Pin 11
- SAFETY_DOOR_BIT = MEGA2560 Analog Pin 12

***
## Updated to use platformio

##Update Summary for v0.9j
- **Restore EEPROM feature:** A new set of restore EEPROM features to help OEMs and users reset their Grbl installation to the build defaults. See Configuring Grbl Wiki for details.
- **More configuration options for input pins**
- **Bug fixes including:** Soft limit error handling, disable spindle when S0, g-code reporting of G38.x.

##Update Summary for v0.9i
- **IMPORTANT:**
- **Homing cycle updated. Locates based on trigger point, rather than release point.**
- **System tweaks: $14 cycle auto-start has been removed. No more QUEUE state.**
- **New G-Codes**
- **CoreXY Support**
- **Safety Door Support**
- **Full Limit and Control Pin Configurability**
- **Additional Compile-Time Feature Options**
build using the following commands

##Update Summary for v0.9h from v0.8
- **IMPORTANT:**
- **Default serial baudrate is now 115200! (Up from 9600)**
- **Z-limit(D12) and spindle enable(D11) pins have switched to support variable spindle!**
- **Super Smooth Stepper Algorithm**
- **Stability and Robustness Updates**
- **(x4)+ Faster Planner**
- **Compile-able via Arduino IDE!**
- **G-Code Parser Overhaul**
- **Independent Acceleration and Velocity Settings**
- **Soft Limits**
- **Probing**
- **Dynamic Tool Length Offsets**
- **Improved Arc Performance**
- **CPU Pin Mapping**
- **New Grbl SIMULATOR! (by @jgeisler and @ashelly)**
- **Configurable Real-time Status Reporting**
- **Updated Homing Routine**
- **Optional Limit Pin Sharing**
- **Optional Variable Spindle Speed Output**
- **Additional Compile-Time Feature Options**
```
$pio run
```
Upload to your board using

-
```
List of Supported G-Codes in Grbl v0.9 Master:
- Non-Modal Commands: G4, G10L2, G10L20, G28, G30, G28.1, G30.1, G53, G92, G92.1
- Motion Modes: G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80
- Feed Rate Modes: G93, G94
- Unit Modes: G20, G21
- Distance Modes: G90, G91
- Arc IJK Distance Modes: G91.1
- Plane Select Modes: G17, G18, G19
- Tool Length Offset Modes: G43.1, G49
- Cutter Compensation Modes: G40
- Coordinate System Modes: G54, G55, G56, G57, G58, G59
- Control Modes: G61
- Program Flow: M0, M1, M2, M30*
- Coolant Control: M7*, M8, M9
- Spindle Control: M3, M4, M5
- Valid Non-Command Words: F, I, J, K, L, N, P, R, S, T, X, Y, Z
```
$pio run --target upload
```

-------------
Grbl is an open-source project and fueled by the free-time of our intrepid administrators and altruistic users. If you'd like to donate, all proceeds will be used to help fund supporting hardware and testing equipment. Thank you!
***

[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CUGXJHXA36BYW)
Regards,
Per Ivar
12 changes: 8 additions & 4 deletions grbl/config.h
Expand Up @@ -31,14 +31,16 @@


// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h
#define DEFAULTS_GENERIC
//#define DEFAULTS_GENERIC
#define DEFAULTS_PULPITROCKCNC

// Serial baud rate
#define BAUD_RATE 115200

// Default cpu mappings. Grbl officially supports the Arduino Uno only. Other processor types
// may exist from user-supplied templates or directly user-defined in cpu_map.h
#define CPU_MAP_ATMEGA328P // Arduino Uno CPU
//#define CPU_MAP_ATMEGA328P // Arduino Uno CPU
#define CPU_MAP_ATMEGA2560_RAMPS_1_4 // Arduino Mega 2560 + RAMPS 1.4 Board

// Define realtime command special characters. These characters are 'picked-off' directly from the
// serial read data stream and are not passed to the grbl line execution parser. Select characters
Expand Down Expand Up @@ -84,7 +86,9 @@
// After homing, Grbl will set by default the entire machine space into negative space, as is typical
// for professional CNC machines, regardless of where the limit switches are located. Uncomment this
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
// PulpitRockCNC: Since we are using the X and Y min limit switches (and Z max limit switch)
// as homing switches, we need to force homing to zero
#define HOMING_FORCE_SET_ORIGIN // Uncommented to enable (PulpitRockCNC)

// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may
Expand Down Expand Up @@ -244,7 +248,7 @@
// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!
// The hardware PWM output on pin D11 is required for variable spindle output voltages.
#define VARIABLE_SPINDLE // Default enabled. Comment to disable.
//#define VARIABLE_SPINDLE // Default enabled. Comment to disable.

// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed
// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
Expand Down