PrusaFirmwareBraino

From RepRap
Revision as of 19:30, 18 January 2015 by Prof braino (talk | contribs) (Weird Error Message)
Jump to: navigation, search

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. PC is running Linux (Mint 17, similar to Ubuntu).

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

sprinter instructios are broken for sanguino / sanguinololu

It seems the names sanguino was changed to sanguinololu at some point. I find that all the references to the Sanguino support now point to a binoculars manufacturer in Australia. Specifically in https://github.com/kliment/Sprinter The readme instructions specify: 3. Get the sanguino software, version 0023 http://sanguino.cc/softwareforlinux

Because this does not lead to sanguino / sanguinololu support, the instructions for sprinter cannot be completed.

Note: Sanguino is an early Arduino board derivative and as it featured an ATmega644P, it required changed Arduino libraries, the Sanguino add-on. Sanguinololu is one of the successors of Generation 3 Electronics and uses the very same chip (or an 1284P), so it used the Sanguino add-on as well. Sanguino board is long gone, but the library still works with Arduino IDE before v1.0 (v0023? v0028?). That said, Gen7 Arduino IDE Support comes with a likewise changed, but updated Arduino library and should get Sprinter to compile on recent Arduino IDEs. In case you happen to actually want that, because Teacup Firmware is smaller as well as faster and features about everything Sprinter does (and a bit more). --Traumflug (talk) 13:18, 16 January 2015 (PST)

Tried Gen7 IDE. The Gen7 Arduino IDE did NOT work with the sanguino, at least according to the instructions I found; likely because the instructions (regarding sanguino) are in bits and peices, and written for other hardware than the sanguino board. There may be a specific Gen7 configuration that is identical to sanguino, but I have not anything that says such. I will come back to Gen7 if I cannot get the recommended firmware to work.

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.

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/detail?name=Sanguino-0101r1.zip

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.

copy sanguino definitions into Arduino install directories

NOTE: these files are likely different from material in Gen7 or Marlin, so I would have to start over from scratch if this doesn't work again.

  • 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
       /arduino
       /Sanguino
       /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

Verify.

Weird Error Message

Error message is:

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

What the heck does this mean and how do I fix it? Google 'attempt to use poisoned "SIG_USART1_RECV" '

Calling it a day, stopping 20150117.

This page http://reprap.org/wiki/Monotronics says"

   Linux Users, this may help
   (--KD0SKH): If you receive the error HardwareSerial.cpp:132:15: error: attempt to use poisoned "SIG_USART1_RECV when attempting to compile, edit the sanguino's HardwareSerial.cpp file with the path listed in the error code. 
    Comment out the following expressions #elif defined(SIG_USART1_RECV) and #error SIG_USART1_RECV). Afterwards you should be able to compile and upload your FiveD firmware! 
    Works with Arduino IDE 0018 and 0022 on Arch Linux with kernel version 3.12.5. Other potentially relevant information about my environment: avr-gcc 4.8.2, avrdude 6.0.1, libusb-compat 0.1.5, and java-rxtx 2.2pre2 were present on my system. 

edited the Arduino.h in /usr/share/arduino/hardware/sanguino/cores/arduino

NOTE: do NOT edit the other arduino.h files, i.e. /usr/share/arduino/hardware/arduino/cores/arduino. We only want to edit the one in the sanguino part.

Verify now runs, no error reported.

Dare I try to burn my new firmware into the sagunio at this point? It will either fix my problem, or risk bricking my board.

CONTINUE FROM HERE!!!!!!

Modify Sprinter files

When the tool successfully compiles (the default source code), mod the files to match my rig...

MAKE

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

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. Now the calculation says I need 58.181818 and 625.70629055. This is the bit that should fix my print issues. How did I get 57.11 insttead of 58.18? I didn't know what I was doing.

  //// 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}'

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;
  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"));


run MAKE again

 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 startingg point.

Didn't compile. copied sprinter directory into sketchbook direcotory.

Didin't compile. Could not find Arduino.h, which is in /usr/share/arduino/hardware/arduino/cores/arduino. What is this problem?

This is the problem, from http://reprap.org/wiki/Sanguinololu#Firmware:

 You can do this using the USB cable and the Arduino IDE (v0022, 1.0 has issues with the Arduino library coming with the Sanguino extensions). 

That is, CANNOT use Arduino 1.x, MUST use 0023 or earlier.


Try to fix? -- NO, beyond scope today.

This page http://forum.arduino.cc/index.php?topic=162194.0 says:

  You can't use a post 1.0 library with pre 1.0 versions. Time to upgrade. Or downgrade the library.

So I need to use Arduino-0023, not Arduino 1.0.6; unless I can figure out the fix.

this is in the release note from 0023 to 1.0

  • The WProgram.h file, which provides declarations for the Arduino API,
 has been renamed to Arduino.h. To create a library that will work in
 both Arduino 0022 and Arduino 1.0, you can use an #ifdef that checks
 for the ARDUINO constant, which was 22 and is now 100.  For example:
 #if defined(ARDUINO) && ARDUINO >= 100
 #include "Arduino.h"
 #else
 #include "WProgram.h"
 #endif

So if Iadd this to the new stuff, it should also find the old stuff in Sanguino ?

There are many occurances of WProgram.h in these files,

  Sprinter.h:  #include <WProgram.h>  
  applet/Sprinter-old20150115-1654.cpp:#include "WProgram.h"
  applet/Sprinter.cpp:#include "WProgram.h"
  Makefile:	# On top of the new .cpp file comes the WProgram.h header.
  Makefile:	echo '#include "WProgram.h"' > applet/$(TARGET).cpp
  SdFile.cpp:#include <WProgram.h>
  SdFatUtil.h:#include <WProgram.h>
  Sd2Card.cpp:#include <WProgram.h>


adding the change to: sprinter.pde - no makefile - no All files listed above -no, already present This is not the fix.

-- stop trying to fix Arduino IDE 0023 -> 1.x issue, used up allotted time.

install Arduino IDE 0023

REmove Arduino IDE 1.x: sudo apt-get remove arduino arduino-core

left Sangunino directory in /usr/share

so the following are still present:

 /home/sprinter/sketchbook/Sprinter 
 /usr/share/arduino/hardware/Sanguino

extract 2. arduino-0023.zip from backups

Move extracted materials to /usr/share/arduino Duh! backup was from windows, download arduni0023.zip for linux 64 from net. Move to user share.

Try arduino-0023-65: error

In file included from /usr/share/arduino/hardware/Sanguino/cores/arduino/WConstants.h:1:0,
                from /usr/share/arduino/hardware/Sanguino/cores/arduino/WInterrupts.c:32:
/usr/lib/avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
extern double round (double __x) __ATTR_CONST__;
              ^
/usr/share/arduino/hardware/Sanguino/cores/arduino/wiring.h:73:26: error: expected ‘)’ before ‘>=’ token
 #define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

So something is wacked. Kill the virtual machine and start from scratch, this time install arduino 0023-64 from the start.

Linux Mint 17 Mate 64 & arduino 0023

Don't forget to check for DIALOUT group!

You will need to install some programs to use Arduino under Linux (the way you do this depends on your distribution):
   openjdk-7-jre (although openjdk-6-jre, sun's java 6 runtime, the sun-java6-jre package or the oracle JRE 7, should work too)
   it is HIGHLY recommended to use arduino IDE 1.0.1, because it use an internal pre-build gcc compiler. This exclude all tool-chain problem, or at least guarantee we all have the same problem. Also this mean you don't need to install all the above package anymore. That's it, no more other Requirements, you can skip the rest of this section.
       If you want to use your system's compiler, delete the folder ./hardware/tools/avr in your arduino IDE installation
       If you still want to use older Arduino IDE version, then you need avr-gcc (aka "gcc-avr"), version 4.3.2 or later 4.3.x version (4.4.x and 4.5.x seem to have various problems)
           Version 4.3.0 has a major bug which affects multiplication of long int's. This is the default version in Ubuntu Intrepid (8.10). Check using "avr-gcc --version" and upgrade if necessary.
           Versions prior to 4.3.0 do not support the ATmega328 (which comes on the Arduino Duemilanove). People running distributions like Hardy Heron (Ubuntu) or Etch (Debian) and previous will need to upgrade their version of avr-gcc.
           Version 4.7 have break some older standard and the arduino core class give some compiling error. 
       avr-gcc-c++ (Else you will get this error: Cannot run program "avr-g++":j ava.io.IOException:Error=2: No such file or directory)
       avr-libc 
Download the latest Arduino Linux distribution from the arduino dowload section. Copy/extract these files to a directory (or your desktop) and Run the "arduino" script. Be sure that the full extracted directory location/name has no spaces in the /location/name.

this might do it

from http://playground.arduino.cc/Linux/Ubuntu

sudo apt-get install gcc-avr avr-libc
sudo usermod -aG dialout <myuser>


MAN! setting up the sprinter firmware was a B17C4! in windows. It should be easy in linux, and it would be. Unfortunately,there is no modern version of Sanguino support (its changed to sanguinololu but cannot be found). Because of this, we can NOT use the most modern version of Arduino IDE, (insttead we need 0023 or earlier),

The only thing that looks ok is sprinter itself, as this will work on whatever hardware we have set up.

NOTE to SELF - find hardware that is supported, Melzi might be better on next build.

another try

Even though I gave up on sprinter due to lack of sanguinololu support code, I may try agian. I stumbled across sanguinololu on goolge code.

http://code.google.com/p/sanguino/downloads/list

clone

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

=== sanaguino 1

Gen7 IDE

Gen 7 IDE might be the current thing that contains support for sanguino and newest arduino IDE

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

Try this next

Installation

  1. Have Arduino IDE already available.
  2. In case Arduino IDE is already running, quit it.
  3. Download and unpack the IDE support package. Links see above.
  4. Open the folder containing Arduino in your file manager. [ The following is Not applicable to me] --> On Mac OS X this is done by right-clicking the Arduino.app icon and choosing "Show package content". Then navigate further down to Contents/Resources/java. --
  5. Find the folder Gen7 in the support package and move it into the hardware folder inside the Arduino package.

There are also install instructions inside the Gen7 Arduino IDE Support package.

Note: for Linux/Unix users, if you install using your package manager it may be difficult to find your arduino/hardware folder, and even after you find it you might not be able to copy into it. Just make a "hardware" folder in the "sketchbook" folder of your home directory and put the Gen7 support folder in there. The "sketchbook" folder appears when you run the IDE the first time.

Did not work, various error messages. Skipping SPRINTER, trying MARLIN

Marlin

The next firmware option listed is Marlin http://reprap.org/wiki/Marlin

The Arduino IDE version 1.0.5 is what the softwaere center found, installed.

Set MOTHERBOARD using string from boards.h:

  1. define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above

Compile/Verify:

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