The bootloader of Arduino Leonardo seems to not clear the USB interrupts before
handing over to the main code.
To reproduce, create a minimal C-program like this:
int main(int argc, char* argv[])
{
DDRC = 128;
PORTC = 0;
sei();
while(1) {
_delay_ms(100);
PORTC = 128;
_delay_ms(100);
PORTC = 0;
}
return 0;
}
Compile and transmit using avr-gcc and avrdude.
The status LED should blink, but it doesn't. But if you remove the call to
sei() it works as expected.
I've found that the USB interrupts are still enabled when main is entered,
which causes an unimplemented interrupt handler to called. The workaround is to
either implement the interrupt handler or disable USB interrupts before sei()
is called.
Original issue reported on code.google.com by jonatan....@gmail.com on 4 Nov 2012 at 8:44
Original issue reported on code.google.com by
jonatan....@gmail.com
on 4 Nov 2012 at 8:44