My learning curve continues ;-)
I'm using a 32768 Hz square wave input on INT4 for an ATmega128 running at 16MHz. The mark:space ration is about 1:4 and the leading/rising edge is not completely square but the waveform is clean and stable with no overshoot or noise (looked at on a good Tek 2465 with 1 Mohm input impedence) - when I measure the frequency on an HP 5385A ovened & calibrated TXCO, its actually 32768.105 Hz over a several hour period, so the pulse chain is very accurate (its sourced from an ovened RTC).
So, I'm counting a second every 32768 interrupts, but every 12 hours I'm about 30 seconds short, i.e. the timer is running somwhat slow.
INT4 is different to INT0:3 in that it has a polled mode by the IOclk - I've tried the polled mode (10) and the "every state change" mode (01 but obviously counting to 65536 in that case) but both run slow. Is INT4 a problem?
When I use the same counting logic, but driven off timer0_comp_vect with an external watch crystal, it counts very accurately.
Am I missing the obvious here?