Suggestion: A Better Leonardo Bootloader.

The Leonardo with that 32u4 chip can only be programmed via the native USB connection because that's how the bootloader was written. The Micro and Lilypad USB are the same way. What would be nice would be a bootloader that would allow the option of programming it with an FTDI card to bypass the funny device driver that some Linux boxes lack. (I'm convinced that Ubuntu 10.04 was just a complete fluke of a distro)

I can do a Pro Mini with an FTDI card on my Linux box, as well as an UNO normally. But those 32u4 chips in Leonardos refuse to work or even be seen on my Linux boxes. That's why we need an option besides that USB connection. People have to seek out and install yet another device driver, configure it, and hope it doesn't conflict with all the other ones. These chips are simply exotic and Windows and Mac users always need the driver and a huge number of Linux users can't make it work.

Someone has probably already adapted the Optiboot bootloader for the ATmega32u4.
What about uploading via Bluetooth ? That needs also a serial port.

To load it onto the Leonardo, of course, you'd need an ISP device of some kind. Of course you can use an Arduino to burn that bootloader. That is, if THAT doesn't become a problem! But if you can use a Duemilanove as an ISP, you bypass the bootloader altogether, solving the 32u4's USB problem.

I so far havn't succeeded at using an Arduino as an ISP to program another one. Someone did by modifying the Makefile succeed at making a Leonardo an "UNO".

What about someone fixes the problems you're having with the current bootloader, instead?

They're likely to be timing-related; when you hit the "upload" button, the chip resets itself, which causes the USB device (from the core libraries) to go 'offline'; then it VERY QUICKLY shows up again as a slightly different device (the bootloader) in approximately the same "place." It wouldn't surprise me if that confused some systems. (there was a slightly-related bug that showed up using the optiboot makefiles to program chips using the "dragon" programmer.)

Can you be more specific about the exact configuration of the linux system you're having trouble with? I didn't see lots of "me too" responses to your complaints, which implies that it's not that common (or perhaps using trying to use leonardo with linux isn't that common to start with.) Do you have any other systems that you can use for comparison (it would be great, for example, to have a windows box that could talk to the leonardo running linux in a VM that COULDN'T.)

There are not a lot of Linux users compared to Windows or even Mac users. That might explain comparatively few "meeeetoooo" complaints. I'm using Ubuntu and previously I discussed the problem in the forum about Arduino itself, and the thread is there. I tried each of the suggestions until I plain gave up on trying to use the original USB method. The other participant suggested at the end that my Linux box is probably hosed. That was when I gave up.

I started a thread in the Microcontrollers forum about a failed attempt to use a Duemilanove as an ISP. I was testing it with an UNO as the target but it failed. I have to make it work on something first before I try the (dreaded) Leonardo. Since the Leonardo has no option except the hosed USB or using an ISP, that's why I suggested that an FTDI option be added to the bootloaders on those things.

I have used my Leonardo on kubuntu 10.04, on 12.04 LTS and on debian Wheezy. It proved very reliable on all of them.

I just noticed your thread "Re: 1.5.6r2 SEE Leonardo, but still can't program it." I think you should investigate the original problem more systematically. I'll post some suggestions over there.

Thanks. Next stop: My original thread...

I use leonardo on Linux Mint 13.
(Not the Official one but the Itead Loenardo).
I'm assuming it uses the same bootloader.
The only issue that I have is that because of the way the bootloader works, the virtual comport
device sometimes shifts around.
This can create some issues when trying to connect to the serial monitor after unplugging and
plugging it back in after uploading since the tty device name will shift/change
but other than that it seems to work just fine.

--- bill

I bought a Linux magazine with a Mint 17 album. I fired it up to a live boot from the album and immediately checked the /dev dir. Maybe your Mint 13 works, but not THAT Mint 17 album!

What do you see in the message log?
I see this when I plug in the Leonardo:

[11351.468111] usb 3-1: new full-speed USB device number 5 using ohci_hcd
[11351.643453] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[11351.643500] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[11351.654473] input: Arduino LLC Arduino Leonardo as /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.2/input/input14
[11351.654955] generic-usb 0003:2341:8036.0005: input,hidraw3: USB HID v1.01 Mouse [Arduino LLC Arduino Leonardo] on usb-0000:00:12.0-1/input2

I'm running 32 bit Mint 13 mate.

The Teensy boards also use the CDC class driver as well and I've been using Teensy boards
for years back to 2009 on nearly every version of Ubuntu up until they created Unity which is
when I bailed on Ubuntu and switched to Mint.

--- bill

I tried a sudo modprobe cdc_acm then rebooted, and no ttyACM0. I tried a dmesg, and no ACM clues at all. I guess Ubuntu stopped supporting Leonardo-type chips after 10.04. Hold on to your Mint 14!

A similar but easier problem occured to me with a Wifi dongle. An old Ubuntu version worked out of the box but a later version needed a modprobe to get it to work. Other times, I've seen "supported" devices that NEVER worked no matter what I did. So, we know that the 32u4 chips work with:

Ubuntu 10.04 (from this site itself)
Mint 14

Any others with distros that worked?

You may list your distro but also describe the hack needed. (apparently in most cases)

I'm not having any issues on my Mint13 32 bit mate.
I just downloaded Mint17 32 bit mate and "out of the box" when live booted off of flash drive
it sees the Itead Leonardo and creates the ACM tty device just like Mint 13.
I booted an old Ubuntu 11.10 and it works with the same system log messages as well.
A few years back, I used Ubuntu 10.04 for quite a while with Teensy which
also used the USB CDC class driver and it also worked.

If you ever used ISP on your Leonardo the bootloader is gone and
boot loading from USB will never work again, until you re-install the bootloader
since the bootloader contains the USB interface code.
Without the bootloader, the Leonardo will not enumerate so it will never be seen
by the host.

Do you see the Leonard show up with lsusb?
If not, then I think your bootloader or the AVR itself is toast.

--- bill

I have 2 Leonardos, one of which has no headers. The header-free one cannot be programmed by ICSP because I can't solder anything that small, so its bootloader HAS to still be good. (I don't have a Lilliputian welder as a friend) The other, a copycat, I did try it as it has a full compliment of headers. Neither works, and both are unseen by lsusb, dmesg, etc.

I even tried to use ICSP to do an UNO but the UNO and its bootloader survived the attempt, so the attempt was in fact a fail.

Interesting thing just happened to me.
I plugged in the Leonardo and nothing. It didn't even enumerate.
I plugged in my Teensy and nothing. Not even power.
The USB to mini usb cable I had been using for about a year just failed.
Swapped it out for a different cable and everything is working again.
Have you verified that the USB cable you are using is good?

--- bill

I just tried swapping the cord and no dice. The thing gets power with either cord and the 3.8.x kernel is blind to it. Which kernel is your 10.04 using? Did you have to do anything to get the Leonardo to work? (besides replacing the cord last night) I won't even try a Teensy or other weird-duino. The RFDuino is not supported at all by Linux as I found out the hard way. ONE person did make it work - by using WINE! Talk about a headache! Maybe I should ask that guy about the Leonardo problem. He could probably do it blindfolded.

I'm not using Ubuntu 10.04 anymore so
I had to download the 10.04 install iso and boot from CD.
So far I have used these others in the past:
Ubuntu 9.04, 10.04 32 bit.
Mint9, Mint10, 32 bit.

I just tested/verified these:
Ubuntu 10.04 (kernel 2.6.32)
Mint 13, Mint 17, 32 bit mate PAE.
(Mint 13 is kernel 3.2.0, Mint 17 is kernel 3.13.0)
Ubuntu 11.10 32 bit PAE (kernel 3.0.0)
I even downloaded the latest Ubuntu 14.04 which no longer supports PAE
so I went with the 64 bit.
It is kernel version 3.13

I've don't believe that I ever did anything special to make it work.
For sure I didn't do anything on Mint 17, Ubuntu 10.04, and Ubuntu 14.04 as I just download
the ISO images and booted them directly (not in a VM) without installing them.

So far every Mint and Ubuntu released I have tried sees the Leonardo
and the CDC class driver creates the /dev/ttyACMxxx device:

  • Ubuntu 9.04, 10.04, 11.10, 14.04
  • Mint9, Mint10, Mint13, Mint17
    PeterH has used it on:
  • Kbuntu 10.04, 12.04LTS
  • Debian Wheezy

Thats quite a few operating systems and kernel versions
that are working without issues.

Maybe try to debug it using westfw's suggestion:

Do you have any other systems that you can use for comparison (it would be great, for example, to have a windows box that could talk to the leonardo running linux in a VM that COULDN'T.)

Although USB support in VM's have many issues especially with devices that drop and re-enumerate
like Leonardo and Teensy.
Because of this I would not do any initial testing using VMs.

Are you by chance running your Ubuntu in a VM? or are you booting linux directly?
If in a VM, there are a few things that can trip things with respect to who sees the USB device
and who claims it. There are some settings to configure things (in VirtualBox)
but they don't always seem work as intended/expected so the Host can sometimes
hog the device and not let the guest claim it.
(usually the manual override works ok)

If you are directly booting Ubuntu, then
it kind of sounds like the bootloader is not working.

I never let anything Microsoft touch my h/w.
I boot linux directly and only when necessary I bring up XP in a VirtualBox VM.

--- bill

pentius:
The RFDuino is not supported at all by Linux as I found out the hard way. ONE person did make it work - by using WINE! Talk about a headache!

The only issue with RFduino on the Linux is the boot loader, RFDLoader. The Arduino IDE and the RFduino Library work and compile just fine. It is just getting the resulting .hex file to load into the RFduino itself. So I wouldn't say "not supported 'at all' by Linux". It is true, for now the RFDLoader's provided are for OS-X 32 bit and 64 bit, and Windows. However, on iMAC I am having trouble compiling anything for Due or ARM on 32bit iMACs. Seems the Arduino ARM gcc cross-compiler is only for 64 bit iMACs.