Odd run-away problem with leostick

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Post Reply
Bobalong
Posts: 3
Joined: Tue Aug 14, 2012 6:27 am

Odd run-away problem with leostick

Post by Bobalong » Thu Mar 14, 2013 1:34 pm

My project is an LED clock with 60 minute LEDs and 12 hour LEDs, and uses the 1Hz pulse from a DS3234 clock module at the top of loop() so the loop gets executed once per second
.
I have an odd problem with run-away code execution depending on code location.
If I have

Code: Select all

    if ( hour > 11 )
        hour -= 12;
    display_hour ( );
...
void display_hour ( void )
{
...
}
it works. But if I change it to

Code: Select all

    display_hour ( );
...
void display_hour ( void )
{
    if ( hour > 11 )
        hour -= 12;
...
}
I get run-away execution with the clock cycling through 12 hours in about 12 seconds. Once that happens, resetting or loading the working version has no effect.

Loading a different sketch has no apparent effect. Still the same run-away code. But then loading the working clock code works. Strange.

Does the ATmega32U4 have a problem with loops or computed gotos crossing page boundaries? Any idea what's happening here?

Post Reply