Copyright 1999, Analog Devices, Inc. All rights reserved. Analog Devices assumes no responsibility for customer product design or the use or application of customers’ products
or for any infringements of patents or rights of others which may result from Analog Devices assistance. All trademarks and logos are property of their respective holders.
Information furnished by Analog Devices Applications and Development Tools Engineers is believed to be accurate and reliable, however no responsibility is assumed by Analog
Devices regarding the technical accuracy of the content provided in all Analog Devices’ Engineer-to-Engineer Notes.
Analog Devices Serial Port Development and Troubleshooting Guide
Compiled by the Analog Devices DSP Applications group
Introduction
The purpose of this document is to assist engineers in the design and debugging of serial port communications in
systems using Analog Devices’ DSPs. First, it will cover general system design strategies to help ensure low
noise levels and valid signals throughout the system. Next, it will focus on common serial port problems and
their respective solutions. This section is processor nonspecific. The following section deals with processor
specific issues, these being the ADSP21xx family and the ADSP2106x family of DSPs. Finally, there is a
section containing example serial-port initialization code for both families of DSPs.
General ADSP-21xx / 2106x DSP SPORT Design Issues
(Note: because the serial ports on both the ADSP21xx and ADSP2106x families
of DSPs are very similar in architecture and functionality, the issues presented in
the section apply to both)
Perhaps one of the largest cause of serial port problems is poor board design. The serial ports are essentially
edge-triggered state machines - this means that every time a valid edge occurs on a serial clock line, the state
machine is stimulated. A valid edge occurs when the voltage level on a serial port line passes across
approximately 2.5 Volts in 5 Volt parts and 1.3 Volts in 3.3V parts - we will refer to this as the criticalvoltage. If the serial clock is set to ‘positive edge’ polarity (configurable in serial port control register), a valid
edge occurs when the voltage on the serial clock line passes from below the critical voltage to above the critical
voltage. On the other hand, if the serial clock is set to ‘falling edge’ polarity, a valid edge occurs when the
voltage passes from above the critical voltage to below the critical voltage.
a
Positive Edge Polarity Negative Edge Polarity
d
d
vali
Vcc
vali
Critical
point
Vdd
Vcc
Critical
point
Vdd
Figure 1 : Positive and Negative Edge Polarity
There are many design related problems that can cause noisy serial clock lines which can potentially cross the
critical voltage multiple times per one clock pulse. The example below presents two variations of the same
serial clock signal - one has a large signal reflection which causes each period of the serial clock to cross the
critical point multiple times. This will cause the state machine within the serial port to sample the serial data lines
twice per clock period causing the serial data to become corrupted. The other signal is properly compensated
so no reflections occur and the data is sampled once per period.
This signal does not contain reflections
This signal contains reflections
Figure 2: Signals with reflections
The following sections present specific design strategies to avoid problems like this one.
Decoupling the DSP’s Vcc and GND Pins
The DSP should have a .1µF capacitor connected between each of its Vcc and Gnd (Vdd) pins. This helps
keep the power supply to the DSP clean of voltage spikes and dips on the Vcc and Gnd lines. Large spikes
and dips in the Vcc and Gnd lines can cause the processor to jump into an unknown state potentially causing the
processor to crash. These capacitors should be placed as close as possible to the actual Vcc and Gnd pins of
the chip for maximum effectiveness.
Hardware Construction (PCB vs. Wirewrap)
EN-74Page 2
Technical Notes on using Analog Devices’ DSP components and development tools
Serial lines greater than about 3” will require some sort of reflection compensation. Details about this are
covered in the solutions section.
Common Serial Port Problems
This section is a troubleshooting guide. Each problem listed below contains a description of why it exists and
some techniques to isolate a specific cause. Once the cause is determined, a reference is provided for the
solutions table where conveniently enough, solutions can be found.
DSP is Receiving and/or Transmitting Corrupt Data
First ensure that the device communicating with the DSP is operating correctly. If the DSP is receiving corrupt
data, it may be because the device it is communicating with is transmitting corrupt data. If it is, make sure that
the signals that it is generating are clean, meet required timing specs and have good levels.
Below is an example of communications system where data is being corrupted:
DSP 1DSP 2
Shifted Data:
When serial data received by DSP 2 is a shifted version of the data transmitted by DSP 1, this usually means
there is a data synchronization problem. This is often common when transmitting unframed data and can be
caused by a noisy serial clock or system noise. Below are a few examples of 8-bit data words which have been
shifted during the transmission from DSP 1 to DSP 2.
When serial data received by DSP 2 contains corrupted bits, there is usually a system noise problem. Below
are a few examples where 8-bit data words transmitted from DSP 1 to DSP 2 have become corrupted.
When the serials ports are not enabled, the serial port signals are tristated.
Invalid line levels on serial port lines
Invalid line levels will occur when two devices are trying to drive the serial port. If one part is driving a serial
port line high and another is driving it low at the same time the resulting voltage on that line while be somewhere
between Vcc and Gnd. This can also damage one of the
Noise on serial port lines
Solutions Table
Proper termination of long SPORT traces
SPORT_Tech_Note.pd
f
The serial port on the DSP is very sensitive to any external noise in the system. This includes noise due to
reflections on the lines, signal degradation due to long trace lengths, and signal interference. Any trace that is
equal to or longer than 3--4 inches has to be treated as a transmission line at the high frequencies that the
SPORT generally operates at, and must be properly terminated to reduce noise and glitches on the lines. Failure
to do so may result in the SPORT locking up, or the SPORT transmitting or receiving incorrect data. In addition
EN-74Page 4
Technical Notes on using Analog Devices’ DSP components and development tools
to good board layout and design considerations (refer High Speed Digital design book), a popular method to
reduce noise is to provide series termination resistors on the SPORT control lines, as close to the DSP
generating the signals as possible(preferably right next to the DSP).The value of the resistor typically ranges
between 20-100 ohms, but an exact value depends on the trace lengths and the characteristic impedance of the
line. Values can be determined by using an equation described in the book “High-Speed Digital Design-AHandbook of Black Magic” by Howard W. Johnson and Martin Graham, and published by Prentice-Hall.
If the total electrical delay of the signal net in questions is greater than six times the rise or fall time of the source,
you should terminate the signal. Rough calculations of the total line length delay of the net should be calculated
with 0.180ns per inch and 2 pF per inch.
Example 1:
A driver is connected to 6 loads, each load is 8pf, the connection is a star connection, where the longest path
from the driver is 15 inches, the output impedance of the driver is 10 ohms, and the rise / fall time of the driving
signal is 2.0 ns max.
The max. rise and fall times of the Driving Signal is 2 ns.
The Total Signal trace delay is (15 * .180 ns) this is 2.7 ns.
The Total RC load delay is ((8 pF * 6) + (15 * 2 pF) * 10 ohms = 0.780 ns
Then the ratio of signal delay to rise time is signal delay / rise time equals 3.48 ns / 2.0 ns = 3.48 The ratio is
less than 6, so this signal should be OK, and Terminations would not be required.
Example 2:
A driver is connected to 6 loads, each load is 8pf, the connection is a star connection, where the longest path
from the driver is 30 inches, the output impedance of the driver is 15 ohms, and the rise / fall time of the driving
signal is 1.0 ns max.
The max. rise and fall times of the Driving Signal is 1 ns.
The Total Signal trace delay is (24 * .180 ns) this is 5.4 ns.
The Total RC load delay is ((8 pF * 6) + (30 * 2 pF) * 10 ohms = 1.00 ns
Then the ratio of signal delay to rise time is signal delay / rise time equals 6.4 ns / 1.0 ns = 6.4 The ratio is
greater than 6, this signal would cause reflection problems, and terminations should be used.
For a series termination: The termination value should be the PWB characteristic impedance minus the driver
output impedance. Example: Assuming a PWB Z of 50 ohms, and Driver Z of 10 ohms, then the series
termination located as close to the driver as possible would be 40 ohms.
EN-74Page 5
Technical Notes on using Analog Devices’ DSP components and development tools
For a end termination (parallel split termination): The parallel equivalent termination value should be the PWB
characteristic impedance. Example: Assuming a PWB Z of 50 ohms, then the parallel equivalent split termination
values located as close to the end of the line as possible would be 50 ohms. You should not exceed IOH Max
and I
Max of the Driver. After establishing the 2 resistor values for the termination (for most CMOS logic the
OL
ratio should be the ratio of IOH and IOL), calculate the current through the two resistors based on the VOH
and VOL, if the current in either case exceeds I
Max or IOL Max, you should not use a end termination
OH
arrangement.
Processor Specific Issues
21xx
The questions and answers provided in this Tech-note are based on commonly asked questions from
customers, or information that is not documented extensively in the ADSP-2100 Family User’s manual, and is
intended to supplement the information provided therein.
The serial ports have the capability of transmitting and receiving serial data in the form of bits, with the MSB
first. Bits are clocked in at the rate of the serial port clock (which can either be internally generated by the DSP
as a fraction of the processor clock (CLKOUT), or externally generated by another device, and supplied to the
DSP). Bits are transmitted on the rising edge of an SCLK pulse, and received on the falling edge of an SCLK
pulse. The frame sync signal is used to signify the start of a serial data word or stream of serial words.
Continuous mode of operation of Serial Port
The ADSP-2100 Family User’s manual (third edition) describes the operation of the SPORTs in continuous
mode (for example, refer section 5.9 on timing examples on page 5-16). The serial port is said to operate in
the continuous mode while either transmitting or receiving, if a bit is shifted out or in with every SCLK pulse,
without a pause. This is not a special mode of operating the serial port, and hence there is no register or bit
associated with it. The value in the RFSDIV register determines the operation. For example, to set the serial
port up in this mode, with an internal RFS and alternate framing, set RFSDIV to be equal to the SLEN-1.
Internal generation of transmit and receive frame syncs with frame syncs NOT required
If a serial port is set for internal frame sync(transmit or receive) and the SPORT x Control register is configured
for “frame-sync-not-required”, (in other words, bits 11 and/or 13--the RFSR and the TFSR set to 0), the
serial port continues to generate a frame sync for every transmitted or received word. In other words,
operation of the SPORT is identical for either mode. The main difference is seen at the receiving end where if
the SPORT is set up for external frame sync, the DSP ignores the frame sync after the initial pulse.
EN-74Page 6
Technical Notes on using Analog Devices’ DSP components and development tools
At any time after a serial port is disabled, if it is necessary to re-enable it, it is recommended that the control
registers corresponding to the serial port be set up again before the SPORT is re-enabled.
If a serial port is set for internal frame sync and is then enabled, the first frame sync appears after RFSDIV serial
clock cycles.
When a serial port is set for internal frame sync and alternate mode, the smallest number that be written into the
RFSDIV register is the number of bits in each word. This is because the frame sync is active throughout the
length of the word.
Enabling SPORTS
It is critical that the RFSDIV register is set before enabling the sports. When the sports are enabled the register
will count to zero and you will get the receive frame sync 1-2 cycles later.
The total is n + (1 or 2)
1 cycle if in alternate frame mode
2 cycle if in normal frame mode
where n is the value of the receive count register
Use of gated serial clocks with the serial port
We strongly recommend the use of a continuous serial clock(internally generated by the DSP), or external for
the serial port. The reason for this is because of the latency involved, in that the DSP requires a few cycles to
synchronize the serial port after it receives the first serial clock pulse. However, if it is imperative for the specific
application to use a gated serial clock, it is important to ensure that the clock is not discontinued in the middle of
receiving or transmitting a word.
Disabling SPORT autobuffering temporarily
If a certain application requires the SPORT to be set up to receive a known number of words while using
autobuffering, and the user wishes to stop receiving words for some period of time before re-enabling it, two
options are available. The first is to disable autobuffering in the SPORTx receive interrupt service routine and
disable the SPORT. The SPORT continues to receive/transmit words until and unless autobuffering is disabled.
One must be aware of the latencies involved while re-enabling the SPORT at a future time.
The second option is to disable autobuffering and to simply mask off the SPORTx interrupt. This will cause the
SPORT to shift in words into the RXx register, but not interrupt the DSP. The following simple example
illustrates how this is done for the SPORT0 receiving data, on the ADSP-218x. A similar procedure can be
followed for SPORTx transmit interrupt.
It is necessary to manually pop and push the status register because the original IMASK was pushed onto the
stack before the interrupt is serviced.
To re-enable the SPORT at some future time, (it is possible to use an interrupt or a flag from the transmitter to
let the receiving DSP know it is ready to transmit again) it is only necessary to set the corresponding bit in the
IMASK register, in other words to H#xxxx1xxxxx, and re-enable the autobuffering. Once the receiving DSP
has done this, it can indicate to the transmitter that it is ready to receive the next set of words.
Startup Time
“When a serial port is enabled by a write to the System Control Register, it takes two SCLK cycles before it is
actually enabled. On the next (third) SCLK cycle, the serial port becomes active, looking for a frame sync.”
The SPORT was designed this way to synchronize the enable signal to the asynchronous serial clock. To the
clocked serial port, it appears that any cycle could be the start of a frameless data stream; there is a valid frame
signal every cycle. This causes the SPORT to skip the data on the first two or three cycles of SCLK if you are
not giving any cycles without the frame signal, since it ignores the frame signal until the SPORT becomes active.
This situation can happen to anyone using frameless modes with the clock only operating when data is being
sent.
The solution of sending a couple dummy bits will work fine if the SPORT is enabled long before the SCLK
starts, but could cause trouble if the enable bit is written at about the same time as the first SCLK cycle. An
alternate solution would be to have the frame signal de-asserted for 2 or more SCLK cycles, and than asserted
when the data starts. Some other processors have a special asynchronous start mode to better support the
"toggle the clock only when there is data" type of operation.
SHARC
Changing Multichannel TX and RX Channel Selects:
The MTCSx bits can be changed while the serial port is active as long as the current channel, STCTLx(CHNL),
does not correspond to timeslot of the changed bits. It is possible that the current channel can change to the next
channel after STCTLx(CHNL) is read. So writing to MTCSx must be avoided when the value of
STCTLx(CHNL) is equal to or one less than that of the timeslot for the changed bits in MTCSx. Changing
MRCSx can occur at any time, there is no problem even if the current channel corresponds to changed bit of
MRCSx.
Changing Multichannel TX and RX Companding Selects:
EN-74Page 8
Technical Notes on using Analog Devices’ DSP components and development tools
The MTCCS and MRCCS bits are read during the transmission/reception of the last bit of the current channel
to about the time when the 2ndbit of next channel is transmitted. So these bits should not change in this window
of about 2 serial clock cycles. Since this window overlaps the current channel and the next channel, we can
follow the same rule which we do for MTCS bits. This means that we should avoid changing the MTCCS and
MRCCS bits when the changed bits corresponds to channel number. STCTL(CHAN) and STCTL(CHAN) +
1.
He was very concerned about a possible contention on the DTx pin of SPORT0 for multiple 218x dsp's in
multi-channel mode transmitting in adjacent channels with the frame delay = 0. He felt that there was a potential
15ns of overlap in transmitting for the last bit of one channel to the first bit in the next channel.
The particular specs of interest are Tscde and Tscdd.
In the schematics for the circuitry of the SPORT he found that there is a single signal that controls the
enable/disable of data transmission. The min for Tscde comes from the case where SPORT DTx was enabled
in the previous SCLK cycle and therefore no transition takes place. The max. spec for Tscdd comes from the
case where SPORT DTX was enabled in the previous SCLK cycle and therefore a transition to disable is
necessary.
From this it is apparent that since both 218x's will be transitioning at the overlap (one from enable to disable and
the other from enable to disable), each will experience very close to the same delay and therefore the overlap
will be very small and the contention will be negligible.
1. Does the SPORT need an input on TCLK, or does the transmitter use RCLK for transmitting in multichannel
mode? If it does use RCLK, what should we do with TCLK input? ANS: On same SPORT, the DT & DR
lines are connected together.
The TCLK input can be left floating.
2. What does the transmitter send after it completes sending all the data in its transmit data buffer and no other
data is written to it? ANS: It tristates the DT line.
3. Does bit CKRE of STCTL do anything in multichannel mode since the transmit side is using RFS? ANS:
No
Example Code
Part 1: 21xx Serial Port Initialization Code
This example code configures an ADSP21xx DSP for multichannel serial communications using
autobuffering. Clock and RFS are generated externally.
EN-74Page 9
Technical Notes on using Analog Devices’ DSP components and development tools