Sunday, 7 June 2015

How to install sanguino in arduino 1.6.4 for linux

Edit: This is not the best way, see  better way 

-----------------------------------------------------------------------------------

Original post for the curious. It works but uses legacy code that isn't current.

-----------------------------------------------------------------------------------

Several people of late have been asking how to get Sanguino support working in Arduino 1.6.4  so they can use it on Sanguinololu and Gen7 Reprap controllers.

Here is how to do it manually:

Firstly install the latest Arduino IDE and install as per usual

Also download the standard  Sanguino files 1.0.1, extract to in my case arduino-1.6.4/hardware

Now the fun part starts

cd into arduino-1.6.4/hardware/sanguino
mkdir avr
mv * avr     (moves everything into the new subdirectory, except avr, as its locked)

Now we need to create a new platform.txt, best to copy it from the arduino directory

cd avr
cp ../../arduino/avr/platform.txt .

Now edit the new platform.txt 

Find "name=Arduino AVR Boards" and change it into "name=Sanguino AVR Boards"

Now Sanguino is visible in the Arduino IDE but you still cant upload.

Uploading gives the error "Error while uploading: missing 'upload.tool' configuration parameter"

To fix this add {board name}.upload.tool=avrdude to each board section of your sanguino boards.txt

eg
atmega644.upload.tool=avrdude
atmega12848m.upload.tool=avrdude
atmega1284.upload.tool=avrdude


It now Compiles and uploads

NB I have tested this briefly on a 644p Sanguinololu, but not thoroughly. 

 

Addendum:

There is an additional issue that presents itself on 644p but not on 1284p
I don't know the cause, if its marlin or the sanguino files. 

If you get the error

"/arduino-1.6.4/hardware/sanguino/avr/cores/arduino/HardwareSerial.cpp:132:15: error: attempt to use poisoned "SIG_USART1_RECV"
 #elif defined(SIG_USART1_RECV)"


I had to edit hardware/sanguino/avr/cores/arduino/HardwareSerial.cpp
I commented out lines 132-133
//#elif defined(SIG_USART1_RECV)
//  #error SIG_USART1_RECV

It now compiles.

I had further issues with uploading

The dreaded "avrdude: stk500v2_ReceiveMessage(): timeout"
This is a well known issue where the bootloader is not what the boards.txt expected. It can be the baud rate or the protocol.

In my case it was a old protocol
I changed the following in boards.txt
atmega644.upload.protocol=stk500

to

atmega644.upload.protocol=arduino

And it uploaded fine.

3 comments:

  1. Thanks very much for the write up. This helps me get Sanguino working with new Arduino 1.6.5 in no time

    ReplyDelete
  2. I tried all the options, all the Menu->Programmer all of them. All I get is:
    Binary sketch size: 52,002 bytes (of a 131,072 byte maximum)
    avrdude: stk500_recv(): programmer is not responding
    Binary sketch size: 52,002 bytes (of a 131,072 byte maximum)
    avrdude: stk500_recv(): programmer is not responding
    Binary sketch size: 52,002 bytes (of a 131,072 byte maximum)
    avrdude: stk500_recv(): programmer is not responding

    ReplyDelete