A working avrdude config for LeoStick

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Post Reply
User avatar
AndyA
Posts: 3
Joined: Fri Jul 20, 2012 6:00 pm

A working avrdude config for LeoStick

Post by AndyA » Fri Jul 20, 2012 6:24 pm

Hi,

Has anyone had success uploading to LeoStick using avrdude?

I have no problem uploading using the Arduino app on Mac OS; I selected Board -> Arduino Leonardo and it just worked. It doesn't require me to reset the LeoStick.

I've tried a range of settings for avrdude on Debian without success. I use the same Debian box to program Unos without a problem - pretty confident that I've got the toolchain set up correctly.

It doesn't actually have to be avrdude - I'm looking for any way to program LeoStick from a Linux command command line.

Thanks :)

Daniel Ng
Posts: 3
Joined: Sun Jul 22, 2012 10:57 am

Re: A working avrdude config for LeoStick

Post by Daniel Ng » Sun Jul 22, 2012 1:19 pm

I've got the same problem with my Arduino 1.01 Vista 32 system.

AVRDude reports the following when I try the 'Upload' command:
avrdude: stk500_getsync(): not in sync: resp=0x3f

'Upload Using Programmer' gives this error:
avrdude: usbdev_open(): did not find any USB device "usb"

'Programmer' is set to 'AVRISP mkII'. I've tried it with the other Programmers without success.

Not sure if these are related to the symptoms Andy was getting on his Linux system.

Any suggestions would be most appreciated...

Perhaps there's a way to test the serial connection somehow?

SteveCares
Posts: 3
Joined: Sat Jul 21, 2012 1:59 pm

Re: A working avrdude config for LeoStick

Post by SteveCares » Sun Jul 22, 2012 2:02 pm

The answer may be here.
viewtopic.php?f=27&t=726

Set the Tools | Board to Arduino Leonardo
And press reset immediately after File | Upload

Seems to work for me now.

User avatar
AndyA
Posts: 3
Joined: Fri Jul 20, 2012 6:00 pm

Re: A working avrdude config for LeoStick

Post by AndyA » Mon Jul 23, 2012 7:50 am

Thanks Steve. I want to upload without using the Arduino IDE. As I said in the OP it works fine for me with the IDE if I select Leonardo as the board type.

cef
Freetronics Staff
Freetronics Staff
Posts: 106
Joined: Wed Nov 09, 2011 12:53 am

Re: A working avrdude config for LeoStick

Post by cef » Mon Jul 23, 2012 1:11 pm

AndyA: What command line have you tried to avrdude? Specifically the -p option?

User avatar
AndyA
Posts: 3
Joined: Fri Jul 20, 2012 6:00 pm

Re: A working avrdude config for LeoStick

Post by AndyA » Mon Jul 23, 2012 6:22 pm

Here's what I've tried so far:

Code: Select all

/usr/bin/avrdude -V -F -C /etc/avrdude.conf -p atmega32u4  -P /dev/ttyACM0 -b 57600 -c avrispmkII -U flash:w:leostick.hex
/usr/bin/avrdude -V -F -C /etc/avrdude.conf -p atmega32u4  -P /dev/ttyACM0 -c arduino -b 1200 -U flash:w:leostick.hex
/usr/bin/avrdude -V -F -C /etc/avrdude.conf -p atmega32u4  -P /dev/ttyACM0 -c arduino -b 57600 -U flash:w:leostick.hex
/usr/bin/avrdude -V -F -C /etc/avrdude.conf -p atmega32u4  -P /dev/ttyACM0 -c avrispmkII -U flash:w:leostick.hex
/usr/bin/avrdude -V -F -C /etc/avrdude.conf -p atmega32u4  -P /dev/ttyACM0 -c avrisp -U flash:w:leostick.hex
So always atmega32u4 for the -p option.

wintrmute
Posts: 6
Joined: Sun Mar 04, 2012 8:13 am

Re: A working avrdude config for LeoStick

Post by wintrmute » Tue May 07, 2013 5:36 am

I have this working with a LeoStick, version 1.

/usr/bin/avr-gcc -mmcu=atmega32u4 -Wl,--gc-sections -Os -o build-leostick/apps.elf build-leostick/blink.o build-leostick/libcore.a -lc -lm

/usr/bin/avr-objcopy -O ihex -R .eeprom build-leostick/apps.elf build-leostick/apps.hex

/usr/bin/avrdude -q -V -p atmega32u4 -c arduino -b 1200 -P /dev/ttyACM0 \
-U flash:w:build-leostick/apps.hex:i

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: A working avrdude config for LeoStick

Post by angusgr » Tue May 14, 2013 12:59 am

What wintrmute gives should work great for v1 bootloaders. For v2, the avrdude line should be:

Code: Select all

avrdude -patmega32u4 -cavr109 -P<port> -b57600 -Uflash:w:myprogram.hex:i
However unlike the v1 bootloader this avrdude line will not automatically cause the LeoStick to enter the bootloader. You can do this manually by pressing the Reset button immediately before running avrdude, or on OSX/Linux run:

Code: Select all

stty -F <port> 1200
Immediately beforehand, to set the serial port to 1200bps (which the LeoStick v2/Leonardo firmware uses as its signal to start the bootloader.)

I don't know of a way to set the serial port speed programmatically from the command line in Windows, maybe someone else does.

LukeW
Posts: 91
Joined: Tue Nov 01, 2011 10:14 am

Re: A working avrdude config for LeoStick

Post by LukeW » Thu Feb 27, 2014 7:06 am

Hmm, it works just fine for me on OSX, running avrdude from the command line, programming a LeoStick with a Freetronics USBASP.

Code: Select all

avrdude -p atmega32u4 -P usb -c usbasp -U flash:w:filename.hex
Obviously this depends on your programmer type - yours may vary, specify it appropriately.
The port needs to be specified appropriately too, for example if your AVR programmer is a serial port device then specify the right serial port.

Also remember that you can hold down shift (or whatever it is, can't remember exactly right now) to put the Arduino IDE in a verbose mode so you can see what it does - including the syntax of the parameters it uses when it runs avrdude, which may be helpful.

The version of avrdude you have may also be important.

Post Reply