• Aucun résultat trouvé

Embedded Hardware

N/A
N/A
Protected

Academic year: 2022

Partager "Embedded Hardware"

Copied!
537
0
0

Texte intégral

(1)
(2)

Embedded Hardware

(3)

PIC Microcontrollers: Know It All

Lucio Di Jasio, Tim Wilmshurst, Dogan Ibrahim, John Morton, Martin Bates, Jack Smith, D.W. Smith, and Chuck Hellebuyck ISBN: 978-0-7506-8615-0

Embedded Software: Know It All

Jean Labrosse, Jack Ganssle, Tammy Noergaard, Robert Oshana, Colin Walls, Keith Curtis, Jason Andrews, David J. Katz, Rick Gentile, Kamal Hyder, and Bob Perrin

ISBN: 978-0-7506-8583-2

Embedded Hardware: Know It All

Jack Ganssle, Tammy Noergaard, Fred Eady, Creed Huddleston, Lewin Edwards, David J. Katz, Rick Gentile, Ken Arnold, Kamal Hyder, and Bob Perrin

ISBN: 978-0-7506-8584-9 Wireless Networking: Know It All

Praphul Chandra, Daniel M. Dobkin, Alan Bensky, Ron Olexa, David A. Lide, and Farid Dowla

ISBN: 978-0-7506-8582-5

RF & Wireless Technologies: Know It All

Bruce Fette, Roberto Aiello, Praphul Chandra, Daniel Dobkin,

Alan Bensky, Douglas Miron, David A. Lide, Farid Dowla, and Ron Olexa ISBN: 978-0-7506-8581-8

For more information on these and other Newnes titles visit: www.newnespress.com

(4)

Embedded Hardware

Jack Ganssle

Tammy Noergaard

Fred Eady

Lewin Edwards David J. Katz

Rick Gentile Ken Arnold Kamal Hyder Bob Perrin

Creed Huddleston

AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO

Newnes is an imprint of Elsevier

(5)

30 Corporate Drive, Suite 400, Burlington, MA 01803, USA Linacre House, Jordan Hill, Oxford OX2 8DP, UK

Copyright © 2008 by Elsevier Inc. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher.

Permissions may be sought directly from Elsevier’s Science & Technology Rights Department in Oxford, UK: phone: (44) 1865 843830, fax: (44) 1865 853333, E-mail: permissions@elsevier.com. You may also complete your request online via the Elsevier homepage (http://elsevier.com), by selecting “Support & Contact”

then “Copyright and Permission” and then “Obtaining Permissions.”

Recognizing the importance of preserving what has been written, Elsevier prints its books on acid-free paper whenever possible.

Library of Congress Cataloging-in-Publication Data Ganssle, Jack G.

Embedded hardware / Jack Ganssle ... [et al.].

p. cm.

Includes index.

ISBN 978-0-7506-8584-9 (alk. paper) 1. Embedded computer systems. I. Title.

TK7895.E42G37 2007 004.16—dc22

2007027559 British Library Cataloguing-in-Publication Data

A catalogue record for this book is available from the British Library.

07 08 09 10 10 9 8 7 6 5 4 3 2 1

Typeset by Charon Tec Ltd (A Macmillan Company), Chennai, India www.charontec.com

Printed in the United States of America For information on all Newnes publications visit our Web site at www.books.elsevier.com

(6)

Contents

About the Authors ...xiii

Chapter 1: Embedded Hardware Basics ... 1

1.1 Lesson One on Hardware: Reading Schematics ... 1

1.2 The Embedded Board and the von Neumann Model ... 5

1.3 Powering the Hardware ... 9

1.3.1 A Quick Comment on Analog Vs. Digital Signals ... 10

1.4 Basic Electronics ... 12

1.4.1 DC Circuits ... 12

1.4.2 AC Circuits ... 21

1.4.3 Active Devices ... 28

1.5 Putting It Together: A Power Supply ... 32

1.5.1 The Scope ... 35

1.5.2 Controls ... 35

1.5.3 Probes ... 38

Endnotes ... 41

Chapter 2: Logic Circuits ... 43

2.1 Coding ... 43

2.1.1 BCD ... 46

2.2 Combinatorial Logic ... 47

2.2.1 NOT Gate ... 47

2.2.2 AND and NAND Gates ... 48

2.2.3 OR and NOR Gates ... 49

2.2.4 XOR ... 50

2.2.5 Circuits ... 50

2.2.6 Tristate Devices ... 53

2.3 Sequential Logic ... 53

2.3.1 Logic Wrap-Up ... 57

2.4 Putting It All Together: The Integrated Circuit ... 58

Endnotes ... 61

w w w. n e w n e s p r e s s . c o m

Prelims-H8584.indd v

Prelims-H8584.indd v 8/17/07 7:21:07 PM8/17/07 7:21:07 PM

(7)

Chapter 3: Embedded Processors ... 63

3.1 Introduction ... 63

3.2 ISA Architecture Models ... 65

3.2.1 Operations ... 65

3.2.2 Operands ... 68

3.2.3 Storage ... 69

3.2.4 Addressing Modes ... 71

3.2.5 Interrupts and Exception Handling ... 72

3.2.6 Application-Specifi c ISA Models ... 72

3.2.7 General-Purpose ISA Models ... 74

3.2.8 Instruction-Level Parallelism ISA Models ... 76

3.3 Internal Processor Design ... 78

3.3.1 Central Processing Unit (CPU) ... 82

3.3.2 On-Chip Memory ... 99

3.3.3 Processor Input/Output (I/O)... 113

3.3.4 Processor Buses ... 130

3.4 Processor Performance ... 131

3.4.1 Benchmarks ... 133

Endnotes ... 133

Chapter 4: Embedded Board Buses and I/O ... 137

4.1 Board I/O ... 137

4.2 Managing Data: Serial vs. Parallel I/O ... 140

4.2.1 Serial I/O Example 1: Networking and Communications: RS-232 ... 144

4.2.2 Example: Motorola/Freescale MPC823 FADS Board RS-232 System Model ... 146

4.2.3 Serial I/O Example 2: Networking and Communications: IEEE 802.11 Wireless LAN ... 148

4.2.4 Parallel I/O ... 153

4.2.5 Parallel I/O Example 3: “Parallel” Output and Graphics I/O ... 153

4.2.6 Parallel and Serial I/O Example 4: Networking and Communications—Ethernet ... 156

4.2.7 Example 1: Motorola/Freescale MPC823 FADS Board Ethernet System Model ... 158

4.2.8 Example 2: Net Silicon ARM7 (6127001) Development Board Ethernet System Model ... 160

4.2.9 Example 3: Adastra Neptune x86 Board Ethernet System Model ... 161

4.3 Interfacing the I/O Components ... 161

4.3.1 Interfacing the I/O Device with the Embedded Board ... 162

4.3.2 Interfacing an I/O Controller and the Master CPU ... 164

w w w. n e w n e s p r e s s . c o m

Prelims-H8584.indd vi

Prelims-H8584.indd vi 8/17/07 7:21:08 PM8/17/07 7:21:08 PM

(8)

4.4 I/O and Performance ... 165

4.5 Board Buses ... 166

4.6 Bus Arbitration and Timing ... 168

4.6.1 Nonexpandable Bus: I2C Bus Example ... 174

4.6.2 PCI (Peripheral Component Interconnect) Bus Example: Expandable ...175

4.7 Integrating the Bus with Other Board Components ... 179

4.8 Bus Performance ... 180

Chapter 5: Memory Systems ... 183

5.1 Introduction ... 183

5.2 Memory Spaces ... 183

5.2.1 L1 Instruction Memory ... 186

5.2.2 Using L1 Instruction Memory for Data Placement ... 186

5.2.3 L1 Data Memory ... 187

5.3 Cache Overview ... 187

5.3.1 What Is Cache? ... 188

5.3.2 Direct-Mapped Cache ... 190

5.3.3 Fully Associative Cache ... 190

5.3.4 N-Way Set-Associative Cache ... 191

5.3.5 More Cache Details ... 191

5.3.6 Write-Through and Write-Back Data Cache... 193

5.4 External Memory ... 195

5.4.1 Synchronous Memory ... 195

5.4.2 Asynchronous Memory ... 203

5.4.3 Nonvolatile Memories ... 206

5.5 Direct Memory Access ... 214

5.5.1 DMA Controller Overview ... 215

5.5.2 More on the DMA Controller ... 216

5.5.3 Programming the DMA Controller ... 218

5.5.4 DMA Classifi cations ... 228

5.5.5 Register-Based DMA ... 228

5.5.6 Descriptor-Based DMA ... 231

5.5.7 Advanced DMA Features ... 234

Endnotes ... 236

Chapter 6: Timing Analysis in Embedded Systems ... 239

6.1 Introduction ... 239

6.2 Timing Diagram Notation Conventions ... 239

6.2.1 Rise and Fall Times ... 241

Contents vii

w w w. n e w n e s p r e s s . c o m

Prelims-H8584.indd vii

Prelims-H8584.indd vii 8/17/07 7:21:08 PM8/17/07 7:21:08 PM

(9)

6.2.2 Propagation Delays ... 241

6.2.3 Setup and Hold Time... 241

6.2.4 Tri-State Bus Interfacing ... 243

6.2.5 Pulse Width and Clock Frequency ... 244

6.3 Fan-Out and Loading Analysis: DC and AC ... 244

6.3.1 Calculating Wiring Capacitance ... 247

6.3.2 Fan-Out When CMOS Drives LSTTL ... 249

6.3.3 Transmission-Line Effects ... 251

6.3.4 Ground Bounce ... 253

6.4 Logic Family IC Characteristics and Interfacing ... 255

6.4.1 Interfacing TTL Compatible Signals to 5 V CMOS ... 258

6.5 Design Example: Noise Margin Analysis Spreadsheet ... 261

6.6 Worst-Case Timing Analysis Example ... 270

Endnotes ... 272

Chapter 7: Choosing a Microcontroller and Other Design Decisions ... 273

7.1 Introduction ... 273

7.2 Choosing the Right Core ... 276

7.3 Building Custom Peripherals with FPGAs ... 281

7.4 Whose Development Hardware to Use—Chicken or Egg? ... 282

7.5 Recommended Laboratory Equipment ... 285

7.6 Development Toolchains ... 286

7.7 Free Embedded Operating Systems ... 289

7.8 GNU and You: How Using “Free” Software Affects Your Product ... 295

Chapter 8: The Essence of Microcontroller Networking: RS-232 ... 301

8.1 Introduction ... 301

8.2 Some History ... 303

8.3 RS-232 Standard Operating Procedure ... 305

8.4 RS-232 Voltage Conversion Considerations ... 308

8.5 Implementing RS-232 with a Microcontroller ... 310

8.5.1 Basic RS-232 Hardware ... 310

8.5.2 Building a Simple Microcontroller RS-232 Transceiver ... 313

8.6 Writing RS-232 Microcontroller Routines in BASIC ... 333

8.7 Building Some RS-232 Communications Hardware ... 339

8.7.1 A Few More BASIC RS-232 Instructions ... 339

8.8 I2C: The Other Serial Protocol ... 342

8.8.1 Why Use I2C? ... 343

8.8.2 The I2C Bus ... 344

8.8.3 I2C ACKS and NAKS ... 347

w w w. n e w n e s p r e s s . c o m

Prelims-H8584.indd viii

Prelims-H8584.indd viii 8/17/07 7:21:09 PM8/17/07 7:21:09 PM

(10)

8.8.4 More on Arbitration and Clock Synchronization ... 347

8.8.5 I2C Addressing ... 351

8.8.6 Some I2C Firmware ... 352

8.8.7 The AVR Master I2C Code ... 352

8.8.8 The AVR I2C Master-Receiver Mode Code ... 358

8.8.9 The PIC I2C Slave-Transmitter Mode Code ... 359

8.8.10 The AVR-to-PIC I2C Communications Ball ... 365

8.9 Communication Options ... 378

8.9.1 The Serial Peripheral Interface Port ... 378

8.9.2 The Controller Area Network ... 380

8.9.3 Acceptance Filters ... 386

Endnote ... 387

Chapter 9: Interfacing to Sensors and Actuators ... 389

9.1 Introduction ... 389

9.2 Digital Interfacing ... 389

9.2.1 Mixing 3.3 and 5 V Devices ... 389

9.2.2 Protecting Digital Inputs ... 392

9.2.3 Expanding Digital Inputs ... 398

9.2.4 Expanding Digital Outputs ... 402

9.3 High-Current Outputs ... 404

9.3.1 BJT-Based Drivers ... 405

9.3.2 MOSFETs ... 409

9.3.3 Electromechanical Relays ... 411

9.3.4 Solid-State Relays ... 417

9.4 CPLDs and FPGAs ... 418

9.5 Analog Interfacing: An Overview ... 420

9.5.1 ADCs ... 420

9.5.2 Project 1: Characterizing an Analog Channel ... 421

9.6 Conclusion ... 434

Endnote ... 435

Chapter 10: Other Useful Hardware Design Tips and Techniques ... 437

10.1 Introduction ... 437

10.2 Diagnostics ... 437

10.3 Connecting Tools ... 438

10.4 Other Thoughts ... 439

10.5 Construction Methods ... 440

10.5.1 Power and Ground Planes ... 441

10.5.2 Ground Problems ... 441

Contents ix

w w w. n e w n e s p r e s s . c o m

Prelims-H8584.indd ix

Prelims-H8584.indd ix 8/17/07 7:21:09 PM8/17/07 7:21:09 PM

(11)

10.6 Electromagnetic Compatibility ... 442

10.7 Electrostatic Discharge Effects ... 442

10.7.1 Fault Tolerance ... 443

10.8 Hardware Development Tools ... 444

10.8.1 Instrumentation Issues ... 445

10.9 Software Development Tools ... 445

10.10 Other Specialized Design Considerations ... 446

10.10.1 Thermal Analysis and Design ... 446

10.10.2 Battery-Powered System Design Considerations ... 447

10.11 Processor Performance Metrics ... 448

10.11.1 IPS ... 448

10.11.2 OPS ... 448

10.11.3 Benchmarks ... 449

Appendix A: Schematic Symbols ... 451

Appendix B: Acronyms and Abbreviations ... 459

Appendix C: PC Board Design Issues ... 469

C.1 Introduction ... 469

C.2 Resistance of Conductors ... 470

C.3 Voltage Drop in Signal Leads—“Kelvin” Feedback ... 471

C.4 Signal Return Currents ... 472

C.5 Grounding in Mixed Analog/Digital Systems ... 474

C.6 Ground and Power Planes ... 475

C.7 Double-Sided versus Multilayer Printed Circuit Boards ... 477

C.8 Multicard Mixed-Signal Systems ... 478

C.9 Separating Analog and Digital Grounds ... 479

C.10 Grounding and Decoupling Mixed-Signal ICs with Low Digital Currents ... 480

C.11 Treat the ADC Digital Outputs with Care ... 481

C.12 Sampling Clock Considerations ... 483

C.13 The Origins of the Confusion About Mixed-Signal Grounding: Applying Single-Card Grounding Concepts to Multicard Systems ...485

C.14 Summary: Grounding Mixed-Signal Devices with Low Digital Currents in a Multicard System ...486

C.15 Summary: Grounding Mixed-Signal Devices with High Digital Currents in a Multicard System ...487

C.16 Grounding DSPs with Internal Phase-Locked Loops ... 487

C.17 Grounding Summary ... 488

C.18 Some General PC Board Layout Guidelines for Mixed-Signal Systems ... 489

w w w. n e w n e s p r e s s . c o m

Prelims-H8584.indd x

Prelims-H8584.indd x 8/17/07 7:21:10 PM8/17/07 7:21:10 PM

(12)

w w w. n e w n e s p r e s s . c o m

C.19 Skin Effect ... 491

C.20 Transmission Lines ... 493

C.21 Be Careful with Ground Plane Breaks ... 494

C.22 Ground Isolation Techniques ... 495

C.23 Static PCB Effects ... 497

C.24 Sample MINIDIP and SOIC Op Amp PCB Guard Layouts ... 500

C.25 Dynamic PCB Effects ... 502

C.26 Stray Capacitance ... 503

C.27 Capacitive Noise and Faraday Shields ... 504

C.28 The Floating Shield Problem ... 506

C.29 Buffering ADCs Against Logic Noise ... 506

Endnotes ... 509

Acknowledgments ... 509

Index ... 511

Contents xi

Prelims-H8584.indd xi

Prelims-H8584.indd xi 8/17/07 7:21:10 PM8/17/07 7:21:10 PM

(13)
(14)

w w w. n e w n e s p r e s s . c o m

About the Authors

Ken Arnold (Chapters 6 and 10) is the author of Embedded Controller Hardware Design.

He is the Embedded Computer Engineering Program Coordinator and an instructor at UCSD Extension, as well as founding director of the On-Line University of California, where he manages, develops and teaches courses in engineering and embedded systems design. Ken has been developing commercial embedded systems and teaching others how for more than two decades. As the champion of the embedded program at UCSD, he lead the inception and growth of the program as well as introducing the world’s fi rst on-line embedded course well over a decade ago. Ken was also the founder and CEO of HiTech Equipment Corp., CTO of Wireless Innovation, and engineering chief at General Dynamics.

Fred Eady (Chapter 8) is the author of Networking and Internetworking with

Microcontrollers. As an engineering consultant, he has implemented communications networks for the space program and designed hardware and fi rmware for the medical, retail and public utility industries. He currently writes a monthly embedded design column for a popular electronics enthusiast magazine. Fred also composes monthly articles for a popular robotics magazine. Fred has been dabbling in electronics for over 30 years. His embedded design expertise spans the spectrum and includes Intel’s 8748 and 8051 microcontrollers, the entire Microchip PIC microcontroller family and the Atmel AVR microcontrollers. Fred recently retired from his consulting work and is focused on writing magazine columns and embedded design books.

Lewin Edwards (Chapter 7) is the author of Embedded System Design on a Shoestring. He hails from Adelaide, Australia. His career began with fi ve years of security and encryption software at PC-Plus Systems. The next fi ve years were spent developing networkable multimedia appliances at Digi-Frame in Port Chester, NY. Since 2004 he has been developing security and fi re safety devices at a Fortune 100 company in New York. He has written numerous technical articles and three embedded systems books, with a fourth due in early 2008.

Jack Ganssle (Chapters 1, 2, and 10) is the author of The Firmware Handbook. He has written over 500 articles and six books about embedded systems, as well as a book about his sailing fi ascos. He started developing embedded systems in the early 70s using the 8008. He’s started and sold three electronics companies, including one of the bigger embedded tool businesses.

He’s developed or managed over 100 embedded products, from deep-sea navigation gear to

Prelims-H8584.indd xiii

Prelims-H8584.indd xiii 8/17/07 7:21:11 PM8/17/07 7:21:11 PM

(15)

w w w. n e w n e s p r e s s . c o m

the White House security system... and one instrument that analyzed cow poop! He’s currently a member of NASA’s Super Problem Resolution Team, a group of outside experts formed to advise NASA in the wake of Columbia’s demise, and serves on the boards of several high-tech companies. Jack now gives seminars to companies world-wide about better ways to develop embedded systems.

Rick Gentile (Chapter 5) is the author of Embedded Media Processing. Rick joined ADI in 2000 as a Senior DSP Applications Engineer, and he currently leads the Processor

Applications Group, which is responsible for Blackfi n, SHARC and TigerSHARC processors.

Prior to joining ADI, Rick was a Member of the Technical Staff at MIT Lincoln Laboratory, where he designed several signal processors used in a wide range of radar sensors. He has authored dozens of articles and presented at multiple technical conferences. He received a B.S. in 1987 from the University of Massachusetts at Amherst and an M.S. in 1994 from Northeastern University, both in Electrical and Computer Engineering.

Creed Huddleston (Chapter 8) is the author of Intelligent Sensor Design Using the Microchip dsPIC. With over twenty years of experience designing real-time embedded systems, he is President and founder of Real-Time by Design, LLC, a certifi ed Microchip Design Partner based in Raleigh, NC that specializes in the creation of hard real-time intelligent sensing systems. In addition to his duties with Real-Time by Design, Creed also serves on the Advisory Board of Quickfi lter Technologies Inc., a Texas-based company producing mixed- signal integrated circuits that provide high-speed analog signal conditioning and digital signal processing in a single package. A graduate of Rice University in Houston, TX with a BSEE degree, Creed performed extensive graduate work in digital signal processing at the University of Texas at Arlington before heading east to start Omnisys. To her great credit and his great fortune, Creed and his wife Lisa have been married for 23 years and have three wonderful children: Kate, Beth, and Dan.

Kamal Hyder (Chapter 9) is the author of Embedded Systems Design Using the Rabbit 3000 Microprocessor. He started his career with an embedded microcontroller manufacturer. He then wrote CPU microcode for Tandem Computers for a number of years, and was a Product Manager at Cisco Systems, working on next-generation switching platforms. He is currently with Brocade Communications as Senior Group Product Manager. Kamal’s BS is in EE/CS from the University of Massachusetts, Amherst, and he has an MBA in fi nance/marketing from Santa Clara University.

David Katz (Chapter 5) is the author of Embedded Media Processing. He has over 15 years of experience in circuit and system design. Currently, he is the Blackfi n Applications Manager at Analog Devices, Inc., where he focuses on specifying new convergent processors. He has published over 100 embedded processing articles domestically and internationally, and he has presented several conference papers in the fi eld. Previously, he worked at Motorola, Inc., as a

Prelims-H8584.indd xiv

Prelims-H8584.indd xiv 8/17/07 7:21:11 PM8/17/07 7:21:11 PM

(16)

w w w. n e w n e s p r e s s . c o m

senior design engineer in cable modem and automation groups. David holds both a B.S. and M. Eng. in Electrical Engineering from Cornell University.

Walt Kester (Appendix C) is the editor of Data Conversion Handbook. He is a corporate staff applications engineer at Analog Devices. For more than 35 years at Analog Devices, he has designed, developed, and given applications support for high-speed ADCs, DACs, SHAs, op amps, and analog multiplexers. Besides writing many papers and articles, he prepared and edited eleven major applications books which form the basis for the Analog Devices world-wide technical seminar series including the topics of op amps, data conversion, power management, sensor signal conditioning, mixed-signal, and practical analog design techniques. Walt has a BSEE from NC State University and MSEE from Duke University.

Tammy Noergaard (Chapters 1, 2, 3, 4, Appendices B and C) is the author of Embedded Systems Architecture. Since beginning her embedded systems career in 1995, she has had wide experience in product development, system design and integration, operations, sales, marketing, and training. Noergaard worked for Sony as a lead software engineer developing and testing embedded software for analog TVs. At Wind River she was the liaison engineer between developmental engineers and customers to provide design expertise, systems confi guration, systems integration, and training for Wind River embedded software (OS, Java, device drivers, etc.) and all associated hardware for a variety of embedded systems in the Consumer Electronic market. Most recently she was a Field Engineering Specialist and Consultant with Esmertec North America, providing project management, system design, system integration, system confi guration, support and expertise for various embedded Java systems using Jbed in everything from control systems to medical devices to digital TVs.

Noergaard has lectured to engineering classes at the University of California at Berkeley and Stanford, the Embedded Internet Conference, and the Java User’s Group in San Jose, among others.

Bob Perrin (Chapter 9) is the author of Embedded Systems Design Using the Rabbit 3000 Microprocessor. He got his start in electronics at the age of nine when his mother gave him a “150-in-one Projects” kit from Radio Shack for Christmas. He grew up programming a Commodore PET. In 1990, Bob graduated with a BSEE from Washington State University.

Since then Bob has been working as an engineer designing digital and analog electronics.

He has published about twenty technical articles, most with Circuit Cellar.

About the Authors xv

Prelims-H8584.indd xv

Prelims-H8584.indd xv 8/17/07 7:21:11 PM8/17/07 7:21:11 PM

(17)
(18)

w w w. n e w n e s p r e s s . c o m

C H A P T R Embedded Hardware Basics

Jack Ganssle Tammy Noergaard

C H A P T E R 1

1.1 Lesson One on Hardware: Reading Schematics

This section is equally important for embedded hardware and software engineers. Before diving into the details, note that it is important for all embedded designers to be able to under- stand the diagrams and symbols that hardware engineers create and use to describe their hard- ware designs to the outside world. These diagrams and symbols are the keys to quickly and effi ciently understanding even the most complex hardware design, regardless of how much or little practical experience one has in designing hardware. They also contain the information an embedded programmer needs to design any software that requires compatibility with the hard- ware, and they provide insight to a programmer as to how to successfully communicate the hardware requirements of the software to a hardware engineer.

There are several different types of engineering hardware drawings, including:

Block diagrams, which typically depict the major components of a board (processors, buses, I/O, memory) or a single component (a processor, for example) at a systems architecture or higher level. In short, a block diagram is a basic overview of the hard- ware, with implementation details abstracted out. While a block diagram can refl ect the actual physical layout of a board containing these major components, it mainly depicts how different components or units within a component function together at a systems architecture level. Block diagrams are used extensively throughout this book (in fact, Figures 1.5a–e later in this chapter are examples of block diagrams) because they are the simplest method by which to depict and describe the components within a system. The symbols used within a block diagram are simple, such as squares or rec- tangles for chips and straight lines for buses. Block diagrams are typically not detailed enough for a software designer to be able to write all the low-level software accurately enough to control the hardware (without a lot of headaches, trial and error, and even some burned-out hardware!). However, they are very useful in communicating a basic overview of the hardware, as well as providing a basis for creating more detailed hardware diagrams.

Schematics. Schematics are electronic circuit diagrams that provide a more detailed view of all the devices within a circuit or within a single component—everything from

Ch01-H8584.indd 1

Ch01-H8584.indd 1 8/17/07 12:08:48 PM8/17/07 12:08:48 PM

(19)

w w w. n e w n e s p r e s s . c o m

processors down to resistors. A schematic diagram is not meant to depict the physical layout of the board or component, but provides information on the fl ow of data in the system, defi ning what signals are assigned where—which signals travel on the various lines of a bus, appear on the pins of a processor, and so on. In schematic diagrams, schematic symbols are used to depict all the components within the system. They typically do not look anything like the physical components they represent but are a type of “shorthand” representation based on some type of schematic symbol standard.

A schematic diagram is the most useful diagram to both hardware and software designers trying to determine how a system actually operates, to debug hardware, or to write and debug the software managing the hardware. See Appendix A for a list of commonly used schematic symbols.

Wiring diagrams. These diagrams represent the bus connections between the major and minor components on a board or within a chip. In wiring diagrams, vertical and horizontal lines are used to represent the lines of a bus, and either schematic symbols or more simplifi ed symbols (that physically resemble the other components on the board or elements within a component) are used. These diagrams may represent an approximate depiction of the physical layout of a component or board.

Logic diagrams/prints. Logic diagrams/prints are used to show a wide variety of circuit information using logical symbols (AND, OR, NOT, XOR, and so on) and logical inputs and outputs (the 1’s and 0’s). These diagrams do not replace schematics, but they can be useful in simplifying certain types of circuits in order to understand how they function.

Timing diagrams. Timing diagrams display timing graphs of various input and output signals of a circuit, as well as the relationships between the various signals. They are the most common diagrams (after block diagrams) in hardware user manuals and data sheets.

Regardless of the type, to understand how to read and interpret these diagrams, it is important to fi rst learn the standard symbols, conventions, and rules used. Examples of the symbols used in timing diagrams are shown in Table 1.1, along with the conventions for input/output signals associated with each of the symbols.

An example of a timing diagram is shown in Figure 1.1. In this fi gure, each row represents a different signal. In the case of the signal rising and falling symbols within the diagram, the rise time or fall time is indicated by the time it takes for the signal to move from LOW to HIGH or vice versa (the entire length of the diagonal line of the symbol). In comparing two signals, a delay is measured at the center of the rising or falling symbols of each signal being compared. In Figure 1.1, there is a fall time delay between signals B and C and signals A and C in the fi rst falling symbol. In comparing the fi rst falling symbol of signals A and B in the fi gure, no delay is indicated by the timing diagram.

Ch01-H8584.indd 2

Ch01-H8584.indd 2 8/17/07 12:08:49 PM8/17/07 12:08:49 PM

(20)

Embedded Hardware Basics 3

w w w. n e w n e s p r e s s . c o m

Schematic diagrams are much more complex than their timing diagram counterparts. As intro- duced earlier this chapter, schematics provide a more detailed view of all the devices within a circuit or within a single component. Figure 1.2 shows an example of a schematic diagram.

In the case of schematic diagrams, some of the conventions and rules include:

A title section is located at the bottom of each schematic page, listing information that includes, but is not limited to, the name of the circuit, the name of the hardware engineer responsible for the design, the date, and a list of revisions made to the design since its conception.

The use of schematic symbols indicating the various components of a circuit (see Appendix A).

Table 1.1: Timing diagrams symbol table.[1.1]

Symbol Input Signals Output Signals

Input signal must be valid Output signal will be valid Input signal doesn’t affect Indeterminate output signal system, will work regardless

Garbage signal (nonsense) Output signal not driven (fl oating), tristate, HiZ, high impedance

If the input signal rises: Output signal will rise

If the input signal falls: Output signal will fall

Signal A Signal B

Signal C

…….

Rise Time Fall Time

Delay

Figure 1.1: Timing diagram example.

Ch01-H8584.indd 3

Ch01-H8584.indd 3 8/17/07 12:08:49 PM8/17/07 12:08:49 PM

(21)

w w w. n e w n e s p r e s s . c o m

Along with the assigned symbol comes a label that details information about the component (i.e., size, type, power ratings, etc.). Labels for components of a symbol, such as the pin numbers of an IC, signal names associated with wires, and so forth are usually located outside of the schematic symbol.

Abbreviations and prefi xes are used for common units of measurement (i.e., k for kilo or 103, M for mega or 106) and these prefi xes replace writing out the units and larger numbers.

Functional groups and subgroups of components are typically separated onto different pages.

I/O and voltage source/ground terminals. In general, positive voltage supply terminals are located at the top of the page, and negative supply/ground at the bottom. Input components are usually on the left, and output components are on the right.

At the very least, the block and schematic diagrams should contain nothing unfamiliar to any- one working on the embedded project, whether they are coding software or prototyping the

Figure 1.2: Schematic diagram example.[1.2]

POWER IN—5 V@1.5 A J2 DIN

LDO R1 FB5

5 V

P12 60 PINS D15:0

GPIO(A4) P10 50 PINS

3.3 V

40 8

PORT B PORT A

ENI/IEEEI 284

*MIC PORT

RESET*

RIA*

*MIC = Multi Interface Controller GPIO D

GPIO F GPI G GPI H DSI:0 A27:0 CONTL LINES

BGA/PQFP DEBUG

SIGNALS

XTAL2

XTAL1 1.0 3.3 V

Title Size Document Date

3.3 V

RESET P.B.

P10(MIC) P11(EXP) 5

OSCILLATOR 44.2368 MHz 18.432 MHz

25 MHz BGA 10/100 BTX LXT971 PHY

P3 14 PIN JTAG

CORE, PLL

PROTOTYPING AREA— (2)SIOC16, (4)SOT23-6, (8)1206, (1)MINIDIP-8,

GND & POWER POINTS.

2.5 V

PORT C

10100 MAC

MII 18

8 8

OR GPIO RESET PHY (B4)

PHY INT. (C0) MIC PORT:

ENI/GPIO.

IEEE1284 5 V 3.3 V 5 V 3.3 V

RST-

2 2 RST-

31 ADDR/CONTL WE-,C8- CASI-,CSI- BURST TERM.

7 GATES CS2, CS3 & CS4

D31:16...

PORT A PORT B PORT C

P1 DB9-M RS232

P2 DB9-M CUST. LEDS CPU LEDS 3.3 V

3.3 V 4

REC LED J3 RS232 RS485

(B2) (B0) (C2) (C1)

60 PINS P11 3.3 V

2.5 V

SW3, SW4, SW5, SW6

SW4-5 SW4-6

FLASH WRITE ENABLE

(5) MICTOR EMILA TOR HEADERS–38 PIN CSO FLASH MEMORY, 16(1-8 MB) or 32(2-16 MB) STANDARD = 16(1 MB) or 32(2 MB)

CS3 PARALLEL EE, 8(2-32 KB) STANDARD = 8 K 8 STANDARD = SAME

CSI SDRAM MEMORY, 16(8 MB) or 32(16 MB) FLASH

READ ENABLE

32 DATA LINES 3.3V ON

ON

SD CLK BUF

AND

BCLK ADDR, LINE BOOTSTRAP

DIP SWITCHES

RJ45 LNK LED MAG- JACK LDO

SB9 SB8 SB7 SB6

SW2, JP1, JP2 SER. EE

64 K, 81928

SB5

BUFFERS

R167 MAX811

R160

September 09, 2002 Sheet 1 of 1

Ch01-H8584.indd 4

Ch01-H8584.indd 4 8/17/07 12:08:50 PM8/17/07 12:08:50 PM

(22)

Embedded Hardware Basics 5

w w w. n e w n e s p r e s s . c o m

hardware. This means becoming familiar with everything from where the name of the diagram is located to how the states of the components shown within the diagrams are represented.

One of the most effi cient ways of learning how to learn to read and/or create a hardware dia- gram is via the Traister and Lisk method[1.3], which involves:

Step 1. Learning the basic symbols that can make up the type of diagram, such as timing or schematic symbols. To aid in the learning of these symbols, rotate between this step and steps 2 and/or 3.

Step 2. Reading as many diagrams as possible until reading them becomes boring (in that case, rotate between this step and steps 1 and/or 3) or comfortable (so there is no longer the need to look up every other symbol while reading).

Step 3. Writing a diagram to practice simulating what has been read, again until it becomes either boring (which means rotating back through steps 1 and/or 2) or comfortable.

1.2 The Embedded Board and the von Neumann Model

In embedded devices, all the electronics hardware resides on a board, also referred to as a printed wiring board (PW) or printed circuit board (PCB). PCBs are often made of thin sheets of fi berglass. The electrical path of the circuit is printed in copper, which carries the electri- cal signals between the various components connected on the board. All electronic compo- nents that make up the circuit are connected to this board, either by soldering, plugging into a socket, or some other connection mechanism. All the hardware on an embedded board is located in the hardware layer of the Embedded Systems Model (see Figure 1.3).

Hardware Layer

System Software Layer Application Software Layer

Embedded Board Hardware

Layer

System Software Layer Application Software Layer

Embedded Board

Figure 1.3: Embedded board and the Embedded Systems Model.

At the highest level, the major hardware components of most boards can be classifi ed into fi ve major categories:

Central processing unit (CPU). The master processor.

Memory. Where the system’s software is stored.

Input device(s). Input slave processors and relative electrical components.

Ch01-H8584.indd 5

Ch01-H8584.indd 5 8/17/07 12:08:51 PM8/17/07 12:08:51 PM

(23)

w w w. n e w n e s p r e s s . c o m

Output device(s). Output slave processors and relative electrical components.

Data pathway(s)/bus(es). Interconnects the other components, providing a “highway”

for data to travel on from one component to another, including any wires, bus bridges, and/or bus controllers.

These fi ve categories are based on the major elements defi ned by the von Neumann model (see Figure 1.4), a tool that can be used to understand any electronic device’s hardware archi- tecture. The von Neumann model is a result of the published work of John von Neumann in 1945, which defi ned the requirements of a general-purpose electronic computer. Because embedded systems are a type of computer system, this model can be applied as a means of understanding embedded systems hardware.

While board designs can vary widely, as demonstrated in the examples of Figures 1.5a–d, all the major elements on these embedded boards—and on just about any embedded board—can be classifi ed as either the master CPU(s), memory, input/output, or bus components.

To understand how the major components on an embedded board function, it is useful to fi rst understand what these components consist of and why. All the components on an embedded board, including the major components introduced in the von Neumann model, are made up of one or some combination of interconnected basic electronic devices, such as wires, resistors,

Figure 1.4: Embedded system board organization.[1.4]

Based on the von Neumann architecture model (also referred to as the Princeton architecture).

Master Processor

Memory

Output Input

BRINGS DATA INTO THE EMBEDDED SYSTEM

TAKES DATA OUT OF THE EMBEDDED SYSTEM DATA FROM CPU OR INPUT DEVICES

STORED IN MEMORY UNTIL A CPU OR OUTPUT DEVICE REQUEST

5 SYSTEM COMPONENTS COMMONLY CONNECTED VIA BUSES

EMBEDDED SYSTEM BOARD

CONTROLS USAGE AND MANIPULATION OF DATA

Ch01-H8584.indd 6

Ch01-H8584.indd 6 8/17/07 12:08:51 PM8/17/07 12:08:51 PM

(24)

Embedded Hardware Basics 7

w w w. n e w n e s p r e s s . c o m

Figure 1.5b: Net Silicon ARM7 reference board.[1.6]

Flash Memory RAM Memory 256K×32

Application Specific Hardware

System Bus 8/16/32

10Base-T Thinnet 10/100Base-T Serial

IEEE 1284, Shared RAM,

Register- Mode

10Base-T Xcvr

Thinnet Xcvr

100Base-T Xcvr

RS232 Xcvr

16646 Xcvr

Ethernet MII NET+ARM Chip

• Master Processor: Net+ARM ARM7

• Memory: Flash, RAM

• Input/Output Devices: 10Base-T trans- ceiver, Thinnet transceiver, 100Base-T transceiver, RS-232 transceiver, 16646 transceiver, …

• Buses: System Bus, MII, …

Figure 1.5a: AMD/National Semiconductor x86 reference board.[1.5]

© 2004 Advanced Micro Devices, Inc. Reprinted with permission.

DDR Data SDRAM

(32Mx16 Address/Control SDCLKs

CRT Analog RGB

AMD Geode™

CS5535 Companion

Device System Control

FS2 JTAG Header

PCI 3.3 V

Ethernet Controller Clock

Generator 33 MHz

14 MHz

USB Ports (2x2)

Audio Codec Line Out

Headphone Out Microphone In

IDE Header (44-pin, 2 mm) IDE/Flash Port

Power Button GPIOs LPC Header

LPC BIOS LPC Bus Serial Data 128Mx16)or

AMD Geode™

GX 533@1.1W Processor

Digital RGB TFT

• Master Processor: Geode GX533@1.1w (x86)

• Memory: ROM (BIOS is located in), SDRAM

• Input/Output Devices:

CS5535, Audio Codec...

• Buses: LPC,PCI

Ch01-H8584.indd 7

Ch01-H8584.indd 7 8/17/07 12:08:52 PM8/17/07 12:08:52 PM

(25)

w w w. n e w n e s p r e s s . c o m

Figure 1.5c: Ampro MIPS reference board.[1.7]

Peripheral Interface Memory Interface

PC1 Host Controller Au 1500 CPU core SOD IMM

Flash Memory

Ethernet Ports (2) Serial Port (1)

USB Ports (2)

EJTAG Port (1)

SouthBridge (Super I/O)

PCI Interface

IDE Interface Floppy/

Parallel Port Keyboard &

Mouse Ports IrDA Port

Serial Ports (2)

• Master Processor: Encore M3 (Au-1500-based) processor

• Memory: Flash, SODIMM

• Input/Output Devices: Super I/O,…

• Buses: PCI, …

Figure 1.5d: Ampro PowerPC reference board.[1.8]

Copyright Freescale Semiconductor, Inc., 2004. Used by permission.

Memory Controller Flash

Memory

USB Ports (4) IDE Interface Floppy/

Parallel Port Keyboard &

Mouse Ports IrDA Port

Serial Ports (2) SODIMM

PCI Bridge

Motorola MPC8245 VIA VT82C686B

PCI

Bus Super I/O

& Controller (Southbridge)

Serial Debug Port

JTAG

Power Supply

Miscellaneous

Ethernet Port Intel 82559ER PCI Interface Clock

33 MHz CPU PowerPC™

603e core

• Master Processor: MPC8245

• Memory: Flash, SODIMM

• Input/Output Devices: Super I/O, 82559 Transceiver, …

• Buses: PCI, …

capacitors, inductors, and diodes. These devices also can act to connect the major components of a board together. At the highest level, these devices are typically classifi ed as either passive or active components. In short, passive components include devices such as wires, resistors, capacitors and inductors that can only receive or store power. Active components, on the other hand, include devices such as transistors, diodes, and integrated circuits (ICs) that are capable

Ch01-H8584.indd 8

Ch01-H8584.indd 8 8/17/07 12:08:52 PM8/17/07 12:08:52 PM

(26)

Embedded Hardware Basics 9

w w w. n e w n e s p r e s s . c o m

of delivering as well as receiving and storing power. In some cases, active components them- selves can be made up of passive components. Within the passive and active families of components, these circuit devices essentially differ according to how they respond to voltage and current.

1.3 Powering the Hardware

Power is the rate that energy is expended or work is performed. This means that in alternating current (AC) and direct current (DC) circuits, the power associated with each element on the board equals the current through the element multiplied by the voltage across the element (P VI). Accurate power and energy calculations must be done for all elements on an embed- ded board to determine the power consumption requirements of that particular board. This is because each element can only handle a certain type of power, so AC-DC converters, DC-AC converters, direct AC-AC converters, and so on may be required. Also, each element has a limited amount of power that it requires to function, that it can handle, or that it dissipates.

These calculations determine the type of voltage source that can be used on a board and how powerful the voltage source needs to be.

In embedded systems, both AC and DC voltage sources are used because each current genera- tion technique has its pros and cons. AC is easier to generate in large amounts using genera- tors driven by turbines turned by everything from wind to water. Producing large amounts of DC from electrochemical cells (batteries) is not as practical. Also, because transmitting cur- rent over long transmission lines results in a signifi cant loss of energy due to the resistance of the wire, most modern electric company facilities transmit electricity to outlets in AC current, since AC can be transformed to lower or higher voltages much more easily than DC. With AC, a device called a transformer, located at the service provider, is used to effi ciently transmit

Figure 1.5e: Mitsubishi analog TV reference board.

I2C Bus Video Processor

Audio Processor

NVM

Tuner

M37273

• Master Processor: M37273 (8-bit) TV Microcontroller

• Memory: NVM

• Input/Output Devices: Video processor, Audio Processor, Tuner, …

• Buses: I2C, …

Ch01-H8584.indd 9

Ch01-H8584.indd 9 8/17/07 12:08:53 PM8/17/07 12:08:53 PM

(27)

w w w. n e w n e s p r e s s . c o m

current over long distances with lower losses. The transformer is a device that transfers electri- cal energy from one circuit to another and can make changes to the current and voltage dur- ing the transfer. The service provider transmits lower levels of current at a higher voltage rate from the power plant, and then a transformer at the customer site decreases the voltage to the value required. On the fl ip side, at very high voltages, wires offer less resistance to DC than AC, thus making DC more effi cient to transmit than AC over very long distances.

Some embedded boards integrate or plug into power supplies. Power supplies can be either AC or DC. To use an AC power supply to supply power to components using only DC, an AC-to-DC converter can be used to convert AC to the lower DC voltages required by the various components on an embedded board, which typically require 3.3, 5, or 12 volts.

Note: Other types of converters, such as DC-to-DC, DC-to-AC, or direct AC-to-AC can be used to handle the required power conversions for devices that have other requirements.

Other embedded boards or components on a board (such as nonvolatile memory, discussed in more detail in Chapter 5) rely on batteries as voltage sources, which can be more practical for providing power because of their size. Battery-powered boards don’t rely on a power plant for energy, and they allow portability of embedded devices that don’t need to be plugged into an outlet. Also, because batteries supply DC current, no mechanism is needed to convert AC to DC for components that require DC, as is needed with boards that rely on a power supply and outlet supplying AC. Batteries, however, have a limited life and must be either recharged or replaced.

1.3.1 A Quick Comment on Analog vs. Digital Signals

A digital system processes only digital data, which is data represented by only 0’s and 1’s.

On most boards, two voltages represent “0” and “1,” since all data is represented as some combination of 1’s and 0’s. No voltage (0 volts) is referred to as ground, VSS, or low, and 3, 5, or 12 volts are commonly referred to as VCC, VDD, or high. All signals within the sys- tem are one of the two voltages or are transitioning to one of the two voltages. Systems can defi ne “0” as low and “1” as high, or some range of 0–1 volts as LOW and 4–5 volts as HIGH, for instance. Other signals can base the defi nition of a “1” or “0” on edges (low to high) or (high to low).

Because most major components on an embedded board, such as processors, inherently proc- ess the 1’s and 0’s of digital signals, a lot of embedded hardware is digital by nature. However, an embedded system can still process analog signals, which are continuous—that is, not only

Ch01-H8584.indd 10

Ch01-H8584.indd 10 8/17/07 12:08:53 PM8/17/07 12:08:53 PM

(28)

Embedded Hardware Basics 11

w w w. n e w n e s p r e s s . c o m

1’s and 0’s but values in between as well. Obviously, a mechanism is needed on the board to convert analog signals to digital signals. An analog signal is digitized by a sampling process, and the resulting digital data can be translated back into a voltage “wave” that mirrors the original analog waveform.

Inaccurate Signals: Problems with Noise in Analog and Digital Signals

One of the most serious problems in both the analog and digital signal realm involves noise distorting incoming signals, thus corrupting and affecting the accuracy of data.

Noise is generally any unwanted signal alteration from an input source, any part of the input signal generated from something other than a sensor, or even noise generated from the sensor itself. Noise is a common problem with analog signals. Digital signals, on the other hand, are at greater risk if the signals are not generated locally to the embedded processor, so any digital signals coming across a longer transmission medium are the most susceptible to noise problems.

Analog noise can come from a wide variety of sources—radio signals, lightning, power lines, the microprocessor, or the analog sensing electronics themselves. The same is true for digital noise, which can come from mechanical contacts used as computer inputs, dirty slip rings that transmit power/data, limits in accuracy/dependability of input source, and so forth.

The key to reducing either analog or digital noise is: (1) to follow basic design guide- lines to avoid problems with noise. In the case of analog noise, this includes not mixing analog and digital grounds, keeping sensitive electronic elements on the board a suf- fi cient distance from elements switching current, limiting length of wires with low signal levels/high impedance, etc. With digital signals, this means routing signal wires away from noise-inducing high current cables, shielding wires, transmitting signals using cor- rect techniques, etc. (2) to clearly identify the root cause of the problem, which means exactly what is causing the noise. With point (2), once the root cause of the noise has been identifi ed, a hardware or software fi x can be implemented. Techniques for reducing analog noise include fi ltering out frequencies not needed and averaging the signal inputs, whereas digital noise is commonly addressed via transmitting correction codes/par- ity bits and/or adding additional hardware to the board to correct any problems with received data.

—Based on the articles “Minimizing Analog Noise” (May 1997),“Taming Analog Noise”

(November 1992), and “Smoothing Digital Inputs” (October 1992), by Jack Ganssle, in Embedded Systems Programming Magazine.

Real-World Advice

Ch01-H8584.indd 11

Ch01-H8584.indd 11 8/17/07 12:08:53 PM8/17/07 12:08:53 PM

(29)

w w w. n e w n e s p r e s s . c o m

1.4 Basic Electronics

In this section, we will review some electronics fundamentals.

1.4.1 DC Circuits

DC means direct current, a fancy term for signals that don’t change. They’re fl atlined, like a corpse’s EEG or the output from a battery (Figure 1.6). Your PC’s power supply makes DC out of the building’s AC (alternating current) mains. All digital circuits require DC power supplies.

1.4.1.1 Voltage and Current

We measure the quantity of electricity using voltage and amperage, but both arise from more fundamental physics. Atoms that have a shortage or surplus of electrons are called ions. An ion has a positive or negative charge. Two ions of opposite polarity (one plus, meaning it’s missing electrons, and the other negative, with one or more extra electrons) attract each other. This attractive force is called the electromotive force, commonly known as EMF.

Charge is measured in coulombs, where one coulomb is 6.25 1018 electrons (for negative charges) or protons for positive ones.

An ampere is one coulomb fl owing past a point for one second. Voltage is the force between two points for which one ampere of current will do one joule of work, a joule per second being one watt.

Figure 1.6: A DC signal has a constant, unvarying amplitude.

0 DO A1

A1

1.00 V/ 0.00s 10.0ms/ Auto A2 RUN

Ch01-H8584.indd 12

Ch01-H8584.indd 12 8/17/07 12:08:54 PM8/17/07 12:08:54 PM

(30)

Embedded Hardware Basics 13

w w w. n e w n e s p r e s s . c o m

Figure 1.7: A VOM, even an old-fashioned analog model like this $10 Radio Shack model, measures DC voltage as well or better than a scope.

But few electrical engineers remember these defi nitions, and none actually use them.

An old but still apt analogy uses water fl ow through a pipe: Current would be the amount of water fl owing through a pipe per unit of time, whereas voltage is the pressure of the water.

The unit of current is the ampere (amp), though in computers an amp is an awful lot of cur- rent. Most digital and analog circuits require much less. Table 1.2 shows the most common nomenclatures.

Table 1.2: Common nomenclatures.

Name Abbreviation Number of Amps Where Likely Found

amp A 1 Power supplies; very high-performance

processors may draw many tens of amps milliamp mA .001 amp Logic circuits, processors (tens or hundreds of

mA), generic analog circuits

microamp µA 10–6 amp Low-power logic, low-power analog, battery-

backed RAM

picoamp pA 10–12 amp Very sensitive analog inputs

femtoamp fA 10–15 amp The cutting edge of low-power analog

measurements

Ch01-H8584.indd 13

Ch01-H8584.indd 13 8/17/07 12:08:54 PM8/17/07 12:08:54 PM

(31)

w w w. n e w n e s p r e s s . c o m

Most embedded systems have a far less extreme range of voltages. Typical logic and micro- processor power supplies range from a volt or 2–5 volts. Analog power supplies rarely exceed plus and minus 15 volts. Some analog signals from sensors might go down to the millivolt (.001 volt) range. Radio receivers can detect microvolt-level signals, but they do this using quite sophisticated noise-rejection techniques.

1.4.1.2 Resistors

As electrons travel through wires, components, or accidentally through a poor soul’s body, they encounter resistance, which is the tendency of the conductor to limit electron fl ow.

A vacuum is a perfect resistor: no current fl ows through it. Air’s pretty close, but since water is a decent conductor, humidity does allow some electricity to fl ow in air.

Superconductors are the only materials with zero resistance, a feat achieved through the magic of quantum mechanics at extremely low temperatures, on the order of that of liquid nitrogen and colder. Everything else exhibits some resistance, even the very best wires. Feel the power cord of your 1500 watt ceramic heater—it’s warm, indicating some power is lost in the cord due to the wire’s resistance.

We measure resistance in ohms; the more ohms, the poorer the conductor. The Greek capital omega (Ω) is the symbol denoting ohms.

Resistance, voltage, and amperage are all related by the most important of all formulas in elec- trical engineering. Ohm’s Law states:

E I R

where E is voltage in volts, I is current in amps, and R is resistance in ohms. (EEs like to use E for volts because it indicates electromotive force.)

What does this mean in practice? Feed one amp of current through a one-ohm load and there will be one volt developed across the load. Double the voltage and, if resistance stays the same, the current doubles.

Though all electronic components have resistance, a resistor is a device specifi cally made to reduce conductivity (Figure 1.8 and Table 1.3). We use them everywhere. The volume control on a stereo (at least, the nondigital ones) is a resistor whose value changes as you rotate the knob; more resistance reduces the signal and hence the speaker output.

What happens when you connect resistors together? For resistors in series, the total effective resistance is the sum of the values:

Reff R1 R2

Ch01-H8584.indd 14

Ch01-H8584.indd 14 8/17/07 12:08:55 PM8/17/07 12:08:55 PM

(32)

Embedded Hardware Basics 15

w w w. n e w n e s p r e s s . c o m

For two resistors in parallel, the effective resistance is:

R R R

R R

eff

1 2

1 2

(Thus, two identical resistors in parallel are effectively half the resistance of either of them:

two 1 ks is 500 ohms. Now add a third: that’s essentially a 500-ohm resistor in parallel with a 1k, for an effective total of 333 ohms.)

Figure 1.8: The squiggly thing on the left is the standard symbol used by engineers to denote a resistor on their schematics. On the right is the symbol used by engineers in the United

Kingdom. As Churchill said, we are two peoples divided by a common language.

Table 1.3: Range of values for real-world resistors.

Name Abbreviation Ohms Where Likely Found milliohm m Ω .001 ohm Resistance of wires and other good conductors ohm Ω 1 ohm Power supplies may have big dropping resistors in

the few to tens of ohms range

hundreds of ohms In embedded systems, it’s common to fi nd resis- tors in the few hundred ohm range used to termi- nate high-speed signals

kiloohm k Ω or just k 1000 ohms Resistors from a half-k to a hundred or more k are found all over every sort of electronic device;

“pullups” are typically a few k to tens of k megaohm M Ω 106 ohms Low signal-level analog circuits

hundreds of M Ω 108 ohms Geiger counters and other extremely sensitive apps; rarely seen since resistors of this size are close to the resistance of air

Ch01-H8584.indd 15

Ch01-H8584.indd 15 8/17/07 12:08:55 PM8/17/07 12:08:55 PM

(33)

w w w. n e w n e s p r e s s . c o m

The general formula for more than two resistors in parallel (Figure 1.9) is:

R

R R R R

eff

1

1 1 1 1

1 2 3 4

1 k

1 k

1 k

1 k 1 k 1 k

Figure 1.9: The three series resistors on the left are equivalent to a single 3000-ohm part.

The three paralleled on the right work out to one 333-ohm device.

Manufacturers use color codes to denote the value of a particular resistor. Although at fi rst this may seem unnecessarily arcane, in practice it makes quite a bit of sense. Regardless of orien- tation, no matter how it is installed on a circuit board, the part’s color bands are always visible (Figure 1.10 and Table 1.4).

1st Color Band

2nd Color Band

Multiplier Color Band

Tolerance Color Band

Figure 1.10: This black-and-white photo masks the resistor’s color bands. However, we read them from left to right, the fi rst two designating the integer part of the value, the third band giving the

multiplier. A fourth gold (5%) or silver (10%) band indicates the part’s tolerance.

Ch01-H8584.indd 16

Ch01-H8584.indd 16 8/17/07 12:08:56 PM8/17/07 12:08:56 PM

Références

Documents relatifs

One of the foundations of modern Teichm¨ uller theory is Wolpert’s [Wol87] theorem that the function on Teichm¨ uller space that records the geodesic length of a closed curve is

axiale Fiche d’exercices N°4 : Construire le symétrique d’une figure 1.. Construire le symétrique de la figure suivante par rapport à

Donner la mesure de l’angle marqué en justifiant

On calcule ensuite pour chacun des couples de pixels voisins, le carré de la différence des niveaux de gris.. L'image modifiée sera elle aussi enregistrée dans

To see that these give the same notion of motive, one uses the proper base change and local acyclicity of smooth morphisms to compare Q ` -adic cohomology on the generic and

Adapting the perspective of viewing information systems essentially as a language and meaning environment, the set of ideas offered by McLuhan offers a promising way to

in later literature; sometimes, as in Chester's Love's Martyr, in which Merlin's role is subsidiary, he must 4 bring Uter and Igerne together and provide for

Une origine (point d’application) Un point où l’on souhaite mesurer la vitesse Sa direction : La droite tangente à la trajectoire au point M. Son sens : Celui