PrusaFirmwareBraino

From RepRap
Revision as of 11:50, 20 January 2015 by Glenn (talk | contribs) (Marlin: wiki)
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/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 thetop of the google search results, but is not link in the actual instructions for sanguino, sanguinololu, sprinter. This is why it took a long time to find the correct sanguino package.

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

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
 /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.

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" '

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. 

This page http://forum.arduino.cc/index.php?topic=92364.msg814661#msg814661 says: add this as the third line to arduino.h

   #define __AVR_LIBC_DEPRECATED_ENABLE__ 1

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

    #define __AVR_LIBC_DEPRECATED_ENABLE__ 1 

...as third line.

NOTE: Do NOT edit any other arduino.h file, i.e. /usr/share/arduino/hardware/arduino/cores/arduino. We only want to edit the one in the sanguino part. If you edit (the same file at a different path) the change will not have the desired affect, and may mess up something else.

Verify now runs, no error reported. That was a B1tch!

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. Do it, at worst I get to buy a newer and easier to support board.

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.

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

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.

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

figure out upload issue

device not responsing

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.

figure out invalid device signature

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 error message

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.

the -F option

How to use the -f option?

CONTINUE HERE 20140119-1800

  • * * * *

Gen7 IDE - skip until sprinter is exhausted

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.

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)
              ^