Leonardo Bootloader (Caterina) sometimes skipped, sometimes not.


I have this weird issue and can't figure out why it's happening: I built these Leonardo clones, applied the caterina bootloader and original fuses (taken from Arduino 1.0.5), they work like a charm, but while some of my units jump directly into the program, most of them do the blue "breathing" first after power-on. What could lead to that behavior? And even more interesting: Why can I even program the devices that jump directly into the main program after reset? I'm confused! What's the standard behavior of a Leonardo if it's powered externally? (My units use a lipoly battery.) Is there maybe a difference between power-up and reset?
Right now I investigate if the behavior depends on the voltage level of the battery, although there's a regulator between the battery and the Atmega32U4.

Thanks guys!

Is there maybe a difference between power-up and reset?

Yes. There's a chip register that tells you what happened. The bootloader looks at it to decide what to do when the chip starts up.

On reset it should do the "breathing" thing. On power-up, no.

They usually also breathe on power-up. I just fully charged one unit and it still breathes on power-up. The other two units that skip the bootloader still skip the bootloader. Maybe it has something to do with the reset circuitry, but I just use a 10k to VCC. All boards are professionally manufactured with the same PCB batch and the same components batch... The strange thing is: Yesterday, ALL units did NOT skip the bootloader, and today two skip it and continue skipping it. All run the same sketch.

It depeneds on which Caterina bootloader you used. The default one with the IDE, that combines the blink sketch and bootloader. Or did you use a version of the Caterina bootloader with no initial sketch?

If there was no initial sketch then you will get the breathing on power up.

If there is a sketch loaded then it should go straight to the sketch on power up.

I used the one that came with the IDE. It did blue blinking action after flashing the bootloader. I flashed the same bootloader on all devices.

So I did not get any further with this. Still the same bootloader on all devices, which flashed the blue LED on startup, so it had an initial sketch on it. About 40% of my devices show the blue breathing now and the rest jumps directly into the sketch. Is there any further explanation how the bootloader checks if a sketch is loaded?