Tektronix 468

 

Firmware Design Overview

 

 

 

 

 

 

Introduction

Firmware Design Overview

Sine Display Response

Hardware problems

Tek468 Adventures

 

...

Firmware Design Overview

 

Here is a overview of the operation of the Tektronix 468 firmware in Digital Mode:

 
bullet

There are 2 action queues where actions to be taken are queued for processing later: the main queue and the display queue. Both queues are implemented as ring buffers.

bullet

The main loop does nothing but executing actions, if there are any.

bullet

4 interrupts are possible: a 2 mSecs timer interrupt, a 10 mSecs Cursor Potentiometer interrupt (PRDONE), the Display Done Interrupt (DISDN) and the optional GPIB interrupt.

bullet

There is an Acquisition Subsystem which autonomously acquires waveforms (WFs) of 512 samples, 1 byte each. The system actually acquires many samples, rotating through memory but only signals completion when a Trigger event occurs. The actual trigger detection is done in the analog section of the 468, but the digital section makes sure enough samples are available (based on the Storage Window Settings) before signaling that an Acquisition is complete.

bullet

The 468 Display Ram is 1k bytes in size and is divided into 4 areas, each 256 bytes: AREA1, AREA2, AREA3, AREA4. AREA1 and AREA2 as well as AREA3 and AREA4 can be combined into a 512 byte AREA. A normal WF is 512 bytes and fits into either AREA1+AREA2 or AREA3+AREA4. A short WF (CHOPPED) is 256 bytes and can fit in any of the 4 areas.

bullet

The 468 can display a maximum of 4 WFs plus 2 line cursors seemingly at the same time. In reality, these are rendered in sequence but fast enough they look simultaneously. It has also the ability to highlight 2 dots on a WF. These are used as Time dot cursors.
Each WF or line cursor is rendered autonomously (Autonomous Display System or ADS), i.e. the hardware generates the horizontal voltage ramp (sweep) and reads the appropriate vertical values from Display Ram. The CPU can do other things while this is happening (anything besides accessing the Display Ram); the CPU only starts each WF or line cursor display.

bullet

When a WF or Cursor Line display is finished, the ADS interrupts the CPU (DISDN). The CPU then checks if there are any actions queued in the Display Action Queue and processes them, mainly copying newly acquired WFs to the Display Ram. Next it schedules the next WF or Cursor Line to be displayed; if no new WFs were copied, the same WFs and lines are shown over and over again, for example in SAVE mode. If no valid WFs or lines are available, a dashed line is shown in the middle of the screen.

bullet

The main program does a WF acquisition, busy waits until the acquisition is complete (using actions), copies the acquired data to an internal memory buffer (possibly after "Time expansion"), then submits this WF for display to the Display Subsystem as an action in the Display Action Queue. The ADS interrupts the main program on completion of displaying a WF or Cursor Line; if there are any WF display requests, it copies its data to the Display Ram, then schedules the next WF to display

bullet

The Timer interrupts checks the controls (buttons, switches) every 100 mSecs while the "fast mode" Cursor Potentiometer option, when turning the knob all the way to the edge, is tested every 2 mSecs (every Timer interrupt). The "regular" Cursor Potentiometer is read every 10 mSecs by the PRDONE interrupt. Several special cases, like the SAVEREF button, are tested at various code locations, to improve the scope's responsiveness.

bullet

The fastest Acquisition time the hardware supports is 2 uSecs/Div. There are 10 Divisions per screen so 20 uSec/Screen and 512 acquisitions per screen, resulting in 40 nSecs per sample (25 million samples per second). Each sample needs to be stored in the Acquisition Ram but 40 nSecs is too fast for that Ram so 2 samples are collected, then stored as a word in the Acquisition Ram at 80 nSecs per 2 samples.

bullet

The 468 supports higher frequency WFs by using "Time expansion" in software. A 10 MHz sine wave for example has a period of 100 nSecs. To show two periods on the screen (10 divisions) requires a setting of 20 nSecs/Div (0.02 uSecs/Div), 100 times faster than the maximum Acquisition time. Thus the 468 calculates the desired WF by expanding the first half of the WF repeatedly (six times in this case: x2, x2, x2.5, x2, x2, x2.5). Each normal expansion is done by taking the first 256 samples (a normal WF is 512 samples), and insert a computed value between each sample ("Time expansion"). When selecting the "Sine Display Response" option, this interpolation is a magic process based on the sin(x)/x theory called convolution. This interpolation process requires extra buffers and the 468 has to use the Acquisition Ram to store one of these buffers, preventing the start of a new WF acquisition.

bullet

The same "Time expansion" process is used when a WF is frozen using the "SAVE" option, then inspected in more detail by changing the TIME/DIV control.

bullet

Average mode is done by acquiring the desired number of WFs, adding the samples for each location in a 512 position sum (word sized) buffer, then computing the average for each location before displaying the resulting WF. While doing the averaging, the WF shown is not updated; instead, the WF at the beginning of the averaging process is shown repeatedly. This process requires 1024 bytes (one 16-bit word to hold the sum for each location.) Because the 468 has very limited Ram, it was difficult to find that space and other WFs were temporarily moved out the the way to make space.

bullet

The 468 has an LED display (Numeric Window) which can display 4 decimal digits. The distance between 2 lines (a voltage value) can be shown as volts in VOLTS and COUPLED VOLTS/TIME cursor mode while the distance between 2 dots (a time value) can be shown as seconds in TIME cursor mode. This LED display is refreshed every 4 mSecs while the values to be displayed are updated every 200 mSecs.

bullet

The 468 in digital mode tries to emulate the behavior of the analog side as much as possible though that is not always possible. For example, the Digital Mode can use either the A Timebase value of the B Timebase value but not both at the same time, as the analog side can using the A/B Alternate option. It can use the B'DlY'D option when showing a WF that is constantly being acquired (not a SAVED WF)

bullet

The Vertical Mode options (CH1, CH2, ADD, CHOP) together with SAVEREF and AVG/ENV mode provide another big challenge. The Instruction Manual describes a  "Priority Storage Plan" to describe how the 468 deals with all these combinations. It is accurate though difficult to read. There are 28 different valid combinations, each producing its own result.

bullet

An interesting combination is how the CHOP option is implemented. CHOP is only useful if both CH1 and CH2 are selected. When ALT(ERNATE) (which is the opposite of CHOP) is selected, the 468 acquires a WF for CH1, then starts the display for that WF. In the mean time a WF for CH2 is acquired and submitted for display, then the process repeats so the CH1 and CH2 WFs are shown in turn. In CHOP mode, the channel to be acquired is changed after every sample, so a full acquisition of 512 bytes is a mixture of CH1 and CH2 samples. The 468 then "unzips" these data into 2 different buffers, each 256 bytes; the resulting WFs are called "Short WFs" and each is displayed in turn but at a faster speed (2 mSecs) since there are only 256 samples for each. Thus in CHOP mode the user sees CH1 (2 mSec), CH2 (2 mSec), CH1 (2 mSec), CH2 (2 mSec) while in ALT mode, the user sees CH1 (4 mSec), CH2 (4 mSec) in the same period.

bullet

The 468 can show 2 WFs in CHOP mode using 512 bytes of Display Ram. When selecting the SAVEREF option, it can copy these 2 WFs to the second half of the Display Ram for a total of 1024 bytes, all of the available Display Ram, and showing 4 different WFs seemingly at the same time (in reality, each WF is shown in sequence). In ALT mode, the 2 WFs each take up 512 bytes (using all available Display Ram). When selecting the SAVEREF option in CH1/CH2 ALT mode, there is no Ram available to make a copy of each WF so the 468 turns off CH2 and shows a saved copy of the CH1 WF and a continuously being acquired CH1 WF.

bullet

The 1KB Display Memory is divided in 4 areas [1..4], each 256 bytes but areas 1 and 2, as well as 3 and 4 can be used for 512 bytes WFs. The hardware is able to autonomously display a WF from each area but the CPU has to start each WF display by specifying a starting address and a duration.

bullet

The 468 firmware design has one inherent problem: most actions are executed in a delayed manner by adding them to an action queue, but these actions will look at the current state of the User Interface settings (updated asynchronously) so an action was queued because of a certain setting, but by the time the action is executed, the setting may have changed again: We're not looking at the UI as it was when the action was queued but as it is now. Ideally, we would need to mirror the UI data for each queued action so the action does it's thing as was intended at the time. Any UI change should queue new actions. There is also lots of code needed to check if a queued action is still relevant.
On top of that, the user interface data may change asynchronously at any moment because they are updated at interrupt time.

bullet

Regarding the interrupt design: Display Complete (DISDN) interrupts the mainline code and modifies a lot of global variables, variables potentially accessed by that mainline code. When these variables are 16-bit words, there is a potential problem. An example is V_DispCursorPos. This value is updated by RenderCursorLine() at interrupt time but used by SetCursorsDelta() in the mainline code. The 8085 has 16-bit load and store instructions and these are hopefully atomic operations. Any load/store in the mainline code using byte access is unsafe because of this design. The mainline code has a lot of "critical regions" (code running with interrupts disabled) to prevent interrupts while certain actions are executed. This observations applies to all interrupts.

bullet

The cursor positions on screen are updated at interrupt time, to be as responsive as possible, but at the cost of potential global variables interference. However, the numeric window display values corresponding with the on-screen cursor are update in the mainline program, by adding an action to the main queue. Such an action is added every time on-screen cursor positions are computed, every 10 mSecs. Funny thing is that this number isn't used until the numeric window display is being updated, every 200 mSecs. So the number is computed 20 times before it's being used; a waste of CPU resources. A simple call to compute the numeric window value just before the display is updated instead of computing it every 10 mSecs yields identical behavior.

 

Random notes on the internal workings of the 468.

 

Some of this is a clarification of the "Theory of Operation" in the Service Manual.

The 468 has one digitizer (the large TRW chip running very hot). In alternate 2-channel mode, the 468 acquires a WF from Channel 1, submits it for display (in Area 1/2), then acquires a WF for Channel 2, then submits that for display (in Area 3/4), then repeats. So Channel 1 and 2 are shown in turn – 4 mSecs each WF. If, for whatever reason, an acquisition is not complete by the time a WF needs to be displayed again, the previously acquired WF for that channel is just shown again. Each regular WF uses 512 bytes Display Memory so the 2 together use up all of the Display Memory (1KB). When hitting SAVE, no more acquisitions take place and the 2 WFs in area 1/2 and 3/4 are shown over and over again. When hitting SAVEREF, there is no Display Memory space available to show more WFs so the scope turns off CH2 and shows a copy of CH1 plus newly acquired WFs of CH1.

In Chopped, 2-channel mode, the acquisition is actually chopped, meaning the channel is switched between each sample. The resulting 512 samples WF is a mixture of CH1 and CH2. This WF is then unzipped into two separate 256 samples WFs (in Area 1 and 2) and the resulting WFs are displayed in turn but each in just 2 mSecs because there are fewer samples (this speed adjustment is done using the Horizontal Gain DAC). SAVE works the same as in alternate mode. SAVEREF works better because the 2 short WFs in Display Area 1 and 2 now only use 512 bytes of Display Memory together, so the 468 copies these WFs to Display area 3 and 4, marks them as valid and displays 4 different WFs (the maximum), continously updating Area 1 and 2 with newly acquired (and unzipped) WFs.

In ADD mode, the added WF is stored in Area 3 and area 1/2 can be used for either 1 other WF (either CH1 or CH2) but also 2 WFs (CH1 and CH2) but those are automatically shown as Chopped (even if chopped is not selected). When SAVEREF is selected in ADD mode, no room to store copies of the above mentioned WFs exists, so the scope turns OFF CH1 and CH2 and only shows 2 ADD WF2, one being updated and one fixed (the reference WF)

I made a spreadsheet of all the combinations of CH1, CH2, ADD, CHOP. SAVE, SAVEREF and AVG/ENV and came up with 28 different supported combinations, each with its own resulting internal configuration

Ramp generation

 

Displaying a WF in digital mode requires that 2 signals are sent to the CRT: a horizontal sweep voltage and a vertical offset voltage.

The 468 has its own sweep generator in the digital section (there is also a sweep generator in the analog section). A sweep in Storage Display mode goes from 0 to 6V . In normal mode, this lasts 4 mSecs and corresponds to 512 vertical values, so the horizontal voltage increment per value is 11.72 mV. Please note that this is completely unrelated to the TIME/DIV mode: TIME/DIV determines the Timebase (TB) used to acquire the WF. Once acquired, all WFs are displayed using the same speed.

U444 pin 6 is the generated sweep ramp. The duration of this ramp depends on how long the Display cycle lasts (which depends on the number of vertical values). Normal WF: 4 mSec (512 values), amplitude is 0..6V. Short WF: 2 mSec (256 values), amplitude is 0..3V. There is also a cursor line ramp: 1 mSec (128 values), amplitude is 0..1.5V. Interpolated WFs have other values.

U465 amplifies this ramp signal (if < 4 mSec) such that the horizontal ramp for all cases goes from 0..6V, but for short WFs and cursor lines, fewer vertical values are used. U465 is an D/A converter but wired as an digitally controlled amplifier. For a short WF, the hgain value is 125. If the ramp voltage at U465-16 is 3V (end of ramp for short WF), the result at the output of U553B is a voltage level of 6V (but inverted).

While the horizontal sweep progresses from 0 to 6V, the 468 offers vertical sample values to deflect the beam in the vertical plane, to recreate the digitized WF. These values are stored in the Display Memory and an autonomous system reads the Display Memory, sends the sample value to the vertical Digital to Analog converter, increments the memory address and then repeats this either 256 (in 2 mSecs) or 512 (in 4 mSecs) times. For the cursor line, it uses the same vertical value to get a horizontal line 128 (in 1 mSec) times, either a solid line or a dashed line. The 468 CPU only starts these operation. When the Display system is finished rendering a WF or line, it interrupts the CPU which then copies new WFs to the Display Memory, if any, then schedules the next WF or line to display.

 

Waveform Display

 

As mentioned, a normal WF takes 4 mSec to display so the maximum refresh rate of the display in digital mode is 250 Hz (showing 1 WF and before overhead handling the Display Interrupt). When 4 WFs plus 2 cursor lines are displayed, the 4 WFs are always short so the max refresh rate is 1000/(2 + 2 + 2 + 2 + 1 +1) or almost 100 Hz. This is best shown when the SAVE button is activated since no new WFs are being acquired; the same WFs are shown over and over again and the image is very stable.

However in normal mode, new WFs are being acquired continuously, replacing the existing WFs over and over again. Since no two acquired WFs are identical, the image will be bouncy: you are seeing different WFs all the time. The time it takes to acquire a WF is difficult to predict since it not only depends on the Analog to Digital converter (who's duration depends on the selected Timebase) but also on the trigger moment. The WF offered at the BNC connectors for Channels 1 and 2 is piped to both the analog and the digital portion but the analog portion always determines the trigger point, the point in a WF that corresponds to the previous cycle so the displayed WFs look stable (assuming a repeating pattern). The 468 has to copy the acquired bytes from internal Ram buffers to the Display Ram every time a new WF is acquired; this is a slow process and the screen cannot be refreshed while the copying is going on. As a result the 468 screen shows a lot of flickering, especially at faster TBs

At a fast TB, many WFs are acquired (and thus copied to the Display Ram) and the image looks more unstable. At a slow TB, it may take a while to acquire a new WF so the same last acquired WF is displayed much more frequently, resulting is a more stable image; only relevant at very slow TB like 500 Hz.

 

instrumented DATA:

 

    0.2 mSec/Div -> 2 mSec/WF:    170/177 (Acq/Refresh) 500Hz Sine Wave

    0.1 mSec/Div -> 1 mSec/WF:    191/191 (Acq/Refresh)

    >= 50 uSec/Div  -> 0.5 mSec/WF:  191/191 (Acq/Refresh) until Sine Time Expansion (50% reduction Acq rate)

 

 

CPU bottlenecks

1. Loop copying samples to Display Ram: no Display Refresh while the loop runs

2. Sine convolution: dramatic reduction in WF acquisition rate because acquisition complete event service is delayed until the Sine convolution for the last acquired WF is complete.

Old computer systems with intergrated video like to steal cycles from the video refresh to update the video ram. When the 468 Autonomous Display System (ADS) runs, it takes 7.8125 uSec per sample (4 mSec/512) to update one sample. An average 8085 instruction takes 3-5 uSeconds to execute so it is impossible for the 8085 to attempt copying samples to the Display Ram mode by stealing cycles (which would requires changing Display Ram mode).

 

If code space is available, the loop copying the samples to Display Memory, the bottleneck loop, can be unrolled.

Copy time for one 512 samples WF:

Original V2 firmware: 12.288 mSec

Dutchtronix V3.0C firmware: 9.8304 mSec (loop not unrolled but using an 8085 undocumented instruction)

Dutchtronix V3.0 firmware: 6.144 mSec (loop unrolled)

Enabling loop unrolling improves the visual appearance of the 468 noticeably.

 

Internal Buffer Management

 

All acquisition data are stored in acquisition memory by hardware, always 512 bytes.

On acquisition complete, the samples are copied to scratch memory buffers, unzipped if Chopped Acquisition. Scratch memory has two 512 byte buffers available (or two 256 byte buffers if Chopped, total 4 available. See SAVEREF)

if Time expansion is necessary, the samples are expanded in system memory buffers (one 512 byte buffer or two 256 byte buffers, total 3 available). These expanded WFs are copied to Display Ram ASAP, then forgotten. The non-expanded samples stay in scratch memory since they may be needed if a WF is frozen (SAVE) then Time expanded by the user for detailed inspection.

If SAVEREF is enabled, the WF(s) in the first half of Display Ram (1 long WF or 2 short WFs, 512 bytes) are copied to the second half of Display Ram.

 

Folding Frequency

 

In ALT mode, the CH1 and CH2 WFs are digitized in turn: first 512 samples for CH1, then 512 samples for CH2 and so on.  In CHOP mode, Channel 1 and Channel 2 WFs are digitized interleaved (as opposed to alternating). Interleaved here means that the digitizer circuit changes input channel after every sample. As a result, each WF has only 256 samples over the sampling period: the sampling frequency for each WF is thus cut in half.

At maximum acquisition speed (about 25 million samples a second, timebase20), the Nyquist or Folding Frequency is less then 50% of the sampling frequency, about 10 MHz. In CHOP mode, the sampling frequency is reduced by 50% so it's only 5 MHz. As a result, WFs with a frequency of > 5 Mhz cannot be represented accurately on a 468 in CHOP mode and aliasing will occur.

 

Digital Waveform Acquisition: STORAGE WINDOW

 

A scope has a trigger point which indicates a synchronization point between two subsequent WFs. When WFs are synchronized this way, the user sees a steady image when the signal being inspected is cyclical, e.g. a sine wave.

The push button marked "Storage Window" allows the user to set a PRE-trigger (pushed in) or POST trigger (out) option on the 468. This sets the horizontal trigger point at either 7/8 of the screen width (PRE) or at 1/8 of the screen width (POST). When a trigger occurs (coming from the analog section of the 468), the scope collects either 64 (PRE) or 448 (POST) more samples before declaring the acquisition complete (DONE signal, there are always 512 samples per acquisition). There is a set of hardware counters for this purpose (U536 and U540 on <19>) with hard wired starting values so not configurable. Problem is, to guarantee that there are at least 512 samples in each acquisition, the trigger cannot happen until enough samples have already been acquired (either 448 (PRE) or 64(POST)). There is another set of counters for this purpose; these counters control a BHOF signal, which can inhibite the trigger signal. The counters, U210 and U206 on <14>, are loaded with starting values by the firmware and it's done in a tricky way: one memory read (acting like a strobe) does 2 things: it triggers the start of an acquisition (address 0xE200) AND it puts a value on the lower 9 bit address bits that is used as a starting value for these counters. But not the value one would expect (512 - desired count to trigger BHOF on overflow). That value, which is 512 - 64 = 448 in case of the POST TRIGGER mode, is 0x1C0 (9 bits 0b111000000) but it includes a 1 on bit 6 (starting at bit 0) and setting a 1 on bit 6 while accessing ANYWHERE in the address range 0xE000..0xFFFF causes the I/O register 0xE040 to be referenced due to incomplete address decoding. 0xE040 is register FPC which controls the Cursor Potentiometer reading. As a result, when loading the counters with the desired value at every acquisition, the cursors would go haywire. To get around this problem, the firmware uses larger values than required (to avoid setting bit 6 to 1), resulting in acquisition of 128 samples before BHOF is triggered, which enables the analog trigger signal. In case of PRE-Trigger, the 468 acquires 512 samples before BHOF is triggered
See Operator's Manual page 75.

Many digital scopes set the default horizontal trigger point in the middle of the screen. Not clear why Tektronix didn't use this convention.

 

Idea: modify the WF samples at the trigger point to mark it. Or add a dot above it?

 

WF Time Expansion

 

WF Time expansion happens in stages where every stage doubles the TB (by interpolation or convolution) in a linear fashion. A maximum of 6 steps is supported. But the time distance between the TB positions is not linear, for example TB21->TB22 is 1 uSec/Div to 0.5 uSec/Div (x 2) but TB22-> TB23 is 0.5 uSec/Div to 0.2 uSec/Div (x 2.5). The HGAIN amplifier (in hardware) is used to achieve the correct expansion. In the first case, the HGAIN factor is set to 1 (total 2x) but for the second case, the HGAIN factor is set to 1.25 (total 2.5x). The formula ((((AcquiredTB + 1) % 3) + nSteps) /3) is used to select the HGAIN factor. HGAIN determines how fast the sweep moves (the more HGAIN, the faster) so fewer samples are needed to display the complete WF in the allotted time (4 mSec in ALT mode). That number of needed samples applies to the last Time expansion step since only that WF will be displayed (not intermediate steps). Unfortuntately, the 468 hardware has no provision for early termination of the sweep. In ALT mode, it will keep going until 512 samples have been read, even though the beam is way beyond the right edge of the screen by then, so we must fill the unused samples with 0 value.

TO BE REVIEWED. HGAIN also used to set CHOPPED/CURSORLINE

It would be really clever to send a display stop signal to the ADS at the proper time (when HGAIN enhanced beam is at the right side of the display. With an HGAIN of 1.25, we only need to send 410 samples before the beam hits the right side of the display. If we could set a precise timer for the calculated arrival time, we could stop the display cycle early. Hardware supports STOP512, STOP256 and STOP128 (stop after 512, 256 and 128 samples), used for Normal, Chopped and CursorLine mode.

 

Bugs found in the original V2 firmware:
bullet

Memory test boundary violation (harmless since address decoding wraps)

bullet

Null Ptr reference in RenderWF() (harmless since ROM at address 0)

bullet

SAVEREF on startup

bullet

AVG with very small Voltage setting

 

Potential unresolved issues in V3 firmware:

bullet

Active Volts Cursor line sometimes flickers (>5 seconds period). Could be hardware.

 

Unchanged design issues:

bullet

No cursors when Number of Sweeps is displayed in Numeric Window

 

For suggestions and corrections, please contact me at:

 

           

 

Back to Tektronix 468

 

horizontal rule