PrusaFirmwareBraino

From RepRap
Revision as of 01:11, 3 February 2015 by Prof braino (talk | contribs) (Download Sanguino support)
Jump to: navigation, search

Contents

PRUSA FIRMWARE

When I built my Prusa in 2011, I used Sanguino electronics, and Sprinter firmware. PC ran Windows operations system.

Now (2015), I need to modify the firmware as part of printer calibration http://reprap.org/wiki/PrusaCalibrationNotesBraino. The old PC has been replaced with a upgraded workstation running Linux (Mint 17, similar to Ubuntu). The entire tool chain has seen upgrades or changes. The information retained from the original firmware is the Configuration.h from Sprinter was retain from the original firmware. This should be all that is necessary.

.


When I get done here, I will go back and continue the calibration page http://reprap.org/wiki/PrusaCalibrationNotesBraino

I started at the Sanguinololu page, http://reprap.org/wiki/Sanguinololu. That page is only googe for HARDWARE. For firmware we want the google code page.

http://code.google.com/p/sanguino/downloads/detail?name=Sanguino-0101r1.zip


The goal is Sprinter firmware on Sanginololu electronics.

Prerequisites

In order to create new firmware, we need:

  • Reprep (electronic configuration + mechanical configuration)
  • host PC (toolchain)
  • firmware programmer (to get the new firmware into the reprap controler)

The reprap is a working metric (Mendel) Prusa (2011). The electronics are known-working Sanguinololu v1.3a.

The host PC needs the full toolchain discovered and installed. On Linux this should be much easier than on Windows, as windows was a not pleasant.

Host PC Toolchain

My host PC has linux Mint 17 64 bit. Actually, I did this a bunch of times and I believe the correct instrustions are the same and successful on Mint 16 and 17 both 32 bit and 64 bit. We Need:

  • Host PC OS
  • Arduino IDE (compiler)
  • Sanguino hardware support files (so the Arduino IDE compiler knows our hardware)
  • Sprinter firmware source code

We want to use the Arduino IDE to compile the Sprinter firmware for our hardware.

OS Clean install

I start with a clean OS install. I run virtual box virtual machines. If anything goes horribly wrong it is quicker to launch a new virtual machine rather than re-do the main PC.

Download Arduino IDE

  • Download the latest Arduino from the Arduino downloads page http://arduino.cc/en/main/software. I used 1.0.6 for linux 32 bit for this pass of the instructions, but it also worked with 64 bit last pass.
  • Extract the downloaded archive.
  • Find the Arduino script in the arduino directory.
  • Launch the Arduino IDE by running the shell script (just click on it).


At first launch, the Arduino IDE creates a "sketchbook" directory. This is a C code "projects" directory. I guess they could not simply name it "projects", as that would be too obvious.

Also, at first launch, the Arduino IDE will add the current user to the DIALOUT group. This is required, as it allows us to access the USB virtual serial port /dev/ttyUSB0. The USB virtual serial port /dev/ttyUSB0 is the connection from the Arduino IDE to the Sanguino electronics. This will also be the connection to the PRonterface application on the PC, but we'll get to that in a minute.

Sanguinololu Electronics

The silkscreen on the board displays Sanguino(lolu) v1.3a. Originally, I felt I wanted Sanguino electronics as the closest thing to a "standard", and purchased this. In fact, I found the anti-static bag it came in, it was from Solidoodle. The board arrived with a bootloader pre-burned, so I have no previous experience or need of any bootloader programmer.

I started at the Sanguinololu page, http://reprap.org/wiki/Sanguinololu. That page is only googe for HARDWARE, and does not seem to be of much use after the board is constructed. The page lists FUSES (which should not be an issue on a running board) and confirms Sprinter (my previous choice for firmware) is valid for these electronics.

NOTE: originally, the information was associated with the name "Sanguino". However, if we google sanguino, Google sends us to a binoculars place. Notice the hit is Google Code Sanguino. This will be used later.

Download Sanguino support

I started at the Sanguinololu page, http://reprap.org/wiki/Sanguinololu. That page is only googe for HARDWARE.

For the sanguino hardware description files the Arduinio IDE's compile needs to build the sprinter firmware application, we want the google code page.

http://code.google.com/p/sanguino/downloads/detail?name=Sanguino-0101r1.zip

Sanguino-0101r1.zip is the most recent source code to date. This is what I found successful.


  • Download the Sanguino-0101r1.zip archive
  • extract the archive
  • copy or move the sangino directory that is extracted to the /hardware directory in the Arduino folder. It should end up looking like:
 ~/arduino/hardware
 ~/arduino/hardware/arduino
 ~/arduino/hardware/sanguino
 ~/arduino/hardware/tools


NOTE: If the Arduino IDE was downloaded from the Arduino site, the Arduino IDE code should all be in the current user home directory somewhere (probably under Downloads by default) and we have permission to move and copy files here. IF the software was installed from thesoftware center, it will be under /user/share/arduino and will be owned by root. See http://reprap.org/wiki/PrusaFirmwareBraino#copy_sanguino_definitions_into_Arduino_install_directories_-_installed_from_Software_center_2 for instructions on changing permission to allow move and copy

Download Sprinter source code

From https://github.com/kliment/Sprinter

Run this command in a terminal window:

 git clone https://github.com/kliment/Sprinter.git

The command will create a Sprinter directory in you home directory which contains all the Sprinter firmware code.

Move the Sprinter directory to the sketchbook fold that the Arduino IDE created earlier.

Now when you launch the Arduino IDE, the file menu displays Sprinter under the sketchbook directory.

sprinter instructions are broken for sanguino / sanguinololu

Ignore all the instructions in the SPRINTER readme file. Those are out of date, and will send you in circles for days.

modify configuration.h

For the most part, the only changes needed to configure the sprinter source code are made in configuration.h

  • open the Arduino IDE
  • in the file menu select sketchbook > Sprinter
  • The sprinter project opens
  • click the tab for configuration.h


These are the edits I perform:

No SD on this machine:

  // Comment out (using // at the start of the line) to disable SD support:
  // #define SDSUPPORT

Select Sanguino:

  // Sanguinololu 1.2 and above = 62
  // #define MOTHERBOARD 33
  #define MOTHERBOARD 62

OK, this is what I needed to change. Last time I had X and Y step per unit as 57.11, & extruder steps per unit was 700 (calculating by hand). Now the online calculator says I need 57.265569 and 625.70629055 (and I checked it, and the calculatin looks correct). This is the bit that should fix my print issues. How did I get 57.11 instead of 57.265569? I didn't know what I was doing and/or I changed something with the mods I made. It may have something to do with the "effective diameter of the Hobbed bolt". This means the the 8mm boltdiamter get reduced when we cut the hobs into it. Also when we tighten the idle bearing again the hob, the effective diameter (and/or the effective diameter of the filament) changes. So we have to run some tests from Triffid Hunter's calibration, and adjust there numbers. But more on that later, for now find the file and edit it.

  //// Calibration variables
  // X, Y, Z, E steps per unit - Metric Prusa Mendel with Wade extruder:
  // #define _AXIS_STEP_PER_UNIT {80, 80, 3200/1.25,700}
  #define _AXIS_STEP_PER_UNIT {57.265569, 57.265569, 3200/1.25, 708} 

Proper bed travel for this machine:

  //-----------------------------------------------------------------------
  //Max Length for Prusa Mendel, check the ways of your axis and set this Values
  //-----------------------------------------------------------------------
  const int X_MAX_LENGTH = 190 ; // 200;  Only needs to be 190 for very tall (94 mm) objects; 205 for calibrating bed.
  const int Y_MAX_LENGTH = 180; //200;
  const int Z_MAX_LENGTH = 94; // 100


additional modification for my printer - fix reversed X Axis

I think the parts I purchased were reversed in the X-Axis. Everything works great, except in Pronterface, clicking +X sends the extruder to the left. It a little annoying but I could live with it. After finally going back and sorting the firmware out, I figure I may as well fix this now.

This fix has two parts: half is in configuration.h half, is in Pins.h

From http://www.thefrankes.com/wp/?p=2651

in ~/Sprinter/configuration.h:

change const bool INVERT_X_DIR = false; to

// const bool INVERT_X_DIR = false; 
const bool INVERT_X_DIR = true;

change #define X_HOME_DIR -1 to

 // #define X_HOME_DIR -1
 #define X_HOME_DIR 1

NOTICE: there must be exactly one space between DIR and 1 or it won't work

change "const bool min_software_endstops = false; //If true, axis won't move to coordinates less than zero." and "const bool max_software_endstops = true; //If true, axis won't move to coordinates greater than the defined lengths below." to

 //const bool min_software_endstops = false; //If true, axis won't move to coordinates less than zero.
 //const bool max_software_endstops = true; //If true, axis won't move to coordinates greater than the defined lengths below.
 const bool min_software_endstops = true; //If true, axis won't move to coordinates less than zero.
 const bool max_software_endstops = false; //If true, axis won't move to coordinates greater than the defined lengths below.

This is so the X can move to do the home operation.

in ~/Sprinter/pins.h

  • find line 667 #if MOTHERBOARD == 62 (this is the Sanguino section)
  • find

"#define X_MIN_PIN 18" "#define X_MAX_PIN -2"

change this to

 // #define X_MIN_PIN          18
 //#define X_MAX_PIN           -2
 #define X_MIN_PIN          -2
 #define X_MAX_PIN          18

Be aware the the X Axis won't want to move until the HOME button have been clicked

final issues before sucess

Once the PC, toolchain, support, and source code were in place, there still were issues before success. Check there is you have problems.

Bootloader was overwritten

It turns out the sanguino(lolu) board did not have a bootloader, even though there was Sprinter firmware on the board. The Arduino IDE appeared to be communicating, and the board board appeared to be responding, but did not accept the new firmware. Perhaps there is some test to determine if a bootloader is present? I have not seen any in the instructions.

error - Arduino from Software Center

First pass, I used Arduino 1.0.5 from the Software Manager. Installing via the software manager did not work; compiling the sprinter firmware gave the error message:

 In file included from /usr/share/arduino/hardware/Gen7/cores/arduino/wiring.c:25:0:
 /usr/share/arduino/hardware/Gen7/cores/arduino/wiring_private.h:57:16: error: attempt to use poisoned "SIG_INTERRUPT2"
  #elif defined (SIG_INTERRUPT2)
                 ^

Success - download and extract

I downloaded the newest arduino software 1.0.6 from the arduino.cc page. Firefox placed the archive in my /Downloads directory. I did an "Extract Here" and this created the Arduino 1.0.6 folder in the dwonloads directory. Notice there was no install, just expand the archive in place. This was the method that finally worked.

create virtual machine

Create virtual machine using Virtual Box. I'm using 2 cpu's, 2 gig ram, 32 gig virtual hardware. Installing Linux Mint 17 MATE 64 bit. This is a real life saver, as the bad installs toasted the virtual PC. It is much easier to restart with a fresh virtual PC rather than a fresh install on phyiscal PC.

The first pass through the firmware process resulted in various aspects of the install getting hosed. That is, packages that were installed required changes to the system that could not be undone by unstalling the packages. Rather than undo those steps (and risk missing a critical step) I chose to start again with a clean install on a new virtual machine.

find NEW Sanguino

old Sanguino: Sanguino-0018r2_1_4.zip looks to be from June 2010, did not work; at least I could not get the tool chain set up in linux mint 17.

Stumbled across newer sanguinololu (2012) in Google Code http://code.google.com/p/sanguino/downloads/list. Specifically , I used http://code.google.com/p/sanguino/downloads/detail?name=Sanguino-0101r1.zip listed as compatible with the arduino IDE available in the Linux software center. This is what eventually was able to compile. Notice that the google code sanguino does apear in the top of the google search results, but is not link in the actual instructions for sanguino, sanguinololu, sprinter. This is (one reason) why it took a long time to find the correct sanguino package. However, Sanguino-0101r1.zip also had errors that needed correcting

(error: attempt to use poisoned "SIG_USART1_RECV").

On a windows XP machine, we loaded Melzi http://reprap.org/wiki/Melzi to load firmware on one board, then loaded the sanguino bootloader. On the windows XP machine we did not the poisoned "SIG_USART1_RECV" error. Trying to figure out what to load on Mint 17-64 (and not produce this error). The Melzi support does not include a sanguino atmega644P in the boards.txt file.

install current Arduino IDE

  1. Next install Arduino from Software Center? No, arduino.cc page says:
 --- Ubuntu 12.04 and newer ---
 sudo apt-get update && sudo apt-get install arduino arduino-core  

This terminal command might be the same as the software center, but I will do this as specified. (after Mint completes updates...)

  The arduino IDE asks to add my user to the dialout group.  

Very nice that this is automatic as this is required.

The Arduino IDE from the software center is 1.0.5 - 2013.05.15

There are also available a 6 and some BETAs, but those don't appear to have any imporvements for 644P, so I will skip those for now.

  Shutdown and restart the PC or virtual machine for the dialout goroup change to take affect.

copy sanguino definitions into Arduino install directories - installed from Software center

  • Find the arduino install directory, check the permission with
  cd /usr/share/arduino/; 
  ls -alF
  • Set permission so we can write to the hardware subdirectory, check they changes with:
 sudo chmod -R 777 hardware
  ls -alF
  • Extract the Sanguino [-0101r1] archive (wherever it was downloaded, this is what we will move shortly).
  • Copy the Sanguino directory to the Arduino install directory /hardware subdirectory (using the file browser). It should end up looking like:
 /usr/share/arduino/hardware
 /usr/share/arduino/hardware/arduino
 /usr/share/arduino/hardware/Sanguino
 /usr/share/arduino/hardware/tools
  • start the arduino IDE, there should be a shortcut in the menu popup
  • the first launch will ask to add your user to the dialout group, say yes.
  • check that the sketchbook directory was created in your home directory
  • shutdown and restart the PC (or virtual machine) so the dialout group change takes affect

At this point, the Sanguino support should be in place for the arduino IDE to use.

Find Sprinter

The current version of sprinter from github is at: https://github.com/kliment/Sprinter

So, the readme in the sprinter download says to do things in a slightly different order, and refers to the newer version "sanguinololu".

The arduino software is already in place.

The sanguino support has been copied into the hardware directory.

clone the branch from github:

 git clone https://github.com/kliment/Sprinter.git

So, I find the directory where sprinter is cloned: /home/sprinter/Sprinter/Sprinter

In Arduino, navigate to Sprinte.pde. NOTE: I moved the entire Sprinter subdirectory to the ./sketchbook directory, this way the sprinter project shows up in the sketchbook (projects) menu item of the arduino IDE.

Open sprinter sketchbook/project.

Verify.

Modify Sprinter files

When the tool successfully compiles (the default source code), mod the files to match my rig. Default code now compiles with no error. Modify files per my machine.

MAKE

I don't know if I need to touch the makefile if the arduino IDE does its job correctly. Skipping for now.

Configuration.h

No SD on this machine:

  // Comment out (using // at the start of the line) to disable SD support:
  // #define SDSUPPORT

Select Sanguino:

  // Sanguinololu 1.2 and above = 62
  // #define MOTHERBOARD 33
  #define MOTHERBOARD 62

OK, this is what I needed to change. Last time I had 57.11 & 700 (calculating by hand). Now the online calculator says I need 58.181818 and 625.70629055 (and I checked it, and the caculatin looks correct). This is the bit that should fix my print issues. How did I get 57.11 instead of 58.18? I didn't know what I was doing and/or I changed something with the mods I made.

Hold it! 57.11 and 58.18 are incorrect. I think I have XL belt, and the number should be 57.265569, update this after testing...

  //// Calibration variables
  // X, Y, Z, E steps per unit - Metric Prusa Mendel with Wade extruder:
  // #define _AXIS_STEP_PER_UNIT {80, 80, 3200/1.25,700}
  #define _AXIS_STEP_PER_UNIT {58.181818, 58.181818, 3200/1.25,625.70629055}  NO!

Proper bed travel for this machine:

  //-----------------------------------------------------------------------
  //Max Length for Prusa Mendel, check the ways of your axis and set this Values
  //-----------------------------------------------------------------------
  const int X_MAX_LENGTH = 190 ; // 200;  Only needs to be 190 for very tall (94 mm) objects; 205 for calibrating bed.
  const int Y_MAX_LENGTH = 180; //200;
  const int Z_MAX_LENGTH = 94; // 100

Sprinter.pde

Put in my own id string

 Serial.begin(BAUDRATE);
 showString(PSTR("Sprinter\r\n"));
 showString(PSTR("Sprinter20150116 DAW\r\n"));

This will confirm that the new firmware made it to the board. Good thing I put it in, too. The first couple attempts LOOKED like they completed, but in fact the old firmware string come up on the printer, so it didn't take. I recall there was some difficulty burning the firmware the first time around, got to re-figure this out and write down the cause and solution.

So now I take the line from sprinter.ino (sprinter.dpe) and move it to the top of the file:

  1. define _VERSION_TEXT "1.3.22T / 20.08.2012"

And mod it with a timestamp and note

  1. define _VERSION_TEXT "1.3.22T / 20.08.2012 - 20150131-1743 estepps"

and this pops up when I'm connected to pronterface.

run MAKE again - no

Actually, I don't think I need to run make again; the arduino IDE was able to verify with no errors. But this is what happened last time.

 test -d applet || mkdir applet
 echo '#include "WProgram.h"' > applet/Sprinter.cpp
 cat Sprinter.pde >> applet/Sprinter.cpp
 cat /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp >> applet/Sprinter.cpp
 make: *** No rule to make target `/usr/share/arduino/hardware/arduino/cores/arduino/pins_arduino.o', needed by `applet/core.a'.  Stop.

run Arduino IDE?

Need to log out and log in again for the "DIALOUT" group assignement to take affect.

restart the IDE. Use the Sprinter.pde as starting point.


Arduino IDE 1.0.5 (from software center) compiled successfully (after adding lines to sanguino ardiuno.h described above.

Cannot upload. Checking #troubleshooting as recommended by IDE error message. Check the jumper...

upload issue (pending)

device not responding was due to incorrect baud setting, my board was pre-loaded with bootloader set to 38400.

invalid device signature - under investigation

device not responsing (solved)

error message is:

 avrdude: stk500_recv(): programmer is not responding

Google says: The solution for me was to switch on verbose output during upload (in the arduino IDE preferences pane). also check that the correct Board is selected in the Arduino app (under Tools as of 1.0.6.

Turns out my bootloader (pre-burned, from arduino IDE 0023 timeframe) is 38400 baud.

updated /usr/share/arduino/hardware/sanguino

  atmega644.upload.speed=38400 

Message changed to:

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
        Double check connections and try again, or use -F to override
        this check.

So, at least the device is now responding.

UPDATE: This message means we are connected on the correct USB/serial (/dev/USBtty0). However, it means that the is NO BOOTLOADER. I guess my previous firmware was mistakenly loade with the hex option, which would overwrite the bootloader. Found a friend with a programmer, reloaded a bootloader.

invalid device signature (under investigation)

The device seems to be responding, but is not returning a valid signature. Whatever that means.

Make sure you're using the version of avrdude that comes with Arduino

I'm using the default download. Could there be another avrdude that comes with arduino, besides the default?

Many folks report the issue is cause by weak/intermittant connections, and can be fixed using stronger/soldered connections. My 644P in in a ocket, perhap the socket connections have corrroded over the (three) years? Try cleaning the pins/socket next.

the -F option

How to use the -f option?

Not at all. -F overrides things which simply have to work to be successful. --Traumflug (talk) 03:38, 22 January 2015 (PST)

Bootloader issue SOLVED

Turns out the ATMEGA644P needed to have a new bootloader. A friend used USBASP progprammer with arduino 1.0.5 and it now responds.

We think the last firmware upload may have been done using the hex upload method, which would have overwirtten the bootloader; or the old boot loader was custom and would only respond to an old version of the IDE. In any case the board appears to be accepting new progam now.

ALSO - Need to ensure in /usr/share/arduino/hardware/sanguinoboard.txt:

  atmega644.upload.speed=57600 

This was changed (possibly in the course of investigation). At least I knew the sanguinololu was functioning, and knew the issue must be in my own PC.

ALSO autoreset jumper needs to be in place.

redo the steps to clean them up

but first, install the new firmware on the printer, since that is the whole point of this exercise.

ENDSTOPS issues

  1. The endstops worked fine until I tried to change the firmware
  2. The hardware did not change
  3. the the endstops are connected Signal line to Ground line through the Normally Close connection of the mechanical endstops.
  4. the signal pin measures 0 volts when the mechanical endstop is not tripped.
  5. the signal pin measures 4.8-5.0 volts when the mechanical endstop is tripped.
  6. the M119 command shows the ends stops as low when untripped
  7. the M119 command shows the ends stops as low when tripped

All these indicate the firmware is misconfigured. Specifically, the I/O pin mappings are incorrect. The previous firmware used the standard ATMEGA644P mapping, and the current firmware uses the standard pin mapping.

Something must have changed between Arduino IDE 0023 and Arduino IDE 1.0.5 such that the endstop pins (and the X axis direction pin) have moved.

How to figure this out? How can it be that no one else has noticed this? A possibility is that all existing Sanguino hardware were sufficiently configured before said change, and there has been no need to update. Also, new builds would be using new Ramp 1.4 or Gen7, etc, hardware. Therefore, I well may be the first to notice, or the last to have this issue. It may be easier to get a new board rather than fumble through old code.

IDEA- try each of the previous sanguino download on google code unit one works. NO - using Windows XP and arduino 1.0.6, 0023 eliminated the "poisoned" error message, but the printer still behaves incorrectly.

20150128 - http://reprap.org/wiki/Sanguinololu#644P_Fuse_Settings

  Fuse Settings
  The fuses for the atmel chip must be changed from the default factory settings to disable JTAG.
  Symptoms of incorrect fuse settings:
  * X axis only moves in one direction.
  * Endstops do not work. 

This fuse settings error matches my printers behavior. This might be the case, since I believe I have eliminated all other likely conditions. I was fooled, I assumed since the printer had been working, the fuses must be correct (or at least NOT the factory default). Now the printer displays behavior which matches factory default fuse settings. Appearantly the fuses were jumbled/reset for factory condition when the new bootloader was loaded (from the sanguino download on google code).

I need to look at what conditions can overwrite the fuses. Need to wait until new programmer arrives to attempt a change.

So far though, it looks like the Windows XP Arduino 1.0.6 & 0023 compile error free, while linux 64 and linux 32 give "poisoned" error message.

sanguino-0101r1 - no

  • poisoned "SIG_USART1_RECV" message until source code is edited
  • endstops not recognized (despite 5 volts tripped, 0 volts not tripped)
  • X - direction pin always HI (5.0 volts) [ Y, Z, and extruder direction pins change from 5V to 0V]

Sanguino-0023r4.zip -NEXT

Start with colone of previous vritual machine, delete sanguino-0101r1 from hardware directory, and use 0023r4.

Change back commented lines from arduino.h?

First error message is SdFile.cpp:23:21: fatal error: Arduino.h: No such file or directory

#include <Arduino.h>
                    ^

So I guess this isn't the way to go.


Better try running the old stuff on windows.

Sanguino-0023r3.zip

Sanguino-0023r2.zip

Sanguino-0018r2_1_4.zip

Gen7 IDE - skip until Sanguino/Sprinter is exhausted

Gen 7 IDE might be the current thing that contains support for sanguino (NO) and newest arduino IDE. Gen 7 has support for ATMEGA644P, but NOT for Sanguino.

http://reprap.org/wiki/Gen7_Arduino_IDE_Support#Gen7_Arduino_IDE_Support_v2.1

Try this next. NO!

NOTE GEN7 CAN ONLY be use for Bootloader for the ATMEGA644P. Gen7 did not achieve successful compilation of the sprinter firmware for Sanguinololu.

Traumflug keeps saying the Gen7 should work with Sanguino, and the incorrect firmware will not harm my board.

I will try Gen7 again.

Gen7 compilation yields a similar "poisoned" error message as did sanguino-0101r1:

In file included from /usr/share/arduino/hardware/Gen7/cores/arduino/wiring_shift.c:25:0:
/usr/share/arduino/hardware/Gen7/cores/arduino/wiring_private.h:57:16: error: attempt to use poisoned "SIG_INTERRUPT2"
 #elif defined (SIG_INTERRUPT2)
                ^
/usr/share/arduino/hardware/Gen7/cores/arduino/HardwareSerial.cpp:161:15: error: attempt to use poisoned "SIG_USART1_RECV"
#elif defined(SIG_USART1_RECV)
              ^

Commenting out these lines allows the firmware to compile. However, upload yields dozens of timeout messages.

I think Gen7 is leading me further from my goal of functional Sanguino hardware.

copy sanguino definitions into Arduino install directories - installed from Software center

  • Find the arduino install directory, check the permission with
  cd /usr/share/arduino/; 
  ls -alF
  • Set permission so we can write to the hardware subdirectory, check they changes with:
 sudo chmod -R 777 hardware
  ls -alF
  • Extract the Sanguino [-0101r1] archive (wherever it was downloaded, this is what we will move shortly).
  • Copy the Sanguino directory to the Arduino install directory /hardware subdirectory (using the file browser). It should end up looking like:
 /usr/share/arduino/hardware
 /usr/share/arduino/hardware/arduino
 /usr/share/arduino/hardware/Sanguino
 /usr/share/arduino/hardware/tools
  • start the arduino IDE, there should be a shortcut in the menu popup
  • the first launch will ask to add your user to the dialout group, say yes.
  • check that the sketchbook directory was created in your home directory
  • shutdown and restart the PC (or virtual machine) so the dialout group change takes affect


Add user to DIALOUT group

At first launch, the Arduino IDE will add the current user to the DIALOUT group. This is required, as it allows us to access the USB virtual serial port /dev/ttyUSB0. The USB virtual serial port /dev/ttyUSB0 is the connection from the Arduino IDE to the Sanguino electronics. This will also be the connection to the PRonterface application on the PC, but we'll get to that in a minute.

If for somereason this did not happen automattically, here are the commands to set up the dialout group. In a terminal window, type the following:

  sudo adduser $USER dialout
 

Weird errors

I recieved lots of weird error messages the on several attempts at installing the Arduino IDE, the Sanguino support, and compiling the Sprinter source code. Compiling the sprinter firmware gave the error message:

/usr/share/arduino/hardware/sanguino/cores/arduino/HardwareSerial.cpp:132:15: error: attempt to use poisoned "SIG_USART1_RECV"
 #elif defined(SIG_USART1_RECV)
               ^

I cannot determine what caused this or what changed to make this go away. Perhaps it was the missing bootloader or the incorrect fuses. I thought it was due to the OS, the Arduino IDE version, or the Sanguino hardware support version. However, the source code now compiles successfully on Mint 16 32 bit and Mint 17 64 bit. The one thing I DO know is that the "fix" we find via a google search does NOT solve the problem, it only changes it into something else. That is:

 ...edite the Arduino.h in /usr/share/arduino/hardware/sanguino/cores/arduino adding...
    #define __AVR_LIBC_DEPRECATED_ENABLE__ 1 
 ...as third line. 

... may make the message go away, but something else goes wrong. and on and on. If things are set up properly, the message is not displayed in the first place.

Bear this in mind when performing the following steps.

invalid device signature -means- No Bootloader

For kicks, here is the full compile and verbose upload report. I think this says the the device is working and communicationg properly, the only issue is the signature is not set, and thesignal the upload operation to quit. Perhap it would succeded with the -F option?


Binary sketch size: 37,620 bytes (of a 63,488 byte maximum)

/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega644p -cstk500v1 -P/dev/ttyUSB0 -b38400 -D -Uflash:w:/tmp/build7737045225584187139.tmp/Sprinter.cpp.hex:i

avrdude: Version 6.0.1, compiled on Oct 21 2013 at 15:55:32
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch
        System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
        User configuration file is "/home/sanguino/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping
        Using Port                    : /dev/ttyUSB0
        Using Programmer              : stk500v1
        Overriding Baud Rate          : 38400
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
        AVR Part                      : ATmega644P
        Chip Erase delay              : 55000 us
        PAGEL                         : PD7
        BS2                           : PA0
        RESET disposition             : dedicated
        RETRY pulse                   : SCK
        serial program mode           : yes
        parallel program mode         : yes
        Timeout                       : 200
        StabDelay                     : 100
        CmdexeDelay                   : 25
        SyncLoops                     : 32
        ByteDelay                     : 0
        PollIndex                     : 3
        PollValue                     : 0x53
        Memory Detail                 :
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          eeprom        65    10   128    0 no       2048    8      0  9000  9000 0xff 0xff
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          flash         33     6   256    0 yes     65536  256    256  4500  4500 0xff 0xff
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                 Block Poll               Page                       Polled
          Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
        Programmer Type : STK500
        Description     : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [02] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [01] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [98]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
        Hardware Version: 2
        Firmware Version: 1.16
avrdude: Send: A [41] . [84]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [85]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [86]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [87]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [89]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
        Vtarget         : 0.0 V
        Varef           : 0.0 V
        Oscillator      : Off
        SCK period      : 0.1 us
avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [01] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Recv: . [10] 
avrdude: Send: B [42] . [82] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [01] . [00] . [08] . [00] . [00] . [01] . [00] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: E [45] . [05] . [08] . [d7] . [a0] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: P [50]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: AVR device initialized and ready to accept instructions
Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00]   [20]  
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
################################## | 100% 0.01s
avrdude: Device signature = 0x000000 (retrying)
Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
################################## | 100% 0.01s
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
        Double check connections and try again, or use -F to override
        this check.
avrdude: Send: Q [51]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude done.  Thank you.

Again, the above message (from Verbose setting) indicates that while the chip wants 38400 baud, and would talk if it were able, it has no bootloader, and a bootloader must be uploaded to the chip before we can move forward.