mstimer2 and delay problem

I have a problem with mstimer2 and delay. In the following code, the execution seems to stop in the delay in setup(). "started OK" is printed, but "after delay" and "main loop" are not.

Any ideas? Thanks!

//libraries
#include <MsTimer2.h>

void setup()
{
  MsTimer2::set(50, updateInterrupt );
  MsTimer2::start();

  Serial.begin(57600);
  Serial.println("started ok");
  delay( 2500 );
  Serial.println( "after delay" );

}

void updateInterrupt()
{
} 

/****************************************************************
 * main
 */

void loop()                     // run over and over again
{  
  Serial.println( "main loop" );
}

if anyone is interested, then try decreasing the delay time. At around 400ms, the program starts working as expected but then dies. As the delay gets lower and lower it works more of the time. At around 50ms the program seems to work fine.

Still totally stumped by this one, but this seems like a good clue! Any thoughts?

more amusement! This code ignores the delay, but runs merrily forever.

#include <MsTimer2.h>
void setup()
{
  MsTimer2::set(50, updateInterrupt );
  MsTimer2::start();
  Serial.begin(57600);
  Serial.println("started OK");
  delay( 4500 );
  Serial.println( "after delay" );
}

void updateInterrupt()
{
  Serial.print( "." );
}

void loop()
{  
  Serial.println( "main loop" );
}

Change the ISR so it prints "", intstead of a "." and the program runs as before, but hangs at a (seemingly) random time and prints the 'started ok' message!

Is my compiler totally screwed? It is 4.3.0, I'm using arduino-0017

4.3.0 has issues with long int multiplication. Hmm. Upgrading now.

problem solved! 4.3.2 and it all works as expected! I'll try and remember for next time. :frowning: