Text preview for : gbdso_uk.pdf part of gameboy gameboy gameboy scheme



Back to : gbdso_uk.rar | Home

TEST& MEASUREMENT

GBDSO
Convert a Nintendo games console into a portable oscilloscope
By Steve Willis

Gameboy Digital Sampling Oscilloscope (1)

The application of dedicated games consoles to more varied functions other than just playing games is fraught with difficulties. Not only do the consoles contain highly integrated and custom-made components, there will often be no publicly available development tools or applications manuals. However the Nintendo Gameboy© is one such system which has received considerable attention from the hobby designer and enjoys a large selection of both technical and software support through a network of websites.
34 Elektor Electronics 10/2000

TEST& MEASUREMENT
Key Features:
Dual trace display Sampling Rate: DC to 1 Msps Time Base: 100 s to 5 µs/Div Inputs: AC/DC 1 MegOhm Input gain: 50 mV to 10 V/Div Line or chart recorder trace modes Real-time FFT mode with dB scale Variable persistence XY mode PC link for screen or data transfer 5 hrs operation from NiMH batteries Averaging and Auto trigger functions Reference trace storage

FFT -- the basics
The following details the specific implementation of the GBDSO FFT for those requiring a greater explanation of its operation. Initially, the input data is sampled using the standard scope capture programs. The data is then passed through a Hamming window to reduce artefacts caused by the finite sample points (rectangular window). A Hamming window was chosen as it gives a good compromise between main lobe and side lobe widths. The windowed data is recorded using a bit-reversal algorithm to suit the decimation in time (DIT) process of the FFT. The data is then processed by a discrete Fourier transform (DFT), which is implemented using a 256-point radix-2 fast Fourier transform (FFT). 16-bit arithmetic is used for the majority of the calculations, but since the GB has no multiply instruction this has to be calculated longhand by assembler software. The complex real and imaginary values of the DFT are combined to produce 128 x 32 bit values. Finally, a logarithm is taken (1 bit = 6 dB) and the data is displayed on the screen. The entire processes (excluding sampling) takes 0.8 seconds of which the FFT accounts for 90% of the time requiring 4096 signed 16-bit multiplications and 6144 signed 16-bit additions.

The attraction of using a mass produced console soon becomes clear when the time and cost involved in producing a general purpose portable instrument with processor, LCD display and user interface, not to mention the moulded case, sound system and serial port, are considered.

The Gameboy Oscilloscope
The GameBoy `GB' digital sampling oscilloscope `GBDSO' converts a GBpocket or GBcolour into a multipurpose test instrument which should prove invaluable to the hobby designer. Design of GBDSO posed many contrasting requirements: high speed, low power, low cost, small size and versatility. In order to simplify the hardware as much as possible, real-time software is used to perform the majority of control functions e.g., triggering and variablerate sampling. Once captured, the sampled data is displayed using a standard oscilloscope 10 by 8 screen format that is designed to maximise screen use. A simple four-position menuing system (one for each key) in combination with the joypad provides easy setting of the standard scope functions. A number of advanced options are also possible for the more experienced user, these include FFT analysis, XY mode, averaging and reference storage. A serial data link allows the displayed screen or trace data values to be transferred to a PC computer via the computer's printer

port. The PC software is MS Windows 95 compatible. The oscilloscope has two input channels CHA/B, with independent software-controlled variable-gain amplifiers. The inputs have a 1-M input impedance so they can be connected directly to 1:1 or 10:1 scope probes or to an audio jack lead. (limitations on size made BNC type connectors impractical). The amplifiers can be AC or DC coupled by means of a switch. The variable-gain amplifiers give an input sensitivity of 50 mV to 10 V per division with 10:1 probes and an input bandwidth of DC to 100 kHz. The displayed trace has two modes of operation. For low frequencies (100 s to 100 ms/DIV), a chart recorder style of display is produced with the trace scrolling across from the right hand side. For high frequencies (50 ms to 5 µs/DIV), an

entire screen of data is captured before it is displayed (standard mode). The number of samples captured per scan may be set to either 240 or 600 points per channel, allowing the visible screen window to be moved relative to the initial trigger. Sampling of the two input channels occurs simultaneously, except for the 10 and 5 µS/DIV ranges, when the channels are sampled on alternate traces relative to the trigger (alternate mode). CHA may also be saved as an on-screen reference, thus allowing a total of three traces to be displayed at once.

Gateway: the ROM cartridge interface
All the signals required for the oscilloscope are available on the external ROM cartridge slot, so no modifications need be made to the GB console itself. The oscilloscope cartridge plugs into a custom 32-pin card edge connector on the underside of the GB and interfaces directly to

RAM_CS RD WR ECLK +5V

top view A0 - A15 D0 - D7 RESET AUDIO IN GND

1

32

GAME BOY

990082 - 11

Figure 1. Gameboy card edge connector (end view of ROM cartridge).

10/2000

Elektor Electronics

35

TEST& MEASUREMENT
5V
D1

5VA
C3 1p8 R5 470k 3 R6 4k7

2V5
R7 4k7

IC5
2

BAV199
S1

5VC
C17

3 7 6 10 100n 11 15 D0 D1 6 7 8 9 17 18 19 20 11 22 21 15 14 13 12 12 11 10 DX 0 1 2 3 4 5 6 7 G 0 7 D0 D1 D2 D3 D4 D5 D6 D7 14

1D

4

D5

5VA

5

D6 C5 C14 100n 8

K1
CH B
C2 100n R1 1M 1% 6 R2 1M 5 1% R4 1M C1 18p R3 4k7

1% 0V 7

5VA

2

IC1a

1

1% 1%

2V5
5 24

12

D7 100n 8

C7 14 220p 1

MODE REF+

13

D4

IC1b

IC1
4 C4 100n C12

IC3
4

C5 C9 100n 16 12 13 W0 11 15p

5VC
R C1 9 1

IN4 IN3 IN2 IN1

IC4

D2 D3 D4 D5

1V25

2 3 4

100n

IC1 = MC33182D

74HC175D 5V

5V
P1

H0

L0

1V25 23 10 PD RD WR CS

MAX114 CAG

D6 D7 INT A0 A1

IC2
COUT 10 6 7 9 14 D1

15 16 13

2V5

100k
CW

2V5

2 C8 100n 1 15

NC VB NC

RESET CLK DQ SOUT

0 2

1 2 3

RD WR A13

5V
K3 1 2 3

REF­

+5V ECLK WR RD RAM_CS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 RESET AUDIO _IN GND

5V

D2

5VA
C13 3 1p8 R12 470k 8 H1

DS1267S100 BAV199
S2 L1 W1 5 4 D1

IC6 74HC138D
4 A14 ECLK A15 A0 A1 A2

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

9 7

&

5 6

2V5
C15 R14 4k7 15p

K2
CH A
C11 100n R8 1M 1% 2 R9 1M 3 1% R11 1M C1 18p R10 4k7

1% 1 6 0V 5 7 R13 4k7 1%

A3

5V
C18 100n 2 VPP 32 11 10 9 8 7 6 5 4 29 28 24 27 3 30 31 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14

A4 A5 A6 A7 A8 A0 A1 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7

IC3a

IC3b

1% C16 220p

IC3 = MC33182D

5VA
D0 13 14 15 18 19 20 21 22 D0 D1 D2 D3 D4 D5 D6 D7

A2

P2

R15 15k

D1 C20 100n R17 100k 8 1% 1 R16 100k 1% 5 C19 100n 6 L3 100µH C33 7 D2

IC7

A3 A4 A5

2V5

100k
CW

2V5

5VC

D3 D4 D5 D6 D7

EPROM 27C256 PLCC

A6 A7 A8 A9 A10 A11 A12

C24

2

5V
2

10µ 6V 3 C­

3 5 C+ L1 1 100µH

IC8a

2V5 5V
L2

5V

D3

IC8b
4

10µ 6V

IC9 MAX828 EUK

2V5
C21 100µH

5VA
OE 25 RD

A13 A14 CS 23

ZR25D01

IC8 = TLC27L2CD
C25 10µ 6V C26 10µ 6V C27 100n

100n

C22 10µ 6V

C28 10µ 6V

16

C23 100n

C29 100n

16

16

C30 100n

C31 10µ 6V

A15

32

4

IC5
8

IC6
8

5V

990082 - 12

Figure 2. Circuit diagram of the GBDSO cartridge. Stop playing games -- turn the Nintendo Gameboy into a sampling oscilloscope with a large clear display!

the data and address busses of the GB Z80 (like) main processor. The pin functions of the card edge connector are shown in Figure 1.

Circuit diagram
As you can see from the circuit diagram in Figure 2, the GBDSO cartridge, despite its rather complex function, contains a relatively small number of integrated circuits. The GB is controlled by an 8-bit Z80-like processor that gives a direct addressing range of 64 kB. However internal devices e.g., LCD, RAM, sound etc. use most of the top 32 KB leaving 0000-7FFF available for external ROM and A000-BFFF for external RAM. The GBDSO program is stored in a low power 27C256 32 kB EPROM, IC7, occupying lower memory at 0000 to 7FFF which is executed upon power-on. The ADC and input gain control chips occupy a single memory location at A000.

Address decoding consists of a 74HC138 1-of-8 decoder, IC6, that decodes the address range down to A000-BFFF and provides two enable signals: 1. A000./RD at pin 9 accesses the ADC and reads CHA/B 8-bit data value while reinitialising the ADC for the next sample. 2. A000./WR at pin 10 accesses the 74HC175 quad latch and writes data to the DS1267 gain control circuit, or selects the input sampling channel of the ADC. The DS1267 from Dallas Semiconductor is a dual channel 10-k digital gain control potentiometer with 256 wiper positions per channel. Data is transferred to the device through a serial interface via the 74HC175 latch, this updates both pot

values simultaneously. Once updated, the values are held until the next update or the power is removed. A condensed datasheet of this interesting IC may be found elsewhere in this issue. The GBDSO analogue circuitry requires ±5 V to operate, so an inverting capacitive charge pump circuit is used to provide the negative supply. The device used for this is a MAX828EUK (IC9) which has an internal oscillator that operates at 12 kHz. This allows relatively small capacitors to be used for smoothing. However, to prevent any high frequency noise being passed to the sensitive input amplifiers, additional LC filters are used. As already mentioned, the CHA/B input amplifiers are designed to be compatible with 1:1 or 10:1 (0 or

36

Elektor Electronics

10/2000

TEST& MEASUREMENT
9 M) probes, each input amplifier having a relatively high input impedance of 1 M. This is achieved by feeding the signal via a 1-M resistor (R1; R8) into the negative input of a CMOS opamp (IC1b/IC3a) type MC33182D. This device is marked by low power, high slew rate and JFET inputs. By utilising the negative input of the amplifier, the signal is fed to a virtual ground, reducing bandwidth limitations imposed by stray capacitance on the inputs. Input protection is provided by D1/D2, which are type BAV199 dual low-leakage diodes. The negative input also forms a current summing junction for the DC zero preset (P1/P2) which is adjusted to reduce DC errors at high gain settings. The variable-gain amplifier section consists of IC1a/IC3b and the electronic potentiometer inside the DS1267. The amplifier is configured as an inverting amplifier with the potentiometer forming the input and feedback resistors (wiper is W0). By changing the wiper position through software, the gain of the amplifier can be varied between 0.004 and 255, considerably reducing the amount of input circuitry required and eliminating the need for mechanical switches. Interfacing to the 8-bit ADC type MAX114 from Maxim (IC4) requires an input signal in the range 0-2.5 V. To achieve a stable reference voltage with varying supply, a 2.5-V bandgap diode type ZR25D01 is used. DC biasing of the CHA/B amplified signal to match the ADC input is achieved with two 4k7 resistors which transform the ±2.5-V amplifier signal into 0-2.5 V for the ADC. The MAX114 is identified by Maxim as a `1-Msps, 4 &8-Channel, 8-bit ADC with 1-µA Power-Down'. The device is good for a conversion time of 680 ns per channel, and features internal track/hold circuitry that does not require an external clock. Finally, the power supply is rigorously decoupled to prevent high-frequency noise affecting the operation of the sensitive input circuitry. A combination of electrolytic capacitors and smaller solid ones of 0.1 µF, plus two 100-µH chokes are employed to keep supply-borne noise to a minimum.

Table 1. Key Function Menu
Joypad UP Down Right Left SELECT-`TRIG' Trigger level Trigger mode1 Highlighted Function Key START- `Timebase' B - `CHB' Screen window Position Timebase scale2 Y Position A - `CHA' Y Position

Input gain Scale3

Input gain scale3

Notes. 1. Trigger modes for CHA are Auto, Auto, Normal, Normal. Auto trigger -- produces a trace if a trigger has not occurred within a set time Normal trigger -- holds the trace until a trigger occurs 2. Timebase scale range is 500,200,100,50S etc. up to 5 µS/DIV. 3. Gain scale range is 10,5,2,1V,500,200,100,50 mV/DIV,GND,OFF

Gameboy software
The GBDSO software that resides in the EPROM on the cartridge board was written in a mixture of assembler language and `C', with assembler used for the real time data acquisition and display and `C' provides the user interface. The `C' compiler used was GBDK V. 2.17, which is a public domain program written by Pascal Felber and Michael Hope5. GBDK is an excellent means of quickly developing dedicated software for the Gameboy, as it contains many predefined functions for interfacing to dedicated GB hardware

e.g., joypad, screen and sound generator. For more information on software development have a look through the list of references which will be given at the end of next month's concluding instalment.

User interface
On power up the GB starts to execute the GBDSO interface program that resides in external EPROM. The program initially displays an intro screen and a set of four predefined start options which initialise the scope settings: Single/Dual/Logic/AC. The scope is now ready for use. Figure 3 shows a typical display screen with both channels enabled,

990082 - 13

Figure 3. Typical view from dual trace screen.

10/2000

Elektor Electronics

37

TEST& MEASUREMENT
Standard menus By pressing A/B/Start/Select, the appropriate function will be highlighted on the bottom line of the scope (note CHA is highlighted). Once a function is highlighted, the joypad control can be used to adjust the values associated with that function, as shown in Table 1. Advanced menus The function key menu provides a quick means of changing the standard scope settings with as few key presses as possible. However, if the highlighted function key is pressed a second time then an advanced menu will be displayed. The advanced menu options may be found in Table 2. Each advanced menu has three options and an exit. When an option is selected with the function key it will be enabled immediately and the screen will return to normal operation. Some options switch between one of two modes e.g., average on/off. The normal screen will display which of the two modes is currently selected. The following section describes in greater detail the operation of each option. `A' Advanced menu 600/240pt, selects the number of points sampled each trace scan. By moving the screen window position with the `timebase + ' menu, it is possible to scroll through up to three screens of data in 600pt mode. The current window position and size are shown in the top right corner of the screen. The default mode is 240 points as this gives the fastest screen update rate. In FFT mode this is fixed at 240 points. Auto Trigger calculates the average value of CHA relative to the current timebase setting, the trigger is set to this value. Average, averages CHA (and CHB if enabled) using previous trace scans. The average is calculated from X=X+(Xnew­X)/8. This can be useful for removing uncorrelated noise from a trace, so the required signal can be measured. `START' advanced menu CHAREF, Stores the current trace of CHA to the reference channel and displays it allowing up to three traces on the screen at once. Selecting this menu again will clear the reference. The letter R will appear in the lefthand column indicating a reference trace. SCREENPC, The current scope screen will be transferred to the PC computer via the link lead. When the start of transfer has been

Table 2. Advanced Menu Screens
Function Key Select Start B A Not used Advanced menu screens

Time to XY

10k

500Hz 6V pk-pk

CHA

100n

CHB

990082 - 14

Figure 4. RC network and XY mode.

acknowledged, the GB will beep and the progress indicator will change on the PC. At the end of transfer the GB will beep again. The screen will be converted to a black and white 160x144 .BMP format by the PC and can be saved to disk. DATAPC, The current data values (not screen) of CHA and CHB will be transferred to the PC computer in a similar method to that above. Data can be saved to disk as raw data or in MathCad 6.0 format for importing back into the computer for analysis. See the section on the PC Link

Interface (part 2) for more details. `SELECT' advanced menu FFT, changes scope operation to FFT mode. FFT mode produces a spectrum analysis of the sampled data, where the horizontal axis represents frequency and the vertical axis represents amplitude in dB (10 dB/DIV). See the FFT section for more information on the FFT mode. XY, changes the scope operation to XY mode with the horizontal trace deflection set by CHA and the vertical deflection set by CHB. The trace persistence (how long each point is

Time to FFT

990082 - 15

Figure 5. FFT of 1 kHz 0 dB sinewave.

38

Elektor Electronics

10/2000

TEST& MEASUREMENT
down. By comparison, the 1-kHz square wave of Figure 6 contains a fundamental and odd harmonics at 3, 5, 7 kHz, etc. which reduce in amplitude as the frequency increases. Closer observation of Figure 5 shows a spurious spectral peak at 3 kHz which is 30 dB down on the fundamental, this is in fact produced by the signal generator and represents distortion of the pure sine wave. The time response gives no indications of this problem and it is clear that without the FFT mode this imperfection would not be measurable but it could cause problems when analysing circuits. Using the FFT mode can often give unexpected results and some experimentation and experience is required to obtain meaningful results. Here are some points to consider. Make full use of the 8bit samples, if possible adjust the signal amplitude or reference marker so that the input signal is at its maximum i.e.: the highest peak is just below the reference marker. The Reference Marker range is 35, 30, 20, 15, 10, 0, ­5, ­10 dB, GND. Do not increase the signal above this point as this will saturate the scope amplifiers and introduce spurious harmonics. If a signal contains a wide spectrum of frequencies, often the frequency components that extend beyond the FFT will be reflected back so that they become visible again, which can be misleading. By increasing the timebase frequency you can reduce this effect. The Timebase scale range is 10, 25, 50 Hz etc., up to 100 kHz/DIV. To lower the noise floor, use the averaging mode. Measuring small signals with a large fundamental, is possible if you use a notch filter circuit (e.g., twin-T) to remove the fundamental component before the signal is applied to the scope. This effectively increases the scope's dynamic range.
(990082-1)

Time to FFT

990082 - 16

Figure 6. FFT of 1 kHz 0 dB squarewave.

displayed) can be set to 100 ms, 1 s, 10 s, 100 s or OFF (infinite). The maximum number of points plotted on the screen at any time is 600. See the XY section for more information on the XY mode. TIME, changes the scope operation to normal scope mode with the horizontal axis representing Time after an initial trigger point and the vertical axis representing amplitude in Volts.

measuring slow changes.

FFT Mode
Normally, signals are considered as varying in amplitude with time and are therefore measured as a function of voltage versus time. However, all continuous signals can be constructed from a fundamental and harmonically related (Fourier) components which are best represented logarithmically as magnitude (dB) versus frequency (Hz). This is more commonly known as a spectral analysis and is often used in audio systems to measure the performance of an amplifier, or the purity of a signal. The GBDSO computes the spectral analysis using an algorithm known as the fast Fourier transform or FFT which is a mathematically intensive method, normally associated with high speed digital signal processors ­ DSPs. Nevertheless, by coding the algorithm entirely in assembly language and optimising its performance, the FFT is performed in just 0.8 seconds. A full discussion on frequency analysis is beyond the scope of this article, but by considering a few examples it will soon become clear how useful the FFT mode is and in what circumstances it should be used. Figure 5 shows a 1-kHz sine wave of amplitude 0 dBVrms or 1.414 Vpk (0 dB = 20log(1V rms), rms=pk x 0.707). The vertical scale is fixed at 10 dB/DIV and the reference marker (represented by a dotted line near the top of the screen) is determined by the ACH gain setting in dB. Since the sine wave contains only one frequency component (the fundamental), the frequency spectrum shows a single peak at 1 kHz. With the reference marker set to 0 dB, the noise floor is about ­45dB

XY Mode
The XY mode allows the horizontal and vertical deflection to be controlled by CHA and CHB respectively. This can be used to display how one circuit parameter is changing with respect to another. A simple RC network demonstrates how phase shift is introduced into a circuit by the capacitive component, see Figure 4. The input sinewave moves the trace horizontally and the `phase advanced' output from the RC network moves the trace vertically resulting in a circular image. Changing the frequency and waveform type gives some interesting effects. In XY mode the trace persistence (how long each point is displayed) can be set from the timebase to 100 ms, 1 s, 10 s, 100 s or OFF (infinite). When the persistence is set to OFF, the points plotted on the screen remain visible until the screen is cleared by pressing one of the function keys. When the persistence is set to one of the time values, a maximum of 600 points can be displayed at a time and they will remain visible for length of time defined by the timebase setting. Therefore, the 100ms setting is used to measure fast changes and the 100-s setting for

Next month we continue with the PC Link Interface, the construction of he cartridge, testing and calibrating the instrument.

Warning
When using 10:1 probes, the maximum input voltage applied to GBDSO must not exceed ±50 V; with 1:1 probes the maximum input must not exceed ±16 V. Under no circumstances should 230/110 V mains voltages be applied to the GBDSO.

10/2000

Elektor Electronics

39

TEST&MEASUREMENT

GBDSO
Design by Steve Willis

Gameboy Digital Sampling Oscilloscope (2)
Part 2: PC link, DSOGrab, construction and testing

PC reads an initiation byte from the serial port via pin 10. The PC will then write back to the GB via pin 2 and serial transfer commences. Two modes of transfer are possible: Screen transfer where the entire screen is sent to the PC and saved in a .BMP format. Data transfer where the actual data values of CHA/B are sent to the PC. The raw data format is as follows: 600 bytes of CHA data, 600 bytes of CHB data. CHA position, CHB position, CHA gain, CHB gain, TIMEBASE setting (1 byte each). The CHA/B data values are the actual screen points and have a range between 7 and 127. The CHA/B position bytes are where the trace zero reference markers are on the screen, again between 7 and 127. The CHA/B gain values are between 0 and 9, with 0=OFF and 9=10V (see `Standard Menus'). In FFT mode 0=OFF and 9=35dB (see `Getting the most out of the FFT'). The TIMEBASE setting is between 2 and 26, with 2=5uS and 26=500S (see `Standard Menus'). In FFT mode 2=100KHz and 12(max)=10Hz (see `Getting the most out of the FFT'). When data is saved as MathCad 6.0 format, data and position values range between 0 and 127. The GAIN

The PC Link Interface
Data may be transferred from the GB to a standard PC computer via a link lead, which connects the GB link port to the PC printer port. The associated software utility to run on the PC is called `DSOGrab' and may be obtained on floppy disk (see Software Items inset). The GB link port is in fact a serial data port but unfortunately the data format is nonstandard and therefore has to be read as a data stream by the PC and converted back into byte format. The connections of the GB link port are shown in Figure 7. All outputs and inputs to the GB link port are TTL compatible and can be connected directly to the PC printer port. Extra care

must be taken when wiring the link lead to make sure all the connections are correct as errors could cause permanent damage to the GB or PC ports. The loop-back connection between pins 4 and 11 is used to test if the software can see the connector and is used for fault diagnoses. The GB link port contains an 8-bit shift register, which contains the current data byte to be sent or read. Clocking of this register can be done externally by pin 3 of the printer port. Initial synchronisation between the GB and PC is achieved when the

12

Elektor Electronics

11/2000

TEST&MEASUREMENT
PC Centronics D25 plug
13 25 12 24 11 23 10 22 9 DATA GND GND DATA CLOCK 21 8 20 7 19 6 18 5 17 4 16 3 15 2 14 1 990082 - 17

and TIMEBASE values are converted to floating point values representing the actual scale settings. A MathCad demonstration file is included in the Windows 95/98 link software disk supplied for this project.

Game Boy link lead plug
front view

Assembly
Assembly will require a very steady hand and some practice if you have never soldered surface mount assembly (SMA) components before. Soldering will require a fine tip iron with a 1-mm tip, 26-gauge low melting point solder or solder paste and pair of fine tweezers. A solder wick is useful for removing excess solder, but do not use a solder sucker as this will probably break the PCB tracks. There are two methods of building the circuit, if you are competent at SMA handling then you skip the step by step approach below. The following steps allow each semiconductor to be soldered and tested in turn to check for

Figure 7. GB to PC link lead (view shows front of plugs).
COMPONENTS LIST All components SMA (surface mount assembly) Resistors: SMD case 0805, 0.1 watt R1,R2,R4,R8,R9,R11 = 1M 1% R15 = 15k R5,R12 = 470k 1% R3,R6,R7,R10,R13,R14 = 4k7 1% R16,R17 = 100k 1% P1,P2 = 100k preset Capacitors: SMD case 0805 C1,C10 = 18pF NP0 C2,C4,C5,C8,C9,C11,C12,C14,C17C21,C23,C27,C29,C30 = 100nF C3,C13 = 1pF8 NP0 C6,C15 = 15pF NP0 C7,C16 = 220pF NP0 Electrolytic capacitors SMD Case A C22,C24,C25,C26,C28,C31,C33 = 10µF 16V Inductors: L1,L2,L3 = 100µH Semiconductors: D1,D2 = BAV199 (print on case: JY) D3 = ZR25D01 (print on case: 25R) IC1,IC3 = MC33182D (Motorola)

IC2 = DS1267S100 (Dallas Semiconductor) IC4 = MAX114CAG (Maxim) IC5 = 74HC175D IC6 = 74HC138D IC7 = AT27C256R-12JC in PLCC44 case (programmed, Publishers' order code 9965281) (Atmel) IC8 = TLC27L2CD IC9 = MAX828EUK (print on case: AABI) (Maxim) Miscellaneous: S1,S2 = `'Secme' slide switch, 1 changeover contact, PCB mount K1,K2 = 3.5mm PCB mount stereo socket (make sure it fits the board) PCB, Publishers' order code 990082-1 Disk, Publishers' order code 996035-1

K2
C10

S2
R8 C14 C11 R10 C13

K1
C1

S1

(C) ELEKTOR
C2 R1 C3 C8 C9 R5 R2 C5 P1 R4 R3 IC1 C27 R17 R15 C31 C26 L1 C25 IC9 C22 L3 C16 C23 L2 IC8 D3 C7 C21 R16 C17 IC4 C24 C33 D1

P2 C30 IC6 IC5 D2

R11 C6 IC3 C15 R6 R7 C20 C4

R9 C12

R12

IC2 C29 R13 R14

C19

C18

990082-1

IC7 C28

K3

Figure 8. PCB design for the double-sided through-plated cartridge board.

11/2000

Elektor Electronics

13

TEST&MEASUREMENT
Plastic Strip

Cut Out

990082- 19a

Bottom View

Top View

CHA

DC : AC

CHB

DC : AC

Digital Sampling Oscilloscope

990082 - 18
990082- 19b

Figure 9. ROM case cut outs, and home made metal film.

Figure 10. Calibrating the 50 mV/DIV range on CHA and CHB

Did you know
that all hyperlinks printed in this magazine are directly accessible through the Hyperlinks page of our website at http://www.elektor-electronics.co.uk ? No need to type urls anymore, plus we'll do our best to keep track of websites moved since publishing the magazine.

short circuits during assembly. 1. Disassemble the plastic ROM case (see below) and place the PCB in the bottom. Carefully plug it into the GB. Switch on and check the black scrolling start screen appears. If not, there is a short on one of the GB interface tracks. 2. Solder the EPROM onto the PCB taking the usual static precautions. A good tip is to solder just two corner pins first and get the device aligned before soldering the rest of the pins. Place the PCB back into the case and switch on. The GBDSO intro screen should now appear and all the scope menus should work. If not, check for shorts. 3. Now solder the MAX114 ADC and 74HC138 and check that the unit still starts. 4. Finally solder the 74HC175 and DS1267 EPOT devices and capacitors C17, C30. Check the unit still starts. If not, check for shorts. Start with the resistors and small capacitors, taking care not to short any tracks or touch the edge connector with solder. Some tracks run under components, and care should be taken not to short out these tracks. The

inductors and tantalum capacitors are next, followed by the semiconductors. Note that the tantalum capacitors and semiconductors must be soldered the correct way around. Static precautions must be taken when soldering the sensitive input amplifiers IC1 and IC3. Finally, solder the jack sockets and AC/DC switches. It is advisable to cut the socket leads flush to the board before soldering and then gently file/sand the joints to be flat to the PCB. The ROM cartridge is a standard

case, which can be obtained from an old game. It is held together with one tamperproof screw that can be undone with a pair of fine nose pliers or cutters if the correct tool is not available. It is necessary to cut and file out the back of the bottom plastic case to accommodate the jack and AC/DC switches at the rear of the ROM cartridge -- see Figure 9 and the photographs. The PCB should now fit snugly into the bottom of the case. Finally, the top case section must be cut to give enough clearance for the jack sockets. It is

Figure 11. Completed cartridge board, ready for inserting into the Gameboy console.

14

Elektor Electronics

11/2000

TEST&MEASUREMENT

Figure 12. Rear view of Gameboy console with GBDSO cartridge removed (left) and installed (right).

advisable to stick a thin sheet of plastic (1×17×55mm) along the top of the cartridge for strengthening. To improve the GBDSO performance when measuring small signals, a thin sheet of metal (copper or aluminium) is bent around the case and stuck with double-sided tape. This is grounded by the jack plug nuts. This reduces interference caused by the LCD controller that can be picked up by the high impedance input amplifiers.

the inputs to AC then the traces should return to their zero position.

Scope probes
For normal operation, conventional scope probes with a 1:1 or 10:1 switch give ideal performance and extend the input voltage range by a factor of ten. The screen scale is calibrated for 10:1 probes (9 M resistance) and one should remember to multiply the scale by a factor of ten when using 1:1 probes (0 M resistance). Most commercial probes come with a BNC plug attached, which should be replaced with a mono 3.5-mm jack plug to connect to GBDSO. Care must be taken when selecting the probe to ensure that the compensation network is in the probe end and not the BNC connector. Often, soldering the inner wire is difficult and plated wire should be cleaned first.
(990082-1)

Ready-Built GBDSO Cartridge Boards

Please check our website http://www.elektor-electronics.co.uk for a readership poll and other information on ready-made GBDSO cartridge boards with all SMA parts soldered in place.

Test and calibration
To test the scope, switch on with no inputs applied and select dual-channel AC from the start screen. Set the AC/DC switches to DC (right), and both traces should appear in line with their respective A/B marker on the left-hand side. If not, adjust the DC zero level of the input amplifiers with the presets P1/2 so the traces are correctly aligned. If the traces are still not visible, check the DC voltages around the input amplifiers and ADC and compare these with the circuit diagram. Next increase the input sensitivity to 50 mV/DIV and adjust the presets again to finely calibrate the DC levels as shown in Figure 10. Set the sensitivity back to 1 V/DIV and apply a 1 kHz 1 Vpk sine wave to the either input channel and check that each trace responds to the signal. Next, apply a DC voltage to the inputs (e.g., 5 V regulator) and check the Y scale calibration. If you switch

7. Dr Pan's Gameboy technical documentation: www.gbdev.org/news/dl.html 8. Paul Robson's GB97 emulator: http://users.aol.com/autismuk/ gameboy.htm urls available as hyperlinks on the Hyperlinks page of the Elektor Electronics website.

Project Software
The following software items may be obtained through the Elektor Electronics Readers Services: EPROM AT27C256, ready-programmed, order code 996528-1. Disk, contains DSOGrab utility and MathCad demonstration file, order code 996035-1. Please note: these software items are not available as free downloads from our website because the author retains the copyrights. Also, by contract he receives royalty payments for every copy sold of the project EPROM (996528-1) and disk (996035-1).

References: 1. Digital signal Processing ­ Ifeachor Jervis, ISBN 0-201-54413-X 2. Z80 Assembly Language Programming ­ L.A. Leventhal, ISBN 0-931988-21-7 3. Author's Gameboy web page: www-ev.phy.cam.ac.uk 4. Jeff Frohwein's Technical Page: www.devrs.com/gb/ 5. Pascal Felber and Michael Hope's GBDK: http://gbdk.sourceforge.net/ 6. Ian James GBDS: www.geocities.com/Eureka/9827/

11/2000

Elektor Electronics

15