Friday, 26 October 2012

The Rostock moves!

I hooked up the steppers and end stops today to my Rostock

I then wrote a simple bash script to generate gcode movements (rand x,y,z from -50 to +50)

It moves!!!  in its expected delta way!

Some gotchas:

You need to have the end stops enabled and attached, the first thing the rostock firmware wants to do before any moves is home upwards to the end stops.

I got around this by powering up without end stops (since my end stops are normally closed) So it presumed that power on positions was (0,0,0) I then attached end stops to allow it to move with out warnings.

Secondly, its really loud!!!  Most of the time you have all 3 steppers moving, and the wooden base seems to be amplifying the sounds. It may get quieter once I add the side boards and turn it up the correct way (currently running upside down)





  Just some random moves

Monday, 22 October 2012

Rostock marlin on Sanguinololu 1.2


I got some time this weekend to look at a few reprap things.

Firstly I upgraded my old Sanguinololu 1.0 board to 1.2 compatibility by following this


This took some time as its quite fiddly!  Also when I tested I found that my solder had re-bridged one of the cuts in the PCB, so I had to scrape away more copper. The moral is always test everything!

I upgraded the board to 1.2 as Marlin software needs Sanguinololu 1.2 or greater.


I uploaded the Rostock firmware, and had the same issue I originally had on my 1.3a board, the temperature reads 175C in a 20C room.  All setting are correct.

So next I upgraded the 644p to a 1284p chip.

If you zoom into this picture you can just make out the 1284 written on it, other than that it just looks like a 644p (it is fully pin compatible)

I went threw a few iterations of trying to get a boot loader onto this chip, but here is the way that worked for me.

Download the needed files from https://github.com/jmgiacalone/sanguino1284p  

I already have Sanguino-0023r4.zip installed in my arduino, and it comes with boot loaders for 1284p, but they don't seem to work. Copy the / Sanguino / bootloaders / standard directory from the github file into your arduino/hardware/Sanguino/bootloaders directory. Then edit your boards.txt file edit the
ATmega1284p 16mhz section to match the one in the github file above.

I then manually flashed the bootloader with my pololu avr. (I cant get this to work from within arduino, there is no easy way to set the -B options)

>avrdude -B3 -pm1284p -cavrispv2 -P/dev/ttyACM0 -U flash:w:ATmegaBOOT_1284P.hex -C avrdude.conf

Then I set the Fuses. These are different from a standard 644p

1284p fuses
Low 0xD6
High 0xDC
Ext  0xFD

As mentioned in the boards.txt in the github files.

>avrdude -B5 -pm1284p -cavrispv2 -P/dev/ttyACM0 -U lfuse:w:0xd6:m -U hfuse:w:0xdc:m -U efuse:w:0xfd:m  -C avrdude.conf

The fuses are now set.

A quick test in the Arduino IDE setting the board to be  "Sanguino W/ ATmega1284p 16mhz" and compiling and uploading the Example program blink worked as expected (I have to press reset and a moment later click upload)  NB there is no flash-able LED on the SL board unless you add one, so if your expecting a led to blink you will be disappointed.

I then compiled and uploaded Rostock firmware to the 1284p. It compiled and uploaded fine.


I connected to the Sanguinololu with Rostock firmware on the 1284p with Pronterface. For the first time the temperature reads 20C as it should!

Next step is to test the rest of the board works as expected on the Rostock.


Monday, 1 October 2012

4pi tool chain

Attempting to get any code to compile for the 4pi has had a few issues.

So I will document what I've found to try and help out others.

You need a compiler, I wanted to use sourcery-codebench the web site is very confusing as they don't really want you to find or use the Lite version (well that's the impression I get)

You need to click on Download the EABI Release can be found under ARM processors on http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ 
They want you to register, and will send the link to your e-mail address.

You end up with arm-2012.03-56-arm-none-eabi.bin or arm-2012.03-56-arm-none-eabi.exe depending if your using Linux or windows

Installing is straight forward, just run the file, it launches A GUI installer.

Next you need something to compile

Although it not finished yet, it does compile (after some issues are sorted) so I got sprinter for 4pi from https://github.com/kliment/reup

Kliment advises me this url is obsolete it should be https://github.com/kliment/4pi-firmware 

Using the old version as a demo clone this git repository with you favourite git client, eg "git clone https://github.com/kliment/reup"


Make your way to 4pi-firmware/src and type make.

This should result in the arm binary being generated, I got the following error

tmp/ccVFQZtE.s: Assembler messages:
/tmp/ccVFQZtE.s:318: Error: registers may not be the same --
strexb r0,r0,[r1]'
/tmp/ccVFQZtE.s:333: Error: registers may not be the same -- strexh r0,r0,[r1]'

Googling this provided lots of false leads...  most people giving up and getting an older version of sourcery-codebench

I found one line in a conversation "Patch available at git://gist.github.com/1942280.git"   I took a look.

This provides a patch file. https://gist.github.com/1942280

This Patch fixes the issue.

You need to apply this patch to 4pi-firmware/external_libs/cmsis/core_cm3.c
There are only actually two characters that need changes

"=r" (result)  becomes "=&r" (result) on lines 721 and 738 
 
now make works correctly.

NB this issue only triggers if you use -O (optimization) flags while compiling, which is the default in the firmware make file.

Update

If you use the most up to date version of the firmware from https://github.com/kliment/4pi-firmware
It compiles without issues. The above patch is already in there (I found this out after writing this). So it is only needed if you trying to compile other demo arm programs such as a LED flasher, which provide the buggy version of the library.



The next tool you need is SAM-BA (not to be confused with emulating windows networking under Linux samba)

This is the tool that lets you upload binary’s via the boot loader into the ARM/4pi
SAM-BA is available here 
http://www.atmel.com/tools/ATMELSAM-BAIN-SYSTEMPROGRAMMER.aspx

With these tools I have now managed compile a demo LED flasher application for the 4pi and upload it. It works brilliantly (pun intended as the LEDS are very bright)

Which lead to the next issue, now you have new firmware in the 4pi you dont get to see the boot loader again (unlike the Arduino). There is a trick to this, you need to short the two Pads on the lower right hand side of the 4pi (labeled erase) and then reset. This restarts the boot loader.