Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Added GRBL for RAMPS files
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosGS committed Sep 13, 2015
1 parent 3cce214 commit ccf1424
Show file tree
Hide file tree
Showing 25 changed files with 4,714 additions and 14,130 deletions.
5 changes: 0 additions & 5 deletions .gitignore

This file was deleted.

77 changes: 77 additions & 0 deletions GRBL_RAMPS1_4.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// GRBL RAMPS 1.4 port
// By ArSi arsi@arsi.sk
//**************************************************************************************
// Steppers redirected to fastio.h from marlin firmware
// min switches remaped to AUX-3, GBRL uses pin change interrupts
// simple scheme to allow future porting of next releases
// command buttons currently disabled
// Ramps pins config moved to ramps.h
// cpu_map.h - min switches
// added GRBL_RAMPS1_4.ino for arduino IDE
//**************************************************************************************
// Ramps 1.4 | GRBL | Test
// X axis | X axis | OK working
// Z axis | Y axis for dual motor Y axis | OK working
// Y axis | Z axis | OK working
// Ramps AUX-3 pin 3 | min X | OK working
// Ramps AUX-3 pin 4 | min Y | OK working
// Ramps AUX-3 pin 5 | min Z | not tested
// D10 | motor ON | not tested
// D9 | motor direction | not tested
// D8 | coolant on | not tested
//***************************************************************************************



//#Grbl - An embedded g-code interpreter and motion-controller for the Arduino/AVR328 microcontroller
//
//***

//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 v0.9 is free software, released under the GPLv3 license. Obsolete versions of Grbl, v0.8 and prior, //are released under the permissive MIT-license. This will ensure Grbl will always be an open-source project while making the code permissive for others.

//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_]: Sonny Jeon, Ph.D. (USA)

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






#include <system.h>
#include <nuts_bolts.h>
#include <eeprom.h>
#include <gcode.h>

#include <config.h>
#include <defaults.h>
#include <settings.h>
#include <fastio.h>

#include <stepper.h>
#include <planner.h>
#include <report.h>
#include <serial.h>
#include <cpu_map.h>
#include <limits.h>
#include <motion_control.h>
#include <spindle_control.h>
#include <protocol.h>
#include <probe.h>
#include <print.h>
#include <coolant_control.h>





217 changes: 124 additions & 93 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,97 +1,128 @@
# Part of Grbl
#
# Copyright (c) 2009-2011 Simen Svale Skogsrud
# Copyright (c) 2012 Sungeun K. Jeon
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# Grbl is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Grbl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Targets beginning with '.' are not intended to be called on their own.
#
# You should have received a copy of the GNU General Public License
# along with Grbl. If not, see <http://www.gnu.org/licenses/>.


# This is a prototype Makefile. Modify it according to your needs.
# You should at least check the settings for
# DEVICE ....... The AVR device you compile for
# CLOCK ........ Target AVR clock rate in Hertz
# OBJECTS ...... The object files created from your source files. This list is
# usually the same as the list of source files with suffix ".o".
# PROGRAMMER ... Options to avrdude which define the hardware you use for
# uploading to the AVR and the interface where this hardware
# is connected.
# FUSES ........ Parameters for avrdude to flash the fuses appropriately.

DEVICE ?= atmega328p
CLOCK = 16000000
PROGRAMMER ?= -c avrisp2 -P usb
OBJECTS = main.o motion_control.o gcode.o spindle_control.o coolant_control.o serial.o \
protocol.o stepper.o eeprom.o settings.o planner.o nuts_bolts.o limits.o \
print.o probe.o report.o system.o
# FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m

# Tune the lines below only if you know what you are doing:

AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -B 10 -F
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections

# symbolic targets:
all: grbl.hex

.c.o:
$(COMPILE) -c $< -o $@
@$(COMPILE) -MM $< > $*.d

.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.

.c.s:
$(COMPILE) -S $< -o $@

flash: all
$(AVRDUDE) -U flash:w:grbl.hex:i

fuse:
$(AVRDUDE) $(FUSES)

# Xcode uses the Makefile targets "", "clean" and "install"
install: flash fuse

# if you use a bootloader, change the command below appropriately:
load: all
bootloadHID grbl.hex

clean:
rm -f grbl.hex main.elf $(OBJECTS) $(OBJECTS:.o=.d)

# file targets:
main.elf: $(OBJECTS)
$(COMPILE) -o main.elf $(OBJECTS) -lm -Wl,--gc-sections

grbl.hex: main.elf
rm -f grbl.hex
avr-objcopy -j .text -j .data -O ihex main.elf grbl.hex
avr-size --format=berkeley main.elf
# If you have an EEPROM section, you must also create a hex file for the
# EEPROM and add it to the "flash" target.

# Targets for code debugging and analysis:
disasm: main.elf
avr-objdump -d main.elf

cpp:
$(COMPILE) -E main.c

# include generated header dependencies
-include $(OBJECTS:.o=.d)
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_PLATFORM_${CONF} platform name (current configuration)
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL


# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...

.clean-post: .clean-impl
# Add your post 'clean' code here...


# clobber
clobber: .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post: .clobber-impl
# Add your post 'clobber' code here...


# all
all: .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post: .all-impl
# Add your post 'all' code here...


# build tests
build-tests: .build-tests-post

.build-tests-pre:
# Add your pre 'build-tests' code here...

.build-tests-post: .build-tests-impl
# Add your post 'build-tests' code here...


# run tests
test: .test-post

.test-pre: build-tests
# Add your pre 'test' code here...

.test-post: .test-impl
# Add your post 'test' code here...


# help
help: .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post: .help-impl
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk

# include project make variables
include nbproject/Makefile-variables.mk
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
GRBL RAMPS 1.4 port
By ArSi arsi@arsi.sk
**************************************************************************************
Steppers redirected to fastio.h from marlin firmware
min switches remaped to AUX-3, GBRL uses pin change interrupts
simple scheme to allow future porting of next releases
command buttons currently disabled
Ramps pins config moved to ramps.h
cpu_map.h - min switches
added GRBL_RAMPS1_4.ino for arduino IDE
**************************************************************************************
Ramps 1.4 | GRBL | Test
X axis | X axis | OK working
Z axis | Y axis for dual motor Y axis | OK working
Y axis | Z axis | OK working
Ramps AUX-3 pin 3 | min X | OK working
Ramps AUX-3 pin 4 | min Y | OK working
Ramps AUX-3 pin 5 | min Z | not tested
D10 | motor ON | not tested
D9 | motor direction | not tested
D8 | coolant on | not tested
***************************************************************************************

#Grbl - An embedded g-code interpreter and motion-controller for the Arduino/AVR328 microcontroller

***
Expand Down
13 changes: 7 additions & 6 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@
#include "system.h"



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

// 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_ATMEGA2560_RAMPS_1_4 // Ramps

// Define runtime 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 All @@ -59,7 +60,7 @@
// If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces
// the user to perform the homing cycle (or override the locks) before doing anything else. This is
// mainly a safety feature to remind the user to home, since position is unknown to Grbl.
#define HOMING_INIT_LOCK // Comment to disable
//#define HOMING_INIT_LOCK // Comment to disable

// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short
Expand All @@ -76,8 +77,8 @@
// 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_0 (1<<X_AXIS) // REQUIRED: First move Z to clear workspace.
#define HOMING_CYCLE_1 (1<<Y_AXIS) // OPTIONAL: Then move X,Y at the same time.
// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable

// Number of homing cycles performed after when the machine initially jogs to limit switches.
Expand All @@ -88,7 +89,7 @@
// 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.
#define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.

// 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
Loading

0 comments on commit ccf1424

Please sign in to comment.