ebook img

Embedded Systems Design using the Rabbit 3000 Microprocessor. Interfacing, Networking and Application Development PDF

460 Pages·2005·14.114 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Embedded Systems Design using the Rabbit 3000 Microprocessor. Interfacing, Networking and Application Development

Preface Welcome! Are you new to Rabbit Semiconductor's products? Are you new to networking? Are you new to embedded controller design? Then this book is for you. This book is written by embedded developers for their peers. The authors asked each other "if we were starting to design with a new microprocessor today, what would we want to know about it? How would a book help us achieve an efficient design quickly?" and developed the book accordingly. A number of concepts presented here are not just specific to the Rabbit 3000 microprocessor; they are equally applicable to any microprocessor. noitazinagrO The book starts simple and brings readers along quickly to a level where they can assemble hardware, wiggle bits, and blink lights. Then the real fun begins~web-enabling embedded controllers. The first two chapters introduce the key concepts needed for embedded system design. Next, the reader is given an architectural overview of the Rabbit 3000 microprocessor and introduced to an easy-to-use development environment~Dynamic C. Simple and advanced debugging techniques are covered with examples. Chapter 5 explains common hardware interfacing issues. Since we believe that hardware and software in embedded systems are inexorably woven together, we use a mix of freely available Linux-based tools to show how analog data can be recovered from an embedded controller and analyzed. Chapters 6, 7 and 8 take the reader on a succinct tour of Rabbit assembly language, interrupts and multitasking. This is where readers familiar with embedded system design but not with the Rabbit will probably want to start. Chapter 9 is a comprehensive treatment of how to bring the web to an embedded system. We have done projects ranging from simple UDP and TCP clients and servers on both PCs and Rabbit Core Modules to a data-acquisition system and an automated sprinkler controller with a web browser interface. This chapter also introduces RabbitWeb, a novel and powerful scripting language that makes it easy to create powerful web interfaces. Chapter 10 introduces a very powerful and professional development environment for Rabbit 3000 code~the Softools ANSI C compiler. Softools brought almost two decades of xi Preface experience with optimizing compilers, assemblers and very clever linkers together to create an easy-to-use development environment. We'll discuss it at length. The book closes with Appendix A which covers the enhancements made to the Rabbit 3000 with the release of the Rabbit 3000A. Both processors are fully compatible with all of the code and examples used throughout this book. elpmaxE stcejorP The authors firmly believe that people learn by example. This philosophy pervades the book. Each concept, once introduced and discussed, is used in a project. The projects range from simple assembly code that blinks an LED to a web-enabled sprinkler controller. Today, there are many software tools available to engineers. Recognizing that not all engi- neers are proficient with all tool sets, we have included examples in languages ranging from assembly language to Java, Perl, C/C++/C#, and Bash. Target environments include Windows and Linux and of course the Rabbit Semiconductor hardware. The idea is that every reader will likely take away tricks for tools that here-to-fore have not been in their toolbox. The authors have deliberately chosen simple examples, so that the reader would focus on the key concepts instead of getting bogged down with implementation details of complex projects. For example, the objective of a number of examples is just to flash an LED. While this may seem overly simple, flashing an LED requires the fight I/O ports to be set up and the right logic and timing to be in place. These are key elements in most embedded systems designs. Our intention in writing this book is to bring to the reader our sense of excitement for embed- ded systems design as well as embarking on an adventure with the Rabbit 3000 as our faithful companion. We hope our enjoyment and adventurism will rub off on you. May you enjoy reading this book as much as we have enjoyed writing it. Sincerely, Kamal Hyder and Bob Perrin September 2004 xii stnemgdelwonkcA This book has benefited from contributions great and small from a long list of professionals. Here we take a moment to recognize and thank the following individuals for their contributions. Norm Rogers and Carrie Maha (Rabbit Semiconductor) Thank you for supporting and encouraging the authors thoughout the development of this book and for arranging for quick and in-depth technical support when the authors had questions. Bill Auerbach (Softools Inc) Thank you for your time to review our work and offer suggestions on improving it. But most of all, thank you for writing the bulk of Chapter 10~Softools. When you want a job done fight, go to an expert. Kelly Hall (Saint Bernard Software) Thank you for contributing the Linux based data acquisition projects (code, data and prose) found in Chapter 5 and Chapter .8 Greg Young (Progressive Solutions) Thank you for helping the authors maintain a good perspective on this project. Pedram Abolghasem (Rabbit Semiconductor) Thank you for being unafraid to tackle any issue at Rabbit Semiconductor for us. You were man on point for us at Rabbit. Thank you. Brian Murtha (Rabbit Semiconductor) Thank you for contributing most of the technical information about debugging in Dynamic C found in Chapter 4. Especially, thank you for writing the FASTSERMACS.LIB for this book. Readers will be using these macros for years! Nice work, Brian. Larry Cicchinelli (Rabbit Semiconductor) Thank you for reviewing the first seven chapters of this book. Sometimes you turned your edits around in just a day or so. You answered a lot of questions for us, and this book would not be what it is without your input. Thank you. Eugene Fodor, Joel Baumert, Owen Magee and Steve Hardy (Rabbit Semiconductor) The Rabbit Semiconductor engineers really stepped up to the plate as reviewers for the last half of the book. But mostly, your advice, support, assistance and dedication helped us work though a difficult piece of work~Chapter 9. Thank you. xiii stnemgdelwonkcA Qingyi H. Perrin For photography in Chapters ,1 5 and .9 Raymond D. Payne (Ebara Technologies) For all the hours you have spent researching, understanding and teaching AC snubbing tech- niques. Chapter 5 and Chapter 9 have benefited from your experience and wisdom. Thank you for being generous with your time. Scott Henion (SH Designs) For helping the authors understand the Rabbit 3000 Timer B, and for graciously allowing us to include your ST-timerb.zip and timerb.ZIP in our CD. These libraries and examples will be useful to many readers. Carol Lewis and Tiffany Gasbarrini (Elsevier Science and Technology Books) For midwifing this book. Michael Caisse For his careful review of Chapter 9 and for moral support throughout the development of the book. Karan Bajaj For helping us verify the networking code. His background with Microsoft Corporation and .net development really helped. Prameela Mukkavilli For helping us verify the networking code. Her Java background was very helpful. Baktha Muralidharan (Cisco Systems) For reviewing Chapter .9 He is a software engineer with Cisco Systems and has contributed towards the popular Ethereal tool. Aamer Akhter (Cisco Systems) For reviewing Chapter 9. He is a technical leader with Cisco Systems and has contributed towards the popular Ethereal tool. Marco Molteni (Cisco Systems) For reviewing Chapter .9 He is a Software Engineer with Cisco Systems and works on future platforms and IPv6. He tries to contribute back to Open Source tools like Ethereal. Elias Kesh (Pioneer Electronics) For reviewing Chapter .8 He has designed and implemented a number of RTOSes and is active with embedded Linux development. xiv 1 CHAPTER Introduction This book focuses on methods and practices for embedded system design, and it takes a top- down approach in presenting the material. The discussion will progress from questions of what an embedded system is, to detailed examples of how to solve specific design problems with Rabbit Semiconductor's technology. This chapter examines broad issues surrounding embedded development and discusses com- mon solutions. Chapter 1 is not concerned with specific technology but rather over-arching issues of embedded system development. The chapter narrows the scope of embedded system problems to those with which the remainder of the book is concerned. 1.1 Embedded Systems and Embedded Controllers In the 1960s, mini-computers found their way into dedicated control applications. Someone coined the phrase "OEM computers" to differentiate these machines from "business comput- ers." As time passed and technology shrunk, the expression "dedicated controller" came into vogue and was promptly supplanted by "embedded controller." The phrase "embedded system" was coined to describe systems that contain an embedded controller. Nowadays, all but the simplest electronic devices have some sort of microprocessor in them. Hence today, the phrase "embedded system" describes almost any electronic product. The embedded community has adapted various industry "computer" standards for use in industrial control systems. For example, the PCI bus has four common form factors. The first is the "standard" PCI form factor found in desktop PCs. The second is the stackable PC 104+ form factor. The third is the rack mountable CPCI (Compact PCI). The fourth is the PCI Industrial Computer Manufacturers Group (PICMG) adaptation. PC 104+, CPCI and PICMG are all attempts to adapt a "computer" technology for industrial use. The electrical specifications are almost identical, but the form factors are significantly altered. Until recently, embedded PCs have been specialized PCs. For example, Ampro invented the PC104 form factor to allow PCs to be squeezed into a physical envelope more conducive to embedded applications than a full-sized desktop PC motherboard. These embedded PCs have been easily identified as "embedded controllers" and are quite distinct in form from desktop computers. In 2002, the Mini-ITX form-factor x86 motherboards hit shelves everywhere. Mini-ITX was developed ostensibly to provide a smaller footprint for desktop PCs. Embedded systems Chapter I designers seized on the low cost, high vol- ............ ume miniaturized full-up PC motherboards (cid:12)9 ! for control applications. Companies began packaging the Mini-ITX motherboards with ....... ~::! ~/~:~i.i ~:~ ~,.~. ~!!:~ ~<!'~%~t~:,;:i:::~ !it,: ~!i~::..::~ii!~i :~tt::~ ~::~::~ :"?~; ~*~ ':~ : :~::~ .:::: power supplies and I/O mixes suitable for embedded applications. What was initially designed as a "desktop computer" is now serving as an embedded controller. Let's take a closer look at the evolution from desktop to ~:~:~:~:~:~:~.~:~:~:~:~:~:~:~:~:~::-::: .:..:.....~::.:::.:. .: . . . . . . . . . ~;iii~iii;~i~ii::~i;;iiii~ii}iiii![iiii~i;!ii[iii~!.:i~}[i;~i~.:!];!i::i;~:~:ii:~!:: embedded PC. Figure 1.1 shows a PC motherboard. To make i!!! i i i =,,iiiiiii a complete system, several PCI or ISA cards .................. must be added to provide video and I/O. Of Figure 1.1: A desktop CP motherboard si big, course, a power supply is required. A hard and not very functional without additional drive is required to store an operating system ,sdrac power supply and hard .ksid and application software. Enclosures are available to rack-mount this type of system, but most cases are designed for consumer use. Figure 1.2 shows a PC104 stack. The system is shown with a power supply card, processor card and five expansion cards that provide video, storage, parallel I/O and numerous serial channels. The super-rugged enclosure is made of a thick aluminum extrusion and uses dense rubbery rails to isolate the electronics from vibration and p..~~ .,_ "-.J'- r..: .... . shock. The PC 104 stack is an example of Figure 1.2: A PC104 stack si more compact and how PC technology was adapted to an em- rugged than a desktop .CP bedded form factor. Figure 1.3 shows a JK Microsystems Mini-ITX based embedded PC. This system's footprint is little larger than a compact disc. The system has a power supply board that takes 7-30 volts DC as an input. Storage is provided by up to two Compact Flash cards. These rugged, solid-state devices are more consumer technology suitable for use in embedded systems. They are lightweight and rugged. If more storage is required, Type II Compact Flash mechani- cal hard drives can be used. Figure 1.3: ehT Mini-ITX was adopted A watchdog timer is also provided on the same PCB directly into the embedded smetsys that contains the power supply and Compact Flash market. Introduction connectors. The watchdog timer is a device that many embedded systems contain to improve reliability. In the event of a software crash, the watchdog timer will reset the system. A compact disc and hard drive can also be added. Figure 1.3 shows these devices installed. Both devices were designed for laptop computers. They are lightweight and tolerate en- vironmental stresses gracefully. The popularity of laptops has pushed the prices of these components almost as low as desktop PC components. The processor on the motherboard is a fanless low power device. This too is coincidentally well-suited to the embedded market. JK Microsystems sells the embedded PC shown in Figure 1.3 with an aluminum enclosure. I/O is limited to keyboard, mouse, video, Ethernet, USB, serial and parallel ports, but can be expanded using the PCI slot shown. The overall system is less expensive than a similar PC104 system shown in Figure 1.2. In just a few years, the embedded PC market has gone from having ill-suited desktop PC technology to having expensive but rugged PC104 technology and currently to having inex- pensive compact rugged PCs. With the pressures and economic realities of consumer markets, PC technologies can be expected to become less expensive, smaller and more rugged. The embedded systems sector will certainly adopt these technologies directly. Technology's perpetual march is oblivious to the delicacies of human semantics. Today, the distinction between embedded controller and computer is rapidly blurring. We can expect to see more and more "computer" technologies adopted directly into embedded control applications. An engineer faced with automating a process or building an instrument has access to a wide variety of products. There are embedded controllers available as printed circuit boards (PCBs), as packaged controllers, or as hundreds of flavors of embedded PCs. There are microprocessors and microcontrollers that range from 8-pin devices costing less than a dollar to many hundred-pin ball grid array (BGA) packaged devices costing hundreds of dollars. If none of these devices suit a particular application, perhaps the developer might fancy a half a million-gate field programmable gate array (FPGA). The term "embedded system" is applied to everything from coffee makers to communications satellites. All of these systems have some form of microprocessor lurking behind the scenes orchestrating behavior. This book focuses mainly on small- to medium-scale embedded systems and associated instrumentation. These type of systems share many common attributes. There are sensors. There are actuators. There are desired behaviors. There are human interfaces~Man Machine interfaces or MMIs. Above all, there is an embedded controller operating behind the scenes, tying everything together. 1.2 Embedded Systems--Case Studies To help the reader understand the scope of embedded applications with which this book is con- cerned, three systems are detailed here. The systems as presented here have been simplified from their actual implementations both to protect proprietary intellectual property and for brevity. Chapter I The applications range from an underwater torque tool to a 30 megawatt generator. Each application presented its designers with unique problems. The three projects share common threads. Each project shows different methods for addressing specific control problems. These projects give the reader a flavor of the diversity in the embedded control industry. 1.2.1 Underwater Torque Tool Four hundred meters below the North Atlantic is most inhospitable. It's also home to sizable petroleum reserves. In an increasingly audacious quest for oil, humans have run pipelines and placed wellheads deep under the ocean. One task that must be performed is the simple act of rotating mechanical valves on the sea floor. One technique used is to mount a hydraulic torque tool on the end of a remotely oper- ated vehicle's (ROV's) manipulator. Fly the ROV and tool down to the site. Insert the torque tool in the valve manifold. Turn the valve. The combination of high-cost equipment and environmental impact makes turning underwater valves a more considered task than turning on a garden hose. If the wrong valve is turned, or rotated the wrong direction, or moved the wrong amount, or is over-tightened, or is stuck or is broken, the environmental impact can be disastrous and the economic costs staggering. The system described here was designed to rotate 28-inch ball valves with up to a quarter- million foot-pounds of torque. The torque tool is a robot and contains sensors to monitor pressures, strain, speed and tem- peratures. The on-board computer communicates through an umbilical to the surface ship. Electrically controlled hydraulic valves control the tool's actions. Figure 1.4 shows a block diagram of the tool. The front of the tool has the coupler and latches. Undersea valves have a port designed to capture torque tools. This port is referred to as a "bucket." The latches engage the bucket to secure the tool. This also provides a stationary anchor for the tool to press against as it produces torque on the valve. To ensure that the correct valve is turned, each valve has a different orifice geometry. Much like common screws require a slotted or crossed screwdriver to turn the head, underwater valves require different couplers. The coupler can be changed to accommodate different valves. The ROV pilot flies the tool down to the valve. Using a video camera, the manipulator arm is used to position the torque tool's nose in the bucket. Next, the tool operator sends a command to the tool engaging the latches securing the tool in the bucket. If conditions are fight, the valve rotation can commence. An embedded controller inside the torque tool monitors conditions in the tool, provides a communication link with the ship and directs the tool's behavior. This particular tool uses an industrial PC with stackable I/O cards, a PC 104 stack. The ROV contains a hydraulic pressure unit (HPU), and the pressurized fluid is delivered to the tool through a high-pressure hose. Hydraulic pressure data is acquired through sensors and monitored by the PC 104 stack. Hall-effect sensors on the gearbox monitor the motor and coupler speed. Strain gauges moni- tor the actual torque applied to the valve. Introduction arelDaO lacilibmU _ Figure 1.4: , / ~ o T~canuS Underwater torque / tool designed to turn elbatcarteR hctaL / ~ / .sevlav VOR ~T ,,, ~ 1 ~ ciluardyH enil j ~ lacilibmU J oeTcafruS I 1'" otor)l ,rau,ic Hy / elbatcarteR hctaL ~. I ~ / / gni relpuoc Rotat I 1~I cIN drac ~ I Y/ Tool , Aoa,ogtoO,g,t~--- / ~ 4 \ I~~~T,,- !. J .",.\ ~. c~ iluardyH lortnoC evlaV ~1 "v d;o'n;~; revir'D }/J ~NN~N~ MT lacilU ibm htE .... t ~--.-- oT S ...... ~ cilardyH enil morf UPH no VOR oT}__~" dtYh Ua alrbiat I~n/Ce cr :;ih vI e The PC104 stack constantly watches the sensors. If any problem is detected, the tool is shut down and the operator alerted. The inclusion of an embedded controller in the tool allows the implementation of algorithms to gradually ramp up torque and speed on the valve. It also allows for an operator to com- mand the valve movement precisely. If a valve is stuck, the operator can command the tool to apply specific torques for specific times or angular distances. The PC104 stack ties together numerous sensors and actuators, allowing high forces to be applied to undersea valves with safety and precision. A PC was chosen as the embedded platform. The developers desired a multi-tasking Linux operating system. This allowed code development to occur on inexpensive desktop PCs with a low initial investment in software tools. Another big factor was the Ethernet connectivity supported by Linux. The tool can be operated through an IP (internet protocol) network from a geographically remote location. The tool operator does not have to be aboard the ship to control the tool. TCP/IP packets are easily routed over the Internet. In fact, during initial debugging sessions, the tool was deployed from a ship at sea while the torque tool operator was located in a cubicle 3,000 miles away. This configuration allowed Chapter I the R & D team to interrogate the tool, operate it and update software on the tool, all over the Internet. This arrangement was less expensive than flying the R & D team and their lab to a ship. A derivative design of this controller used a serial port to communicate between the tool and the ship. Point-to-point protocol (PPP) was used to route TCP/IP packets over the serial con- nection, while still retaining the diverse network features of the design. 1.2.2 Industrial Vacuum Pump for Semiconductor gnissecorP Equipment The process of turning silicon wafers into silicon chips has many steps. Some of these operations are carried out in low-pressure environments. There are vacuum pumps designed specifically to create low-pressure environments for use in wafer processing. A silicon wafer can yield hundreds of individual dice (or chips). Depending on complexity, each die may be worth a considerable sum of money. Each wafer is worth several hundred times the price of a die. During processing, wafers are ganged together in carriers or caddies. Each caddy carries tens of wafers. A caddy of silicon wafers increases in value as it moves through the fabrica- tion process. By the time the caddy is halfway through a process run, it is not unusual for the value of the caddy's contents to be several hundred thousand dollars. Silicon fabrication plant operators consider it "bad form" on the part of process tool vendors to allow a process tool, such as a vacuum pump, to ruin a batch of wafers. Considerable care goes into the design of vacuum pumps destined for silicon fabrication plants. Figure 1.5 shows a block diagram of an industrial vacuum unit. In the unit, two pumps are cascaded to develop the low pressures required by the wafer fabrication process. Each pump is driven by an eight-horsepower three-phase electric motor. The tool chamber is filled with highly toxic vapors released by the process chemicals. Nitro- gen gas is mixed with the exhaust gasses to dilute the toxic gases to safer levels. The pumps require water-cooling to maintain acceptable operating temperatures. If the pump housing is too hot or is unevenly heated, the mechanical parts fail to stay in tolerance and leaks develop~such leaks can reduce vacuum in the process chambers, which can in turn upset the process chemistry and diminish wafer yield. Flow sensors monitor the nitrogen and water supplied to the unit. A disruption in the flow of nitrogen is a safety concern. A disruption in the flow of water affects pump efficiency and mechanical wear. Thermocouples monitor pump housing and bearing temperature. Elevated temperatures indi- cate excessive friction, or reduced water circulation. Slightly elevated temperatures require a maintenance engineer to review the system, while severely elevated temperatures require the pump to be shut down. The man-machine interface (MMI) shown in Figure 1.5 consists of an LCD mounted on the front of the equipment cabinet. The MMI has no front panel controls. The inclusion of front panel controls would only open the possibility of a human manually changing the pump behavior and mining a caddy of wafers. The process is fully automated. The silicon-wafer process-tool controls the vacuum pump through the "control interface."

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.