Timer2 with prescaler 1024 too fast.

daok:

I think there's a problem here:

TCCR2B=(1<<20)|(1<<CS21)|(1<<CS22); // Prescaler = FCPU/1024

You have 1<<20 instead of 1<<CS20. If that term is ignored by the compiler you wind up with a divisor of 256 instead of 1024.

floresta