Close

Timing measurements

A project log for Tek V2

Version 2 of PS/2 keyboard adapter for Zeddies

danjovicdanjovic 09/26/2019 at 03:240 Comments

I did some time measurements on the response time of the "naked" interrupt. The test bench is a TK85 (ZX81 clone) that have a signal named /KBD that goes low when it's time to read the keyboard

The /KBD signal goes to pin D2 on arduino (INT0). The interrupt is "naked" meaning it does not have any overhead to save the context.

//
// Update the state of the outputs according to the state of the Keyboard Matrix
//  
ISR (INT0_vect, ISR_NAKED) {  
   
asm volatile (   
   "cbi %2,5 \n\t"                  // drop !WAIT line
   "in __tmp_reg__,__SREG__ \n\t"   // Save status register  
...
...

The average latency of the signal  varied from 667ns to 750ns.

The Timings Tx are related to the Z80 I/O Read cycle

When superimposed, the measuremens become more clear (really??)

The measurements above lead to the conclusion is that even the AVR with a  "naked" interrupt could not provide a response that is fast enough to activate the  /Wait signal on the correct time.

Than can be seen on the measurement below, where the next instruction have its first cycle incorrectly extended by the AVR output

So far so bad, but I still have some cards to play....

Discussions