Microcontroller Firmware Hints

From RepRap
Revision as of 22:02, 11 December 2008 by 59.167.208.99 (talk)
Jump to: navigation, search

Compiling and downloading Arduino Firmware using Windows

  • Fresh Install Arduino version 011 software.
  • Copy sub directories in reprap-arduino-firmware-1.3/library (or any later version downloaded from sourceforge https://reprap.svn.sourceforge.net/svnroot/reprap) directory to Arduino hardware/libraries directory.
  • With reprap-arduino-firmware-1.3 you should end up with 14 sub directories below /libraries.
  • Open the appropriate Single_Arduino_SNAP.pde in arduino.
  • Compile.
  • You will see an error regarding obsolete header file.
  • BUT it will compile without error.
  • If you change a file in libraries which you invariably have to do to match your thermister/thermocouple delete the object file ?????.o
  • Otherwise it will not recompile using the changes

Sanguino Firmware

The Sanguino is an Arduino clone using the Atmega64p chip instead of the Atmeg168. The clone is software compatible except that the pins are moved around a bit.

Initial testing on a Sanguino.

If you've just soldered up your Sanguino a good first program to run is Blink. You can find it from the menu in the Arduino host software at File => Sketchbook => Examples => Digital => Blink

The program will toggle “digital pin 13” which is pin 19 on the Atmega644p chip and the leg labelled 13 on the Sanguino board. This pin does not have an LED attached so you will see nothing flash.

If you want to see something flash change the line “int ledPin = 13;” to “int ledPin = 0;”. Compile and upload this and it will toggle digital pin 0 causing the red debug LED to flash.

Refer to the schematic and the pin-out diagram

Compiling and downloading Arduino Firmware using OSX

( Based on some information from here: http://reprap.org/bin/view/Main/Generation2Electronics#Program_the_Arduino )

  • Fresh Install Arduino version 012 software, including USB to serial drivers. follow this page: http://arduino.cc/en/Guide/MacOSX We suggest installing the software to the /Applications/arduino-0012/ folder.
  • Download the most recent RepRap Arduino firmware source: http://sourceforge.net/project/showfiles.php?group_id=159590&package_id=256565
  • Copy sub directories in reprap-arduino-firmware-1.3/library (or any later version downloaded from sourceforge https://reprap.svn.sourceforge.net/svnroot/reprap) directory to Arduino hardware/libraries directory.
  • With reprap-arduino-firmware-1.3 you should end up with 18 sub directories below /libraries.
  • If you were to try to "build" your schetch now, it would error out with math.h or stdlib.h errors.
  • To fix, edit the arduino-0012/hardware/cores/arduino/wiring.h and comment out the 7 defines listed here ( or surround them in a #ifdef like below, which is equivalent) :
  1. ifdef USE_PESKY_MACROS
  2. define int(x) ((int)(x))
  3. define char(x) ((char)(x))
  4. define long(x) ((long)(x))
  5. define byte(x) ((uint8_t)(x))
  6. define float(x) ((float)(x))
  7. define abs(x) ((x)>0?(x):-(x))
  8. define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
  9. endif
  • start the Arduino 12.app
  • Open the appropriate Single_Arduino_SNAP.pde in arduino.
  • Compile.
  • You will see an error regarding obsolete header file.
  • BUT it will compile without error.
  • If you change a file in libraries which you invariably have to do to match your thermister/thermocouple delete the object file ?????.o
  • Otherwise it will not recompile using the changes