This page describes a gadget which I created while working on my study thesis about porting a CNC to RTAI-Linux.
This gadget is used to make latency measurements.
When it is told to work by setting the INIT line of the parallel printer port to high, it generates low-impulses on the ACK line. If the parallel printer port and the operating system are configured correctly, this low-impulses cause interrupts. The interrupt handler can now send a response to the printer port using Data 4 on the printer port which is connected to the left bayonet nut connector.
The output of the Atmel microprocessor is not only attached to the printer port, but also to the bayonet nut connector in the middle and also to a RS flipflop build out of two fast NAND gates. This RS flipflop is set by every low impulse generated by the microprocessor. It can be reset by generating a low impulse on the line Data 5 of the printer port. The Output of the RS flipflop is connected to the bayonet nut connector on the right beneath the green LED.
The green LED indicates, that the gadget is idle. The red LED indicates, that the gadget is generating impulses.
The frequency of the impulses can also be adjusted in decades between 100Hz and 100kHz by setting the printer control port to different values:
| frequency | \Select Input | \Auto Feed | \Strobe |
|---|---|---|---|
| 0.1 kHz | 0/h | 0/h | 0/h |
| 1 kHz | 1/l | X | X |
| 10 kHz | 0/h | 1/l | X |
| 100 kHz | 0/h | 0/h | 1/l |
Please note, that this signals are in negative logic. l and h are the signals on the wire, 0 and 1 are the correspondent values you have to set in the printer control port.
Here you can see a measurement sample.
It was recorded over a period of 5 minutes on a Pentium-II with 400MHz and a PII chipset.
The response signal was generated directly in the interrupt routine.
The processor was under the load of a ping flood and some GCCs.
The first channel (blue) of the oscilloscope shows the IRQ-Out line of the microprocessor.
The second channel (red) shows the output of the RS flipflop. The width of this signal is the maximum latency, in this case 14.97µs, since the shown signal are all recorded samples over the whole 5 minutes. The Jitter is around 12µs.
The third channel (green) shows the interrupt response of the computer.
The layout of the pcb is designed with the EAGLE Layout Editor by CadSoft.
This software is free for non-profit applications.
The layout can be manufactured as single sided pcb since the top layer is only used for three wire straps.
The sourcecode for the microprocessor is written in Assembler.
It can be compiled with the avra assembler and programmed into the microprocessors flash memory with SP12.