Skip to content

Interrupt still enabled after boot loader [imported] #218

@cmaglie

Description

@cmaglie

This is Issue 1096 moved from a Google Code project.
Added by 2012-11-04T20:44:19.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium

Original description

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions