Sunday, 19 June 2011

Sprinter firmware and Sanguinololu

I installed Sprinter firmware into my Sanguinololu

The process has a few niggles I had to work out, so I will mention them here.

Firstly you need to get the Arduino Software from here or if you have Ubuntu 11 you can simply apt-get install arduino

Then you need to get the sanguino software from here
Extract this into the appropriate place your your system.

[edit: only needed for version 1.0 or 1.1 boards]
Once you have extracted the files edit the boards.txt file and change the line
sanguino.upload.protocol=stk500 to  sanguino.upload.protocol=arduino

Without this line Arduino would not upload the firmware, insisting that the hardware ID didn't match.


You also need to get a copy of Sprinter from here

Load up arduino and change your board type to  Sanguino and set your serial port to the one that is connected to your Sanguinololu.

Now load the Sprinter Sketch 

Go to the configuration.h page and edit the line
#define MOTHERBOARD to be #define MOTHERBOARD 62 [for version 1.3a]
 
You also need to edit other parts of this file to match you hardware.

I also don't have any end stops, so I had to disable these, to do this edit pins.h

At the bottom of this file you will find a section that starts with
#elif MOTHERBOARD == 62 [for version 1.3a] 
 
In this section change  
#define X_MIN_PIN
#define Y_MIN_PIN
#define Z_MIN_PIN
 
to all be -1, ie disabled.

Hit compile,there should be no errors

Hit upload and it should upload to the Sanguinololu. It should upload without issues

Sometimes I find arduino just wont connect, I find that pressing the reset button on the
Sanguinololu and the upload button simultainiously seem to get around this.

Thursday, 16 June 2011

Sanguinololu Fuses!

I was getting no where with uploading the new firmware to my Sanguinololu.

So I read up on the boot loader, and it says that the PB0 line is pulsed 3 times, so I attached a led and resistor to it as documented in http://sanguino.cc/hardware


As you can see it nicely connects to the last pin on each row of the connectors


I got no flashes...

This basically means things are not running 


Then i found out about fuses

These set various boot options, and there are some nice Fuse calculators out there.. eg http://www.engbedded.com/fusecalc/

From the Sanguino boards.txt file i found the correct settings for the 3 fuse bytes


sanguino.bootloader.low_fuses=0xFF
sanguino.bootloader.high_fuses=0xDC
sanguino.bootloader.extended_fuses=0xFD

I have now set these with the command

avrdude -B 8 -patmega644P -cavrispmkII -Pusb -U lfuse:w:0xFF:m -U hfuse:w:0xDC:m -U efuse:w:0xFD:m

Which resulted in

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e960a
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xDC"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDC:
avrdude: load data hfuse data from input file 0xDC:
avrdude: input file 0xDC contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
 



The LED now flashes as it should.

I still cant upload my firmware, but it is now trying... getting closer

Wednesday, 15 June 2011

Installing the boot loader

I borrowed a Atmel MKII AVR programmer from work and after a few attempts I managed to install the boot loader

The wiki says to use the following

avrdude -patmega644P -cavrispmkII -Pusb -U flash:w:Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex

But this result in the following error.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 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 done.  Thank you.


The command I found that works is as follows, it slows down communications.

avrdude -B 8 -patmega644P -cavrispmkII -Pusb -U flash:w:Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex


avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e960a
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex"
avrdude: input file Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex auto detected as Intel Hex
avrdude: writing flash (65382 bytes):

Writing | ################################################## | 100% 0.64s

avrdude: 65382 bytes of flash written
avrdude: verifying flash memory against Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex:
avrdude: load data flash data from input file Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex:
avrdude: input file Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex auto detected as Intel Hex
avrdude: input file Sanguino/bootloaders/atmega644p/ATmegaBOOT_644P.hex contains 65382 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 20.42s

avrdude: verifying ...
avrdude: 65382 bytes of flash verified


Now to look into compiling sprinter firmware

Monday, 13 June 2011

Sanguinololu construction

This is one of the new all in one boards to control a reprap. For details see Sanguinololu 

I got sent this motherboard from a guy I met on the #reprap  and I orded all the parts from mouser.com 

I assembled it as per the instructions on the above page.

The empty board

The hardest part, a tiny surface mount IC. This is the Serial over USB chip.


The rest of the USB assembly.  I tested this, the computer found a new serial device as it should. :)


Add in the headers for the Pololu stepper controller Boards


Added in the Jumpers

And related Pololu resistors and Capacitors

Add in the CPU holder and Crystal and remaining components.


And inserted the CPU.

The connectors are on just to stop the pins being bent.

I haven't tested this yet, and I need to borrow a Programmer from work to put boot loader into it.

Saturday, 4 June 2011

The good the bad and the ugly

When things go well, I can get really good 3D prints





These are really nice prints, accurate and looking nice, they glisten in the sun and look like spun candy!


But things don't always go so smoothly.

When I first built this machine I really didn't like the way the Y axis was made
It consists of a nut, a Fender washer, a small washer, a bearing, another small washer, another fender washer and another nut.

The belt is meant to run over the bearing. But the belt is only 5mm and the gap it is in is about 9mm and the belt likes to wander about, left or right, but never staying in the center. This is really bad. Eventually the belt wanders so far off center it binds solid to the Fender washer, which don't move, and all Y movement stops solid.  This has happened to many times now.

So I have replaced this arrange meant with a printed part
Now no matter how much it feels like moving, it cant bind as all parts it can touch move around the bearing on the inside of this belt holder.

Unfortunately when It locked up last time it broke the glue holding my Pulley to the stepper motor shaft.

But i didn't know this till after the next print
This is really ugly, as you can see the are gaps in the Y axis cased by the Pulley not being fixed any more.

The problem is all fixed again now (the top images where printed after this was fixed.)