Getting Grbl

Grbl runs on the AVR Atmega 168 and 328 microcontrollers, the processor that powers the famous Arduinos. The code is freely available from our github repository

The simplest possible way

Getting a prebuilt version running is easyish if you are able to do a bit of detective work using the console on your system. If you’d rather build Grbl yourself check out the DIY way.

For windows
  1. Get an Arduino Duemilanove or some other *uino-flavor based on the atmega 168 or 328
  2. Download one of the prebuilt .hex-files from the Github downloads-page
  3. Connect the Arduino to your computer
  4. Install the Arduino Uploader and upload the .hex-file to the Arduino and you’re done. Move on to Connecting Grbl
For mac/linux
  1. Get an Arduino Duemilanove or some other *uino-flavor based on the atmega 168 or 328
  2. Download one of the prebuilt .hex-files from the Github downloads-page
  3. Download and install the Arduino IDE
  4. Connect the Arduino to your computer
  5. Then just flash the code onto the arduino using avrdude which installed with the Arduino IDE

… which can seem a bit hairy the first time you do it. Here goes:

Locate avrdude inside the Arduino IDE folder. On my Mac it is located here (on your system it might be somewhere else):

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude/avrdude

Locate avrdude.conf inside the Arduino IDE folder. On my system it is here:

/Applications/Arduino.app/Contents/Resources/Java/hardware//tools/avr/etc/avrdude.conf

Discover the name of the serial port for your Arduino. (This instruction is for Linux or Mac – I actually have no idea what you would do on a Windows-box.) Making sure the board is connected write:

% ls /dev/tty.usbserial*

The name of the device will be listed. If more than one device shows up, you might have to guess a little. You’ll figure it out.

Then, being inside the folder where your .hex-file is residing, issue a command like this substituting your two paths, the serial port device name and the name of the hex file you are flashing:

/path/.../.../avrdude -C/path/.../.../avrude.conf -pm168 -cstk500v1 -P/dev/tty.usbserial-A3132 -b19200 -D -Uflash:w:grbl_328.hex

You should see something like this:
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0×1e9406
avrdude: erasing chip
avrdude: reading input file “grbl.hex”
avrdude: input file grbl.hex auto detected as Intel Hex
avrdude: writing flash (14228 bytes):

Writing | ################################################## | 100% 8.06s

avrdude: 14228 bytes of flash written
avrdude: verifying flash memory against grbl.hex:
avrdude: load data flash data from input file grbl.hex:
avrdude: input file grbl.hex auto detected as Intel Hex
avrdude: input file grbl.hex contains 14228 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 6.45s

avrdude: verifying …
avrdude: 14228 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

Next: Connecting Grbl


The DIY way

Grbl compiles using the avr-gcc toolchain. On most linux-systems this is availible as a package. On Windows you’ll have the Winavr package.

If you use a Mac you should avoid the MacPorts-package (old, old!) and just use the toolchain that comes installed with the Arduino IDE. On my system I keep this line in my ~/.bash_profile:

  1. Use the currently installed Arduino build environment as the avr-gcc-compiler
    export PATH=$PATH:/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin

This works exactly like the macports-package, except it is a current version and it even runs on Snow Leopard (thank you Arduino-people!)

If you are serious about AVR-development you should also get a proper programmer. We use the AVRISPmkII and the STK500 Compatible USB Programmer.

The source code lives in this repository at github. You will need to install the version control system git to check out the code. When you got it, do this:

% git clone git@github.com:simen/grbl.git

The code will be in a folder named ‘grbl’ in your current directory.

% cd grbl % make

The code should build. Connect the programmer and do this:

% make flash

And you’re done. Good luck! If you come up with some nice feature, please consider contributing a patch!

Next: Connecting Grbl

Vist 89403 ganger.