1.5.6r2 SEES Leonardo, but still can't program it.

Back again, but with one step closer. Using 1.5.6r2 instead of 1/0.3 on my Ubuntu box. The IDE sees the /dev/ttyACM0 of the Leonardo. So, I try to upload Blink after changing the blink frequency to know if it works. So, I hit upload, and it compiles and fails to upload without showing an error!

So, I go to preferences and align verbose for the upload attempt. Right at the top of the verboseness is "Forcing reset using 1200bps open/close on port /dev/ttyACMO". The mysterious 1200baud shows up right at the top of the listing. Later down on the listing is where it finds the port, chooses avr109, and shows "Overriding Baud Rate: 57000".

Then it says that the device or resource is busy and thus can't upload to the board. So, how do you prevent it from "force reset using 1200bps open/close on port /dev/ttyACM0"-ing?

I think the 1200 baud is needed to reset the Leonardo to be able to reach the bootloader.
Perhaps you have a wrong sketch in the Leonardo, or the bootloader is going wrong.

Which Ubuntu version are you using ?

You could try this: Remove all the Java and install only the basic Java. Use Arduino IDE 1.5.7 BETA. Try to upload the sketch. If that doesn't help, you might need a programmer to re-write the bootloader.

I tried the Arduino as ISP route with a Duemilanove as the programmer to put in a sketch, and no dice. I'm using Ubuntu 13.04. I guess it's time to get the 1.5.7 software. I would hate to see a raw newbie with my Leonardo problem!

I guess I need to test my Duemilanove programmer on a guinea pig of an UNO to see if it in fact works. I have the Duemilanove wired up and the needed sketch on it.

I remember that I had a sketch on my Leonardo that was too busy with the serial port, that it could not accept the reset to upload a new sketch. You might try to press the reset button at the right time, but I don't know if that is possible. I fixed it with a new bootloader (and that Leonardo board is still working), but I don't know if that will fix it for you. It is worth trying, that's all.

Ubuntu 12.04 to 14.04 should be fine.

I just tried 1.5.7 and it saw the Leonardo, but on a test upload I got a permission denied. So, I stop the IDE and restart it using trusty old sudo to try again. I try it and it saw the Leonardo but on the upload attempt I got an avrdude "can't find port". Yet on the bottom right corner it was showing the Leonardo on the serial port file!

You have to add yourself to the "dialout" group.
This might work: sudo usermod -a -G dialout yourUserName
But I used an other command, but I have that on my other computer. After adding yourself to that group, you need to logout and login.

I found out after messing with 1.5.7 with sudo I get an avrdude error of "try the -F switch" which will mean dig in the Java sourcecode. Time to learn some Java and fix the one line!

This is quite an adventure. I got close but not within "field goal range". (OK I'm a football fan) Do I have to hack the code or go the command line route.?

Is 'dialout' showing when you type: groups
If it is, you still might have a mismatch with Java and Arduino, with old files or wrong files.
Remove all Java and Arduino from the repositories. Run the Arduino IDE only from a folder. Remove the Java rxtx. Just the basic (meta) package of Java should be okay.

You could try to make a startup/live Ubuntu on a USB stick. Run that, install the minimal Java en run Arduino and test the Leonardo. I'm pretty sure that would work.

OK, dialout is in the group and I have 1.5.6r2 and 1.5.7 in their own subdirs (folders) on my normal username account. That was how I got the tantalizing clue of adding the -F switch on avrdude. And I still had to use good ol' sudo to get there. I feel sorry for a raw newbie with a Leonardo as their first circuit card! Another clue is that despite being in the dialout group I still need to use sudo to align minicom in order to get serial out of an UNO. I guess I have a hosed Linux box. But without sudo I can use the serial window on the IDE any version.

I'm also thinking in the direction of a bad Linux system.
Can you try gtkterm ?
Connect the Arduino board, start gtkterm, and select the com-port.

Try this. Is avrdude installed on your system, if not, install from the ubuntu repository.

Plug in the leonardo.

Enter this in a console: avrdude -pm32u4 -cavr109 -P/dev/ttyACM0 -b57600

Push the reset button on the Leo, wait a second and then (press enter to) run the above command.

You should see the following (and some other stuff):

---SNIP---

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587

avrdude: safemode: Fuses OK

avrdude done. Thank you.

If you have problems CUT AND PASTE THE EXACT ERROR MESSAGE (if any) or THE EXACT RESULT of running the command.

tf68 handed you a perfect test to see whether there still is a working bootloader in your leonardo (It might got corrupted) and it will also show any access right problems. You should really try that out first.


The order tf68 describes is important:

  • After you plug in the Leonardo, two things can happen. The oldest version of the bootloader starts waiting some time for avrdude to upload a new sketch (L led starts fading in and out for some time). The newer version notices this is a power-on reset and immedeately jumps to the sketch already in the flash.

  • After you press reset, the bootloader starts and waits for some time for avrdude to send a new sketch.

This is the time to send the command described by tf68 (I second tf68: post the verbatim output here)

If the test fails, you can also post the last 10 lines or so of the dmesg command.
If it works, dmesg shows something like this:

[  420.795436] usb 2-1.2: new full-speed USB device number 7 using ehci_hcd
[  420.890237] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device         <--------- this is the bootloader
[  423.153948] usb 2-1.2: USB disconnect, device number 7
[  423.353056] usb 2-1.2: new full-speed USB device number 8 using ehci_hcd
[  423.448985] cdc_acm 2-1.2:1.0: This device cannot do calls on its own. It is not a modem.
[  423.449043] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device           <-------- this is the sketch already in the flash 
[  423.451750] input: Arduino LLC Arduino Leonardo as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input17
[  423.452368] generic-usb 0003:2341:8036.0006: input,hidraw3: USB HID v1.01 Mouse [Arduino LLC Arduino Leonardo] on usb-0000:00:1d.0-1.2/input2

Trying it again, and the Leonardo dropped off the map, The bootloader flat out sucks. They need to find a new person to write a better bootloader. I know to avoid any *duino with that fucked up 32u4 chip.

The list of things you rant against becomes quite impressive: ubuntu, leonardo, micro, their bootloaders, the people who wrote their bootloaders...

Please just provide the logs tf68 and I asked for. Without that we won't be able to help you.

Edit: extra simple question: if you press the reset button , does the L led blink (rather fade in/out) about 14 times?

Yes, it'll pulsate. And not be seen when I do a dmesg, lsusb, etc. Donate it to a hackerspace?

Yes, it'll pulsate.

How many times?

And not be seen when I do a dmesg,

Are the kernel logs completely silent when you insert the device or do you get floods of (usb related logs)?
I mean, if you type dmesg before and after you insert the leonardo, does it end in the same lines?

Pentius,
So what is the status of this?
I've seen you start and comment in several threads having issues and complaining about bootloaders and linux support
on various "duino" boards.
In several cases, others don't seem to be having the issues and yet when
those people are offering to help, there never seems to be a follow through to a resolution.

I've seen several threads where is some discussion a few things are tried, but there
are other cases where the things done are not what the people helping are asking for
and then then the thread seems to "quiet".

It would be nice to have a complete follow through to resolve the issues rather than just having
so many inclusive/unfinished threads.

--- bill