Hang during upload (Win7 x86-64)

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Posts: 13
Joined: Wed May 09, 2012 4:24 pm

Re: Hang during upload (Win7 x86-64)

Post by squirrel » Thu May 10, 2012 3:52 pm


I am waiting on Jon for a solution on this one but in the meantime I thought I would ask a question.

It is possible that what I am seeing with my Leostick is the same problem being discussed here.

I am guessing that the last sketch I uploaded is actually crashing the mcu chip as well
which means the bootloader can't do it's thing properly
and interact with avrdude in the IDE properly.

As has been mentioned it's more or less impossible to synchronise
the reset/bootloader with the upload/avrdude cycle of the IDE
especially in Windows ( using XP ) and this just does not work for me
in Windows and a reset when avrdude runs causes a write error
(no info available in IDE) every time.

So jagging it in Windows is not gonna work folks.

I do have various versions of Linux and could load
this onto other machines I have. Just not that
knowledgable with Linux is all.

Could anyone here advise me as to how to proceed
with a Linux recovery of leostick ?

User avatar
Freetronics Staff
Freetronics Staff
Posts: 298
Joined: Sat Oct 15, 2011 11:31 am
Location: Melbourne, Australia

Re: Hang during upload (Win7 x86-64)

Post by jonoxer » Sun May 13, 2012 11:42 am

Hi @squirrel, sorry I haven't replied in the other thread yet, I've been checking on some things with Marc before replying because I don't actually have any Windows machines myself. I feel quite out of my depth trying to provide support for Windows users when the only time I've ever touched a Windows machine is odd times here and there when I've had to use someone else's computer!

Linux, though, *that* I'm comfortable with :-)

You mentioned that you also have Linux machines handy, so my suggestion is to download Arduino IDE v1.0 for the appropriate architecture and install it on one of those boxes:


You'll also need to follow the steps for enabling the "Leonardo" board profile, the same as you would have done on your Windows machine:

http://www.freetronics.com/pages/leosti ... rted-guide

Note that you *don't* have to install a .inf file or any other USB setup on Linux. That's only required for Windows: on Linux it just works, nothing else required.

So to summarise the problem, your LeoStick is in a state where the program installed in it crashes the MCU. To get out of this state you need to upload a different program in the brief window during which the bootloader is operational (about a 7 second window) immediately after it starts up. Doing this on either Linux or Mac is much easier than on Windows because they both enumerate the port much faster.

At this point you're ready to upload a new program, so select "Blink" from the examples, and click "Upload" in the IDE and press the reset button on the LeoStick. The timing on this is important, because the IDE needs to compile the program and then begin the upload within 7 seconds of the LeoStick rebooting. If it doesn't work straight off, try a few different times with different timing: click both at the same time, one slightly before the other, etc.

Once you have a functioning program like Blink uploaded you'll be all set, and can upload new programs the usual way without worrying about the timing.

Oh, and one other thing worth mentioning: if you have an in-circuit programmer such as an AVR ISP Mk2 or similar, it's easy to get out of this predicament using Windows, Linux, or MacOS simply by uploading a new firmware package from the IDE.

Please let me know if you manage to get it sorted using one of your Linux machines! I think Marc may be chiming in with some suggestions about Windows, too, but that's outside my comfort zone. As I type this I'm on the phone to him, and he's just deliberately bricked a LeoStick to check the timing on Windows port enumeration and recovery, and then successfully recovered it using Windows. Details to follow :-)

Freetronics Staff
Freetronics Staff
Posts: 16
Joined: Sat Oct 15, 2011 12:54 pm

Re: Hang during upload (Win7 x86-64)

Post by marc » Sun May 13, 2012 2:10 pm

Hey that's excellent news! :) We found that Mac and Linux do connect faster to get into the bootloader a bit easier.

We've just done a tutorial and background info on hung sketch recovery and the bootloader, it's here to help anyone!


Post Reply