Skip to content

Instantly share code, notes, and snippets.

@willprice
Last active January 9, 2016 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willprice/a55e9ec3498603fcfd9b to your computer and use it in GitHub Desktop.
Save willprice/a55e9ec3498603fcfd9b to your computer and use it in GitHub Desktop.
Command to flash the Arduino Due GCode (CNC controller) software called G2 (a fork of TinyG) to an Arduino Due

Instructions

  1. Press 'Reset' on the Duet (RepRap Pro board)
  2. wait ~1 second
  3. Run ./g2_flash.sh
#!/usr/bin/env bash
PORT=/dev/ttyACM0
BOSSAC="$HOME/.arduino15/packages/arduino/tools/bossac/1.6.1-arduino/bossac"
BINARY="$HOME/g2/TinyG2/bin/gShield/gShield.bin"
set_board_to_upload_mode() {
sudo stty -F "${PORT}" 1200
}
upload_firmare() {
local firmware="$1"; shift;
sudo $BOSSAC --write \
--erase \
--verify \
--info \
--boot \
--port="${PORT##/dev/}" \
--force_usb_port true \
"$firmware"
}
set_board_to_normal_mode() {
sudo stty -F "${PORT}" 9600
}
main() {
set_board_to_upload_mode
upload_firmare "$BINARY"
set_board_to_normal_mode
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment