Need Help Setting Up Leo Stick

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Joined:Wed May 09, 2012 4:24 pm
Need Help Setting Up Leo Stick

Post by squirrel » Wed May 09, 2012 4:50 pm


Just got my Leo stick today. Seems to work OK and I was nearly there
setting up the arduino IDE / USB driver in Win XP but as the setup is fairly
involved I got distracted at the end and messed up.
Instead of compiling/uploading the example sketch "BLINK"
I compiled/uploaded something else called toneplay or whatever
from the examples ( are these specifically for Leostick
or another arduino ?).
Note: also the preloaded program has the RGB LED varying in intensity
from bright red to dark not flashing RGB as stated in the documentation ?

I think I successfully uploaded something as the preloaded software
no longer runs and the RGB led is now unlit a second or so after
I unplug/replug the stick ?
Now XP doesn't see a Freetronix Leostick anymore it sees
an Arduino Leonardo and so it won't recognise the
leostickbootloader.inf file and so won't setup the USB driver
or the COM port relationship for the arduino IDE !

I have tried to reinstall the USB driver to no avail.
The IDE is installed OK and still refers to freetronix leostick
under tools/board. When I had it set OK the COM port
showed as COM3 in device manager and this showed up as well
in the IDE.

If I had stuck to compiling/uploading the example sketch
I would have been OK but no I wanted to hear if the sound would work
( didn't I ?) silly me.

What have I done ? My leostick now thinks it's a Leonardo ?
I think it may be running something not intended
as the only thing showing is the blue power led.

If anyone can help me to sort this mess out it will be
very much appreciated.

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

Re: Need Help Setting Up Leo Stick

Post by jonoxer » Thu May 10, 2012 12:14 am

Now XP doesn't see a Freetronix Leostick anymore it sees
an Arduino Leonardo
Don't worry, that's normal! It's a side-effect of a little dance that the Arduino library / loaded sketch does with the host computer while the virtual USB port is enumerating itself, and it's beyond our control. The LeoStick itself still has its own bootloader with our USB VID/PID in it, and that won't have been overwritten by the sketch you've loaded.

I'm a little unclear from your post if there's a problem with being able to upload new sketches. If the only problem is that the loaded sketch identifies itself as a Leonardo, then there's nothing to worry about. However, if you're stuck now and can't upload sketches: still don't worry, there are ways around that and I'm sure we can get you up and running!

Joined:Wed May 09, 2012 4:24 pm

Yes now I can't upload the BLINK sketch !

Post by squirrel » Thu May 10, 2012 12:55 am


Thanks for your reply.

I found another post on the forum which said to use the arduino/drivers
directory to fix the USB driver problem (now OK).

So now my XP system sees the leostick as an arduino leonardo
under the serial COM port section of device manager ( COM4
whereas the first installation enumerated COM3 ).
The IDE tool/board setting is still freetronix leostick
and COM port ticked is 4.

I can compile the sketch BLINK OK but when I try to upload
it the process doesn't complete (progress bar just freezes).
Note: at this time the leostick after boot/reset first displays
blue power led and red RGB led for a second or two then goes
to just blue power led ad infinitum after that.

I am assuming that whatever sketch I compiled/uploaded
last time may be still running now ?
(is the preloaded sketch still in there and running ?).

If I hit the reset button we go back to power led and red RGB led
then to power led only. If I get the blink upload far enough along
then press reset the upload terminates with a write error
and no other information ?

I have also tried pressing reset during upload and sometimes get
COM4 is already in use ? Probably just multiple PC programs trying to
access the port ?

At the moment I don't know how to proceed as, as you said
I can't upload anything new to the leostick (seems stuck right now) ?

Help needed.

p.s. as a first time user of microcontrollers ( I was trained on the old 8 / 16 & 32 bit
microprocessor chips back in the 1980s , stuff like Intel 8080,8085/8086/8088
then there was Zilog Z80 etc Motorola 6800 etc, Signetics 2650, MOStek 6502
[which started the Apple revolution] etc [the list goes on])
it would be nice to have a full data sheet for the Leostick micro ATmega32U4 chip
which would give me a more detailed look at the chip internally
and a full understanding of what software is needed to drive it/internal
architecture etc and what the physical pinout supports application wise ?

I understand there are many online resources/forums to be accessed which I will check out.
I want to try to understand how the leostick onboard sound is programmed initially
then I will move onto other applications.
I have also seen the term AVR used around the ATMEL chips.
Does this refer to a RISC based processor core ?
( the arduino language seems C like ?).

Any help/resources you can point me at at this stage would be very welcome.
I don't want to bother you too much as I know you are probably busy.
Just need to get the leostick under control before I can move onto
other applications.

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

Re: Need Help Setting Up Leo Stick

Post by jonoxer » Thu May 10, 2012 1:26 am

I'll follow up with the main problem ASAP, but in the meantime some background info related to your questions:

* The ATmega32u4 datasheet and other info for that specific MCU is available on the Atmel site at

* The Arduino language looks very C-like because it almost is! It's actually compiled using GCC as C++ after being pre-parsed by the IDE to automatically generate function prototypes, the "main()", and other pre-requisites. The Arduino environment is really C++ with a bunch of convenience helpers to make it more accessible to beginners. You can also program the board using any other software environment that can target the ATmega32u4 MCU, so if you prefer straight C or C++ you can do that too.

* "AVR" is an MCU family from Atmel that includes a bunch of different devices with a similar architecture, including the 32u4 we used on the LeoStick and the 328P that is used on the Eleven, Arduino Uno, and other boards. Because there's so much commonality between devices many people just refer to the AVR family rather than specific models, so you'll see people say things like "I ported this code over from PIC to AVR" just as a general statement. It doesn't tell you *which* PIC the original code came from or *which* AVR they ported it to, but often that doesn't matter. Things that run on an ATmega168 will also run on an ATmega328P, for example.

Joined:Wed May 09, 2012 4:24 pm

Re: Need Help Setting Up Leo Stick

Post by squirrel » Fri May 11, 2012 9:35 am


Thanks for the atmel link re the leostick mcu datasheet.
Very impressive doco pdfs. Atmel seem to document their
stuff at a high level of quality/comprehensiveness.
Plenty of application related PDFs there as well.

I just thought I would make a restatement
of the problem I am having with my leostick
both to hopefully crystallise things for Jon and anyone else
who could possibly help.
( Jon probably knows all the issues relating to these things anyway
I am sure).

Leostick Problem

1. I successfully downloaded/installed the arduino IDE software,
the USB driver ( and dealt with subsequent USB issues - result success )
and the leostick board definition for the IDE,
located sketch directory etc etc as per instructions that came with leostick.
2. I was basically ready to go and download BLINK my first sketch.
The leostick was plugged in blue power led on and RGB led pulsing
from bright red to off approx every second.
I have gleaned that when this is happening we may be in
bootloader mode ? ( funny the leostick instructions say
that the RGB should be flashing through all it's colours which
didn't happen at all ?).
3. I should have compiled and uploaded blink
( would it have worked ? is the sky always blue ?)
BUT silly me I got carried away didn't I
and I think I complied/uploaded the tonemelody sketch from the digital examples
(I think this says something about playing a tone melody on an 8 ohm
speaker attached to D8 ? I am thinking about soldering in the
breakout headers and attaching a speaker via breadboard to see
if the mcu is in fact playing a melody ( before it crashes the mcu
or if it is simply playing once and then halting according to
the sketch code ?).

4. As regards the compile/upload of the first sketch (tonemelody I think)
I can't remember seeing any RGB leds flashing as they are supposed to do
at upload. It all happened quite fast.

5. After that I could no longer upload anything.
After plugging in leostick or using the reset button I
get blue power led and seemingly the bootloader mode
(pulsing red rgb led) for around three seconds then the
blue power led goes to high intensity and stays there
( does this mean whatever I uploaded is running ?
how would I know if the current sketch had crashed the mcu ?).

When I try to upload a sketch the upload progress bar
freezes or hangs up at around 90% of progress and that's all folks.
( I am getting the same symptoms as the guy on the other thread
in Windows 7 complaining of upload hangup ! ).

If I use the reset button when IDE/avrdude [in verbose mode]
is sending to leostick I get a "write error sorry no info available"
and again that's all folks.

6. One interesting thing is that occasionally (rare event)
when I plug in leostick BOTH power led and red (solid)
rgb led come on and stay on however this does not
change the upload problem.

7. In the hangup thread people suggest trying to sychronise
the IDE upload with the leostick bootloader window
(approx 3 seconds) and I have tried many times with no success.
If you reset while avrdude is sending you get the write error
and again no joy. If you reset before avr dude runs
avrdude simply complains it can't find the serial COM port
(because it takes too long for Windows to delete and readd
the COM port/device manager) so avrdude naturally just gives
up. Can this be done more successfully on a Linux system as
has been suggested ( maybe by a Linux gun which I ain't ).
Would like to hear from anyone who has jagged it like this
with a similar arduino lockup in Windows
( I know I can't make it work ). 8( .

8. What I don't really understand is if the MCU is crashing
then how can the bootloader work at all
? i.e. how does avrdude even get as far as it does with the
upload and then the write to flash just seems to seize up ?
If the current sketch has crashed the mcu then how can the
bootloader be running ?
Maybe something else is going on ?

9. I think I read somewhere that different programs are stored
in different pages of flash memory ?
So the bootloader is isolated in it's own page and will
normally not be overwritten unless we do a chip wide
erase ? So don't we just need a way to tell say avrdude
etc just to erase the page with the current sketch in it ?

That's all I can think of for now.

I am looking forward to using my Leo stick as it was intended.

Any help/commentary welcome.

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

Re: Need Help Setting Up Leo Stick

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

Wow thanks for the excellent description and background info!
We've just done a tutorial and background that I think answers most of your questions on hung sketch recovery and the bootloader, it's here, hope it helps and gets your sketch loaded ok. Please let us know how it goes and we can assist more if needed too.


Joined:Thu Jun 28, 2012 2:30 pm

Re: Need Help Setting Up Leo Stick

Post by tyney » Thu Jun 28, 2012 2:55 pm

Hi Guys,
did anyone end up having any luck with this?
I'm in pretty much exactly the same situation except i'm on mac osx....i've tried for about the last half an hour to time this bootloader thing correctly and think it's not going to happen...

I actually managed to get the blink sketch to run, then thought I'd try the same tone sketch as well. Problem is I loaded the sketch before I read the instructions for the I don't have a speaker and stuff handy at the moment to try it out with.

however, now I just have a pale blue led on the leostick and any time I try to load a new sketch i get errors saying that another application "may be" using the port....

please help, my hair has gone grey and is now starting to fall out.
ty :D

Joined:Wed Jul 11, 2012 11:48 am

Re: Need Help Setting Up Leo Stick

Post by kjamimate » Wed Jul 11, 2012 12:13 pm

Any luck so far? I'm a Mac user with the same problem.



Joined:Sat Aug 04, 2012 5:08 pm

Re: Need Help Setting Up Leo Stick

Post by Ziral » Sat Aug 04, 2012 5:14 pm

I am having the same type of problem with my leostick. on both of my computers if I try to install a blink example to the board, the progress bar will hang up and never complete.

If I try to stop and retry the computer will say that the com port is busy until I reset the Arduino.

I was able to get the bard to complete an upload one time using a friends laptop running some version of Linux(I think Mint or Ubuntu).

However when I tried to load a sketch from my laptop using fedora17 or windows7 it created the same problem as with my desktop which runs windows7 as well.

Any advice would be appreciated.

Joined:Fri Aug 24, 2012 7:35 am

Re: Need Help Setting Up Leo Stick

Post by nonentity » Wed Aug 29, 2012 1:54 am

Just looking at the spec sheet... Leostick has a temp sensor built-in?

Any idea how to read out a few values?

Post Reply