contents
4.0 Hardware Design
4.1 Introduction
The hardware is a basic
sampling system. An analogue television signal is converted into digital information,
which is then stored in SRAM. The SRAM and sampling process is controlled
by a control unit.
PAL specifications state
that one complete line scan takes 64us. With a sampling rate of 20MHz and
memory capacity of 128KByes the number of lines that can be sampled is calculated
as follows, 1/20MHz = 50ns, 1 line scan = 64ns therefore the number of samples
per line is 64ns/50ns=1280 samples. 128K of memory holds 131072 samples. Therefore
the total number of lines that can be stored is as follows, 131072/1280=102
Lines.
The design is divided
into 4 units. These are sampler hardware design, interface design, embedded
software design and PC display software design. The sampler is done in 2 phases.
Phase 1 is the development of a simple sampling device in order to be able
to work upon and experiment with the software at the earliest possible opportunity.
The second phase is done after the first phase and some software has been
designed and tested to such a degree that the system is shown to produce some
colour images. The second phase is done to improve performance and add some
extra functionality.
The interface design is
to allow data from the sampler circuit to be loaded into the microprocessor
and also allow processed data to be sent to the PC. The PC software is to
allow an image to be displayed.
4.2 Sampler Hardware Design
Method
4.2.1 Analogue to Digital
Converter
The analogue to digital
converter samples the input signal at 20MHz and has an 8bit resolution. The
output of the A-D converter is tri-state and only writes to the data bus when
the memory is high impedance.
The Analogue AD775 analogue
to digital converter (ADC) was chosen because the dynamic range of the ADC
can be configured. If a 0 to 1 voltage range is used the ADC gives 256 steps
of 3.9mV. If a 0 to 5 voltage range was used the ADC gives 256 steps of 19mV.
By selecting a dynamic range of 0 to 5 volts the ADC is insensitive to noise
of less than 19mV. However the video signal is only 1V p-p so it therefore
needs to be amplified of 5V p-p. This is done by using a video speed op-amp
with a gain of 5.
4.2.2 Op-Amp
The op-amp input circuit
performs 2 functions, one is to amplify the 1v p-p video signal to 5v p-p,
the other is to give the signal a DC offset so that the image data, the colour
burst and the sync pulse can be sampled, whilst allowing the image data to
occupy as much of the dynamic range as possible. This is done using a single
non-inverting op-amp circuit with adjustable gain and DC offset.

This circuit is an adapted
non-inverting op-amp circuit The change is the introduction of a no zero reference
voltage for the negative feedback potential divider. The 1K potential divider
is connected to the 10K potential divider, as shown below. The voltage produced
by the 1K potential divider can be said to be a constant reference voltage.
When viewed in the frequency domain the +V and 0V can be said to be short
circuited, resulting in a simple potential divider, thus giving a constant
frequency response.
In
amplifying the PAL signal a small amount of noise is added, however this noise
is trivial compared to the noise that could be picked up if a quantization
value of 3mV is used. 4.2.3 Memory and Counter To address 128KBytes
of memory a 17-bit synchronous address counter is required. This is done by
cascading five, 74F161 counters together, as indicated below. The clock is
common to all five I.C. counters and the RCO output is used as the count-enable
for the each successive I.C. A synchronous counter is essential because during
writing to the memory, any propagation delay glitches caused by a ripple counter
would cause data to be momentarily written to the wrong address, causing image
and line errors. The RCO of each counter is only asserted when the output
of the previous stage is equal to F16 (11112) and all
previous stages are equal to F16 (11112), thus ensuring
that higher order counters are not erroneously incremented when the previous
stage is F16 (11112) but the stages before that are
not yet F16 (11112). Ref[2]

4.2.4 Control Logic
4.2.4.1 Memory and
ADC bus synchronisation.
In order for the sampler
to be able to read or write, the memory and ADC must be synchronised so that
both devices to not try to write to the bus simultaneously. The ADC and the
memory have output enable pins, which control the tri-state buffers of the
output registers of each device. To ensure that the devices do not simultaneously
write to the data bus the control logic ensures that the output enable pins
of the devices are never asserted at the same instance. The output enable
pin of the memory will be referred to as /OE and the output enable pin of
the ADC will be referred to as /ADOE
4.2.4.2 Set-up, hold and
output times.
When sampling at 20MHz
propagation delay, set-up and hold-time are significant issues. The logic
must be designed so that all components work together and do not cause problems
for other components. The memory can be in write mode or read mode. When in
read mode the output of the device is enabled, this is done by setting the
output enable pin to zero (/OE=0).
When in write mode the
/OE pin is set to one to disable the output, otherwise the memory would try
to read and write at the same time, resulting in corrupt data. To write to
the device the write enable (/WE) pin must be set to zero, It is shown in
the timing diagram below that the /WE pin is set to zero for half of the time
available for each memory address set by the counter. This is to synchronise
the memory with the ADC.
The specifications for
the AD775 ADC show that the ADC writes on a rising clock input. The output
time can vary from 18ns to 30ns depending on the particular ADC. The memory’s
write logic must be designed so that this is accounted for. The write and
read cycle timing diagrams for the circuits to be designed are shown below.

By starting the ADC data
output process on the rising edge of the previous write cycle (T=0) valid
data can be guaranteed for at least 8ns during the write stage (T VALID).

From the above diagrams
it can be shown that /WE and /OW are never asserted together, nor are /OE
and /ADOE. The fast SRAM has a minimum set-up time of 8nS before the end of
the /WE stage
To keep the circuit synchronous
Q0 (LSB) from the cascaded counter is used for the ADC clock and the /WE for
the memory. During the read phase these signals are not required, thus two
clock cycles are required to increment the memory address. This is a minor
inconvenience but it significantly reduces the circuit complexity and propagation
delays.
During the read and write
phases different memory clocks are used. For writing a 40MHz clock is used,
giving a sampling rate of 20MHz and a /WE time of 25ns. For reading the DSK
interface logic produces pulses to increment the memory’s address every time
a memory read is made. The different clocks are selected using a multiplexor.
See appendix B1 for a
circuit diagram.
4.3 Phase 2 Hardware Design
4.3.1 Memory IC Chip Enable
Phase two has an identical
op-amp and ADC configuration and uses the same counter. The original design
was modified to allow three memory ICs to be addressed, increasing the memory
capacity to 3Mbit from 1Mbit. The modifications comprise a second state machine
that controls 3 memory chip select signals. Every time the main counter state
machine reaches its maximum value the chip select state machine is clocked,
selecting the next IC. Shown below is the truth table for the state machine.
From the above table
4 simple equations can be found as shown below.
Q3+ =Q2
Q2+ =Q1
Q1+ =/Q0
Q0+ =/Q3
See appendix C1 for the
circuit diagram.
4.3.2 Frame synchronisation
The sampling process
starts when write mode is selected by the PC and the frame synchronisation
IC asserts the start of a new frame. This is done by setting a DFF. The DFF
is automatically cleared and the sampling stops when the counter and chip
select state machines indicate that all memory ICs are full of data. See appendix
C2 for DFF diagram. 4.3.3 Control signals The outputs form the binary
counters to into DFF’s before being put on to the output pins. The DFF’s are
clocked at the same rate as the counter. This results in the output being
delayed by half a cycle. This is to allow the control signals to catch up
with the address signals and produce a fluent transition of control signals
and address, when moving from one memory IC to the net one. See appendix C2
for the circuit diagram. See appendix C3 for the counter and top layer detail.
4.3.4 PSU The DSK circuit requires a 12V AC supply. It was decided that it
would be beneficial to use the same 12V supply to power the sampler circuit.
A simple diode rectifier and capacitor was used to produce an unregulated
value. This voltage was used by a 7805 voltage regulator to produce a regulated
+5V supply. The Op-Amp requires +/-10V. A single TCM680 single I.C. switching
regulator was used to produce this voltage. See appendix B4 4.3.5 PCB
Design 4.3.5.1 Earth plane When designing the PCB board electromagnetic emissions
were considered. Radiation is caused by inductance in the layout of tracks.
This can be minimised by removing any possible track loops. This is done by
adding earth planes to the top and bottom of the PCB. 4.3.4.2 Track layout
Since the electrical signals propagate with a finite velocity the track layout
was done in such a way that track lengths were always minimised. The tracks
were placed so that there are no 90 degree corners, this reduces EMC emission
by minimising the change in momentum of the electrons travelling down the
track. See appendix D1 and D2. 4.4 Embedded DSP Parallel Interface Design
4.4.1 DSK Memory Map and
I/O address
The interface is divided
into a data output design and a data input design. The data output circuit
developed must be optimised for data transmission. The data input circuit
must also directly control the memory address counter to ensure that data
is loaded into the microprocessor.
The TMS320 has 16 memory-mapped
ports, which can be configured to be bi-directional or unidirectional. The
micro-processor only ever received data from the sampler data bus and only
ever sends data to the PC using the EPP data bus. It is therefore appropriate
to design one input unidirectional port and one output unidirectional port.
The output port will incorporate the handshaking signal to communicate with
the EPP parallel port and the input port will also act to increment the external
memory address every time data is loaded. When addressing external memory
locations, the relative address of the port is put on to the TMS320 address
bus. This address is then decoded using a 74138 decoder. Since the two addresses
are used only Q0 and Q1 of the 74138 are required. Q0 is asserted when data
is to be written to the PC bus and Q1 is asserted when data is to be read
from the sampler.
See Appendix E for an
illustration of this.
4.4.2
Data output circuit.
4.4.2.1 EPP
To use the parallel-port
using EPP, a software function is used to read or write a byte to an internal
memory address. The address to which the byte is written to or read from determines
which parallel port is used and what handshaking signals are asserted.
Parallel port one has
a base address of 888 dec. To read or write an EPP data byte, memory address
892 is used. To read or write an EPP address byte memory address 891 is used.
This is shown in the table below.
To commence
an EPP data transfer the wait signal must be low in order for the EPP data
strobe to be asserted. When the data strobe is asserted the WAIT signal is
asserted and data is transferred to the EPP bus, once the data has been transferred
the WAIT signal goes low, ready for the next cycle. This is illustrated in
the timing diagram below.

See Appendix H for more
EPP detail. Ref[4]
4.4.2.2 Three byte transmission
(data out)

The microprocessor uses
the data strobe signal as an interrupt to start a data transfer cycle, the
wait signal is only asserted when data is written to the EPP port. This is
shown below.
When transferring data
it is more convenient to transmit three bytes at a time, one red byte, one
green byte and one blue byte. Thus if the PC requests data for a given pixel
it receives all the data it requires in one transaction. If more than one
byte is to be transmitted with one pixel request ISR the PC must issue one
initial interrupt and then be able to receive three bytes with out the need
for more interrupts.
One property of EPP allows
either the data strobe or the address strobe to be asserted. The data strobe
is used to interrupt the microprocessor and the address strobe is not connected.
If the data strobe is asserted to read the first byte and the address strobe
is used to read the second and third bytes then only one interrupt will be
issued, but the PC will read three times. By using a software generated wait
signal it is possible to synchronise the transfer of three bytes with one
interrupt. This is shown below.

Note: the Address Strobe
signal is not used and is only shown to illustrate synchronisation by using
a software generated wait signal.
Shown below is a circuit
that will produce a wait and /LE pulse when data is written to output port
zero.

4.4.3 Data input circuit.
Data is loaded into the
microprocessor using port 51. The data input circuit uses the Q1 signal generated
by the address decoder to enable the outputs of a tri state buffer connected
between the microprocessor bus and sampler data bus. The /Read Enable signal
from the microprocessor is used increment the address of the memory counter
just before the data is read by the microprocessor.
See Appendix B3 for the
complete interface circuit.
4.4 Phase 1 sampler conclusion.
An analogue to digital
converter with a dynamic range of 0-5V was chosen so that any circuit noise
below 19.5mV would not be detected. An op amp circuit with an adjustable gain
and dc bias was chosen to condition the input PAL signal such that the entire
dynamic range of the A/D was used for sampling the data. A synchronous binary
counter was chosen so that spurious asynchronous addresses are not generated
that would cause data to be written incorrectly. The write enable of the memory
was pulsed so that write was enabled only when the address counter had stabilised.
The AD output value was requested 1 cycle earlier that when it was required,
thus giving it sufficient time to be put onto the bus and becoming stable.
The effect of this was to ensure that the minimum data valid data valid before
end of write enable threshold time was not exceeded.
4.5
Phase 2 sampler conclusion.
The phase two project
uses all of the same principles as the phase 1 project but has two extra functions.
1) More memory 2) Frame synchronisation.
next