Файл: Embedded Controller Hardware Design (Ken Arnold, 2001).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 2659

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

79CHAPTER THREE

Worst-Case Timing, Loading, Analysis, and Design

using 5 volt logic to drive CMOS circuits, is to use a higher voltage open collector or open drain output with a pull up resistor connected to the higher supply voltage. This level shifting technique can also be used for driving other high voltage circuits such as high voltage outputs. In either case, the objective is to guarantee there is sufficient noise margin to guarantee a valid logic one when the TTL compatible output drives a CMOS input.

It is important to note that when a TTL output is pulled above its normal output high voltage, it will not source any significant current. This is because the TTL output source is equivalent to a high resistance in series with a voltage source that is effectively limited to around 3 volts, due to internal design constraints. As the output voltage increases until it equals the internal voltage, the output can no longer source any current. When the voltage is increased beyond the internal circuitry (up to a limit of Vcc), the internal circuitry is equivalent to a reverse biased diode, so only leakage currents in the submicroampere range will flow into the output device. As a result, the effect of a TTL output on external circuits is negligible when the pin is pulled high by an external resistor.

Also, a 5 volt TTL compatible output is often compatible with a 3 volt CMOS device input, since the CMOS threshold (Vcc/2 = 1.5 volt) is the same as a 5 volt TTL gate (TTL Vt = 1.5 volt). Most of the 3 volt CMOS devices are designed to withstand a 5 volt input signal, so it is often possible to interface 5 volt TTL outputs directly to 3 volt CMOS inputs. However, if the 3 volt CMOS inputs are not designed to handle 5 volt inputs, the CMOS device could be destroyed with an input signal greater than 3 volt, so it is important to verify this. A 3 volt CMOS device output will be close to 3 volt, so it can drive a 5 volt TTL compatible input directly.

A 3 volt CMOS output would probably be marginal driving a 5 volt CMOS input (Vt = Vcc/2 = 2.5 volt), leaving less than 0.5 volts of noise margin. Since the 3 volt CMOS output generally cannot withstand a pull-up resistor to 5 volts, it is necessary to add a level shifting IC to convert 3 volt logic levels to 5 volt.

Level shifters are available for converting logic levels from one family to an­ other, including 3 volts to and from 5 volt, or 5 volt TTL to +/- V ECL (emit- ter-coupled logic), and 5 volt levels to +/-12 volt RS-232 signals. There are also special ICs for driving output loads requiring either a high voltage or high current output, such as a light, motor or relay. Most microcontrollers have

Light
Crosses
Boundary
Figure 3-13: Optical isolation allows connection to hazardous voltages.
Current Flows in LED, it Emits Light
Light from LED Turns on the Switch,
Allowing Current Flow
High Voltage
Isolation
Boundary

80EMBEDDED CONTROLLER

Hardware Design

very weak output drive capability, so external driver ICs may be necessary. These would typically be needed to drive LEDs, a vacuum fluorescent display, or a motor. Solid-state relays even allow large AC loads to be controlled by a micro. Likewise, there are other devices (i.e., optical isolators), allowing high voltages (like 110volt AC inputs) to be safely converted to logic levels for input to a microcontroller. Devices that use potentially hazardous high volt­ ages should be isolated from the rest of the circuitry for reasons of safety. While it may be possible to connect such devices directly to our circuits, they would allow us to come into contact with potentially fatal voltages. Unfortu­ nately, the standard 50 or 60 cycle AC power supply used almost everywhere has the unfortunate characteristic that it is very nearly the optimal voltage to guarantee that a human heart will stop functioning due to muscle fibrillation. Customer death by electrocution is sure to result in the next of kin hiring an attorney to relieve you of all your assets. . . . unless, of course, they’re your next of kin! There are many isolation devices available, most of which use the same basic approach.

The isolation can be accomplished using optical or magnetic means, which can provide a barrier to transient voltages that can be on the order of thousands of volts. The barrier is trans-

parent, and so allows light to pass, but is made

of a good insulator

to prevent electrical current from flowing across the boundary.

Figure 3-13 shows a simple optical isolation circuit.

This isolation approach can be used to input high voltages to a microcontroller safely by connecting the LED to a high voltage source in series with a resistor and protective diode to limit the LED’s current and prevent the LED from being exposed to the potentially destructive reverse voltage. The output tran­ sistor will then be turned on whenever the LED is turned on by one half of the AC power cycle. This is useful for time of day clock functions, since the AC power mains frequency is maintained very accurately by the power utilities over a period of time. The output switch can be connected to the processor counter or interrupt input, allowing the processor to keep track of time and synchronize its operation with the AC power cycle.


81CHAPTER THREE

Worst-Case Timing, Loading, Analysis, and Design

High voltage outputs can also be controlled safely by using the micro’s output to turn on the LED that turns the output switch on. In this case, another type of switch such as an SCR (silicon-controlled rectifier) or TRIAC (an AC version of the SCR) is used rather than a transistor. SCR and TRIAC switches can be obtained to handle relatively large AC loads, such as lamps, and motors. These devices are often referred to as solid-state relays (SSR), since they are equivalent to an electromechanical relay, except that they are implemented with solid-state semiconductor devices instead of using a coil to move a switch. Both isolated inputs and outputs are available in complete modules that have all the necessary circuits to monitor and control high voltage and power devices, using optical isolation for safety. They have microcontroller compatible I/O on one side that is optically isolated from the high power outputs on the other side.

Very often, even when safety is not an issue, microcontroller chips simply cannot handle the voltages or currents required to interface with other devices. In some cases it is required when connecting one logic family to another, incompatible family, such as emitter-coupled logic (ECL) levels or RS-232 interfaces utilizing negative voltages.

Sometimes, a plain, old-fashioned electromechanical relay is a better solution, since relays usually have contact resistances that are far lower than can be found in a semiconductor switch. In some cases, a simple transistor or MOSFET switch can be used to control a load operating at voltages which are greater than the logic supply, such as motors, solenoid actuators, and relays which may require 12 or more volts to operate.

The circuitry required to interface between logic levels and high-level circuits is described in detail elsewhere, including an excellent book titled The Art of Electronics, by Horowitz and Hill. If you don’t already have this book—and you have to do much electronic design or interfacing—you should definitely obtain a copy of this very handy book.

The real world is an analog place, and interfacing between the discrete, digital world of computers and the real world demands significant attention. The interface between low level analog signals and logic is handled in another chapter of this book.

At this point, it is time to look at some simple examples, so we can see exactly how a worst-case analysis should be performed. The next section illustrates


82EMBEDDED CONTROLLER

Hardware Design

part of the worst-case analysis for a real laboratory instrument that is still used in the healthcare industry. This product’s poor reliability was seriously incon­ venient for the medical staff and patients who depend upon it, and if it had lead to an incorrect diagnosis, a truly fatal error! It is in these types of applications that worst-case design is most important, and the cost of unreliable hardware in the field almost always greatly exceeds the cost of avoiding the problem by using proper design and analysis techniques. Now let’s turn our attention to the analysis of the worst-case noise margin for an 8051 based design example.

Design Example: Noise Margin Analysis Spreadsheet

The following spreadsheet shows the results of a noise margin on a design that was already in production at the time of the analysis. The product’s users had complained about intermittent glitches, and the author was consulted to determine the source of the problem. After a quick look at a few of the noise margin values, it became obvious that there were deficiencies in the design in that area. A portion of the spreadsheet used in that analysis is shown in Table 3-1, with problems shown in bold italic underline font.

The first column of Table 3-1 is the signal name, followed by the pin number and chip which is the source of the signal, followed by the source’s worst-case output voltages, Volmax and Vohmin. The next columns list the loads on the signals and their respective worst-case input voltages Vilmax and Vihmin. The noise margins are shown in the last two columns, Vil - Vol for the logic zero case, and Voh - Vih for the logic one case. As can be seen, the logic zero noise margins are all probably acceptable, as the lowest value is 0.3 volts. The logic one noise margin is zero or negative for most of the devices listed, which is completely unacceptable. Any noise on the power supply, ground or the sig­ nal lines themselves can easily cause a logic input to interpret the wrong logic state, causing an error. An interesting thing to observe is that none of them were very far out of spec, and the instrument worked perfectly most of the time. These problems can be virtually impossible to find in the field. Hooking up a test instrument like a scope or logic analyzer to the problem signals often makes the problem go away, due to changing the ground currents and imped­ ances of the circuit. The specs that cause the problem in this case are the high Vih specs of the loads, especially the SRAM chip. The example design in the sheet above represents a relatively common problem with devices that are advertised as “compatible” with other logic families. The solution to the prob­

83CHAPTER THREE

Worst-Case Timing, Loading, Analysis, and Design

8051 Noise Margin Analysis - Sample

OUTPUT

INPUT

Noise

Margin

Vol

Voh

Vil

Vih

logic

logic

Signal

Pin(s)

Source

max

min

Load(s)

Signal

max

min

zero

one

PSEN/

29

8051

0.40

2.00

EPROM

OE/

0.80

2.00

0.40

0.00

RD/

17

8051

0.40

2.00

SRAM

OE/

0.80

2.20

0.40

-0.20

(P3.7)

0.40

2.00

82C55

RD/

0.80

2.00

0.40

0.00

WR/

16

8051

0.40

2.00

SRAM

WR/

0.80

2.20

0.40

-0.20

(P3.6)

0.40

2.00

82C55

WR/

0.80

2.00

0.40

0.00

A15 (P2.7)

28

8051

0.40

2.00

74LS138 A

0.80

2.00

0.40

0.00

A8..14

21-27

8051

0.40

2.00

SRAM

A8..14

0.80

2.20

0.40

-0.20

(P2.0-P2.6)

0.40

2.00

EPROM

A8..14

0.80

2.00

0.40

0.00

0.40

2.00

GAL

A8..14

0.80

2.00

0.40

0.00

ALE

30

8051

0.40

2.00

74LS373 LE

0.80

2.00

0.40

0.00

AD0..7

39-32

8051

0.40

2.00

74LS373 A0..7

0.80

2.00

0.40

0.00

(P0.0-P0.7)

0.40

2.00

SRAM

D0..7

0.80

2.20

0.40

-0.20

0.40

2.00

82C55

D0..7

0.80

2.00

0.40

0.00

SRAM

0.40

2.20

8051

D0..7

0.80

2.40

0.40

-0.20

EPROM

0.45

2.40

8051

D0..7

0.80

2.40

0.35

0.00

82C55

0.40

3.50

8051

D0..7

0.80

2.40

0.40

1.10

RAM Enable

16V8

0.50

2.40

SRAM

/CE

0.80

2.20

0.30

0.20

EPROM En.

16V8

0.50

2.40

EPROM

/CE

0.80

2.00

0.30

0.40

Table 3-1

lem is very simple and inexpensive: the addition of pull-up resistors to the signals that have zero or negative noise margin in the logic one state. This also impacts the output low current that must be handled by the signal source chip outputs, so it must be taken into account in the load analysis and pull up resistors should be chosen accordingly.


84EMBEDDED CONTROLLER

Hardware Design

It is important to note that there are four sources listed for AD0..7, since there are four devices that drive the data bus. Only the data paths that are used need to be evaluated vs. loading analysis, where unused paths load the bus. The load analysis for another similar design is shown in Table 3-2, which tabulates the capabilities of the various driving devices, and the loads that are presented to them. The first three columns (signal, pin and source) identify the signal source, the next three (IOL, IOH and CL), list the corresponding source’s output drive current and capacitive load values. The next two columns (load, and signal) identify the load’s signal names. The Qty column is the number of loads in the case of multiple signals connected to the same output, or the number of inches of wire in the case of the wire capacitance. The next three columns (IIL, IIH, and Cin) define the load characteristic of a single input’s input current and input capacitance. For the interconnect wiring, Cin is the estimated stray wiring capacitance per inch of the printed circuit trace. The last three columns show the extended totals and grand totals for each signal, followed by the design margin, which should be a positive number. In this case there is only one problem, due to excessive capacitive loading of the SRAM when it drives the data bus, AD0..7.

The output capacitive load specs are usually found as notes within the AC section of the chip specification listing the various timing parameters. This is because the capacitive loading affects the rise and fall time of the signal, so the capacitance value is really used as a test condition for the timing measurements. Input capacitance may be difficult to find in the specification sheet, it may be in a different “family” specification sheet or handbook, or may not be specified at all. When it is not specified, a reasonable estimate can be made by substituting values for similar parts in the same type of package.

The SRAM output is specified with a Cload value of 50 pF, which is relatively low value. By using a very low load capacitance, the SRAM’s timing specs look good due to shorter than normal rise and fall times, since the chip is not driving a realistic load. This is a good example of a manufacturer’s “specsmanship.” They are intentionally playing games with the test conditions to make their device appear to be better than it is. That way when someone looks at their timing specs, the shorter rise and fall times make their chip appear to be faster than another equivalent chip that is specified with a larger capacitive load value, when the chips are actually identical. Unfortunately, this practice is all too common, so that the designer must view the claims on the cover of a data sheet very critically. If it looks to good to be true, then it probably is!

85CHAPTER THREE

Worst-Case Timing, Loading, Analysis, and Design

Table 3-2

Source

Load

Unit

Load

Total

uA

uA

pF

uA

uA

pF

uA

uA

pF

Signal

Pin#

Source

IOL

IOH

CL

Load

Signal

Qty

IIL

IIH

Cin

IIL

IIH

Cin

PSEN/

29

8051

3200

-60

100

EPROM

OE/

1

-1

1

12

-1

1

12

wire cap

2

2

4

Total

-1

1

16

Margin

3199

59

84

RD/

17

8051

1600

-60

80

SRAM

OE/

1

-1

1

7

-1

1

7

(P3.7)

82C55

RD/

1

-1

1

10

-1

1

10

wire cap

3

2

6

Total

-2

2

23

Margin

1598

58

57

WR/

16

8051

1600

-60

80

SRAM

WR/

1

-1

1

7

-1

1

7

(P3.6)

82C55

WR/

1

-1

1

10

-1

1

10

wire cap

3

2

6

Total

-2

2

23

Margin

1598

58

57

A15

28

8051

1600

-60

80

74LS138

A

1

-200

20

10

-200

20

10

(P2.7)

wire cap

2

2

4

Total

-200

20

14

Margin

1400

40

66

A8..14 21-7

8051

1600

-60

80

SRAM

A8..14

1

-1

1

7

-1

1

7

(P2.0-P2.6)

EPROM

A8..14

1

-1

1

12

-1

1

12

wire cap

3

2

6

Total

-2

2

25

Margin

1598

58

55

ALE

30

8051

3200

-60

100

74LS373

LE

1

-400

20

10

-400

20

10

wire cap

2

2

4

Total

-400

20

14

Margin

2800

40

86

AD0..7 39-2

8051

3200

-800

100

74LS373

A0..7

1

-400

20

10

-400

20

10

(P0.0-P0.7)

SRAM

D0..7

1

-1

1

7

-1

1

7

EPROM

D0..7

1

-1

1

12

-1

1

12

82C55

D0..7

1

-10

10

20

-10

10

20

wire cap

5

2

10

Total

-412

32

59

SRAM

Margin

2788

768

41

1600

-600

50

74LS373

A0..7

1

-400

20

10

-400

20

10

8051

D0..7

1

-1

1

20

-1

1

20

EPROM

D0..7

1

-1

1

12

-1

1

12

82C55

D0..7

1

-10

10

20

-10

10

20

wire cap

5

2

10

Total

-412

32

72

EPROM

Margin

1188

568

-22

1600

-600

100

74LS373

A0..7

1

-400

20

10

-400

20

10

SRAM

D0..7

1

-1

1

7

-1

1

7

8051

D0..7

1

-1

1

12

-1

1

12

82C55

D0..7

1

-10

10

20

-10

10

20

wire cap

5

2

10

Total

-412

32

59

82C55

Margin

1188

568

41

1600

-60

80

74LS373

A0..7

1

-400

20

10

-400

20

10

8051

D0..7

1

-1

1

20

-1

1

20

EPROM

D0..7

1

-1

1

12

-1

1

12

SRAM

D0..7

1

-1

1

7

-1

1

7

wire cap

5

2

10

Total

-403

23

59

Margin

1197

37

21


86EMBEDDED CONTROLLER

Hardware Design

When an output like this is operated with actual capacitive load greater than the test conditions, the related timing specs for the device must be de-rated, due to the degraded rise and fall times that will occur. As long as the load capacitance is no more than twice the spec value, this will be sufficient. The excess C load will increase the stress on the driver. If the overload is much greater than two times normal, the device can be overstressed due to the relatively large currents that will flow into the load capacitance on transitions when the C is charged and discharged through the driving output. As long as the output is not overloaded too much, the resulting increase in the rise/fall time can be estimated, resulting in a de-rated timing spec. All we have to do is calculate the additional rise time and add that to the timing values specified in the data sheet. In order to do that, we need to evaluate the output circuit’s performance. This can be accomplished by noting that the output current drives the load capacitance from a logic low to high or vice versa. For our purposes, we will assume that the interconnect does not behave like a transmission line, which is most often the case for garden variety microcontroller components. If the chips used have a fast rise time and trace length greater than about onesixth the edge length of the pulse, then it is necessary to analyze the circuit as a transmission line. In this case we will look at the simpler problem.

By assuming a constant current charging the capacitance, the voltage will ramp linearly from one logic level to the other. To make a rough estimate, we can use the source’s output

current and load capaci­

V

Rise Time with Spec’d C

tance to determine the

signal slew rate, and

the difference between

Vih min

the high and low logic

levels to determine

delta V

the delay. Figure 3-14

illustrates this.

Let’s next look at a

Vil max

Rise Time

simple example show­

with

Excess C

ing how to de-rate the

T

timing based on the

delta T

approximation tech­

nique just described.

Figure 3-14: Derating delay for excess CL.