Você está na página 1de 17

GS20070451 Nkabura marc Y4 ETE Assignment of MCU

Hardware unit & embedded system


Structure: 1.1 Introduction Objectives 1.2 Embedded System 1.3 Complex Systems and Microprocessor Embedding Computers Characteristics of Embedded Computing Applications Use of Microprocessors
1

The Physics of Software Challenges in Embedded Computing System Design Performance in Embedded Computing 1.4 Categories of Embedded Systems 1.5 Operating Systems for Embedded Systems 1.6 Summary 1.7 Terminal Questions 1.8 Answers 1.1 Introduction Each day, our lives have become more dependent on embedded systems and digital information technology that is embedded in our environment. This includes not only the applications such as automotive devices and controls, railways, aircraft, aerospace and medical devices, but also communications, mobile worlds and e-worlds, the smart home, factories etc. All of these have wide-ranging impacts on society, including security, privacy and modes of working and living. An embedded system is a computer system designed to do one or a few dedicated and/or specific functions often with realtime computing constraints. Embedded systems control many devices in common use today. In this unit you will be introduced to the concept of embedded system and other related topics like Complex Systems and Microprocessor. Objectives: After studying this unit, you should be able to: define embedded system define microprocessor explain why to use microprocessor list the categories of Embedded Systems list the operating systems for Embedded Systems. 1.2 Embedded System
2

An embedded system is a system that has embedded software and computer hardware which makes it a system dedicated for an application/s or part of an application or product or a part of a larger system. By name, an embedded system is a special-purpose computing device designed to perform dedicated functions. Some of the embedded systems with real-time constraints are called real-time embedded systems. An embedded system consists of its hardware and software and perhaps additional mechanical or other parts, designed to perform a specific function. A good example is the microwave oven. The hardware includes microprocessor or microcontroller with additional attached external memory, Input/Output (I/O), and other components such as sensors, keypad, LEDs, LCDs, and any kind of actuators. The embedded software is the driving force of an embedded system. Most real-time embedded system software has specific application programs supported by Real Time Operating System (RTOS). An embedded system can also be defined as a control system or computer system designed to perform a specific task. Embedded systems refer to devices, instruments or large engineering structures/systems that are built to handle one or a few preestablished tasks. The computer controlling the whole thing is built into or embedded within the device. Cellphones and personal digital assistants (PDAs) are examples of devices with embedded systems. They both perform a specific number of tasks which are controlled by a built-in computer system. The figure 1.1 shows some examples of Embedded Systems.

Embedded systems are controlled by one or more main processing cores that are typically either microcontrollers or digital signal processors which are dedicated to handle a particular task. They may require very powerful processors and extensive communication, for example air traffic control systems may usefully be viewed as embedded, even though they involve mainframe computers and dedicated regional and national networks between airports and radar sites. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. An embedded system has three main components which are embedded in it. They are embedded hardware (Processor, RAM, ROM, ADC, DAC, Timers, Ports, etc.), main application software(written in Assembly, C, C++, Java, etc.) and Real Time operating system(C OS-II, Win CE, VxWorks, Embedded Linux etc.) that takes care or supervises
3

the application software running on hardware and organizes the resources according to the tasks priorities of the system. Figure 1.1 shows the main components of embedded system hardware.

Figure 1.1: Components of Embedded system Hardware Characteristics: Embedded systems have the following characteristics: 1. Embedded systems are designed to do some specific task, rather than be a generalpurpose computer for multiple tasks. Some also have real-time performance constraints that must be met, for reasons such as safety and usability; others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs. 2. Embedded systems are not always standalone devices. Many embedded systems consist of small, computerized parts within a larger device that serves a more general purpose. For example, the Gibson Robot Guitar features an embedded system for tuning the strings, but the overall purpose of the Robot Guitar is, of course, to play music. Similarly, an embedded system in an automobile provides a specific function as a subsystem of the car itself. 3. The program instructions written for embedded systems are referred to as firmware, and are stored in read-only memory or Flash memory chips. They run with limited computer hardware resources: little memory, small or non-existent keyboard and/or screen. Processors in embedded systems
4

Embedded processors can be broken into two broad categories: ordinary microprocessors (P) and microcontrollers (C), which have many more peripherals on chip, reducing cost and size. Contrasting to the personal computer and server markets, a fairly large number of basic CPU architectures are used; there are Von Neumann as well as various degrees of Harvard architectures, Reduced Instruction Set Computer (RISC) as well as non-RISC; word lengths vary from 4-bit to 64-bits and beyond (mainly in DSP processors) although the most typical remain 8/16-bit. Most architectures come in a large number of different variants and shapes, many of which are also manufactured by several different companies. A long but still not exhaustive list of common architectures are: 65816, 65C02, 68HC08, 68HC11, 68k, 78K0R/78K0, 8051, ARM, AVR, AVR32, H8, HT48, M16C, M32C, MIPS, etc. The uses of embedded systems are virtually limitless, because every day new products are introduced to the market that utilize embedded computers in novel ways. In recent years, hardware such as microprocessors, microcontrollers, and Field Programmable Gate Array (FPGA) chips have become much cheaper. So when implementing a new form of control, its wiser to just buy the generic chip and write your own custom software for it. Producing a custom-made chip to handle a particular task or set of tasks costs far more time and money. Many embedded computers even come with extensive libraries, so that "writing your own software" becomes a very trivial task indeed.
Program memory and data memory

An embedded system will have very few resources when compared to computing systems like a desktop computer, the memory capacity and processing power in an embedded system is limited. It is more challenging to develop an embedded system when compared to developing an application for a desktop system as we are developing a program for a very constricted environment. Some embedded systems run a scaled down version of operating system called an RTOS (real time operating system).

INTERRUPT An interrupt is an event in hardware that triggers the processor to jump from its current program counter to a specific point in the code. Interrupts are designed to be special events whose occurrence cannot be predicted precisely (or at all). The MSP has many different kinds of events that can trigger interrupts, and for each one the processor will send the execution to a unique, specific point in memory. Each interrupt is assigned a word long segment at the upper end of memory. This is enough memory for a jump to the location in memory where the interrupt will actually be handled. Interrupts in general can be divided into two kindsmaskable and non-maskable. A maskable interrupt is an interrupt whose trigger event is not always important, so the programmer can decide that the event should not cause the program to jump. A non-maskable interrupt (like the reset button) is so important that it should never be 5

ignored. The processor will always jump to this interrupt when it happens. Often, maskable interrupts are turned off by default to simplify the default behavior of the device. Special control registers allow non-maskable and specific non-maskable interrupts to be turned on. Interrupts generally have a "priority;" when two interrupts happen at the same time, the higher priority interrupt will take precedence over the lower priority one. Thus if a peripheral timer goes off at the same time as the reset button is pushed, the processor will ignore the peripheral timer because the reset is more important (higher priority).

Complex Systems and Microprocessor 1.3.1 Embedding Computers 1.3.2 Characteristics of Embedded Computing Applications Embedded computing is in many ways much more demanding than the sort of programs that you may have written for PCs or workstations. Functionality is important in both general-purpose computing and embedded computing, but embedded applications must meet many other constraints as well. On the one hand, embedded computing systems have to provide sophisticated functionality: Complex algorithms: The operations performed by the microprocessor may be very sophisticated. For example, the microprocessor that controls an automobile engine must perform complicated ltering functions to optimize the performance of the car while minimizing pollution and fuel utilization. Timer: Many embedded computing systems have to perform in real time if the data is not ready by a certain deadline, the system breaks. In some cases, failure to meet a deadline is unsafe and can even endanger lives. In other cases, missing a deadline does not create safety problems but does create unhappy customers; missed deadlines in printers, for example, can result in scrambled pages. Multirate: Many embedded computing systems have several real-time activities going on at the same time. They may simultaneously control some operations that run at slow rates and others that run at high rates. Multimedia applications are prime examples of multirate behavior. The audio and video portions of a multimedia stream run at very different rates, but they must remain closely synchronized. Failure to meet a deadline on either the audio or video portions spoils the perception of the entire presentation.
6

Costs of various sorts are also very important: Power and energy: Power consumption directly affects the cost of the hardware, since a larger power supply may be necessary. Energy consumption affects battery life, which is important in many applications, as well as heat consumption, which can be important even in desk top applications. Most embedded computing systems are designed by small teams on tight deadlines. Tight deadlines are facts of life in todays internationally competitive environment. However, building a product using embedded software makes a lot of sense: Hardware and software can be debugged somewhat independently and design revisions can be made much more quickly. User interface: Microprocessors are frequently used to control complex user interfaces that may include multiple menus and many options. The moving maps in Global Positioning System (GPS) navigation are good examples of sophisticated user interfaces. To make things more difcult, embedded computing operations must often be performed to meet deadlines:

Input interface The goal of this project is to develop voice input/speech output interfaces for embedded system applications. Our development efforts will be specifically focused on the domain of human interaction with search engines for the World-Wide-Web. Our research is focused in two areas. First, we are investigating issues relating to discourse management including focus of attention, wake-up/sleep mechanisms, error detection/recovery, and contention resolution. Second, we are attempting to exploit the domain knowledge that is incorporated into contemporary search engines to design
simple discourses directed at refining a search. Queued Serial Peripheral Interface (QSPI) The queued serial peripheral interface (QSPI) is another type of SPI controller, not another bus type. Or in other words it is just an extension to the SPI-bus. The difference is that it uses a data queue with programmable queue pointers that allow some data transfers without CPU intervention. It also has a wrap-around mode that allows continuous transfers to and from the queue with no CPU intervention. As a result, the peripherals or the slaves appear to the CPU as memory-mapped parallel devices. This feature is useful in applications such as control of an Analog to Digital converter. The QSPI has got some more programmable features like chip selects and transfer length/delay. 7

Serial communication port The networked embedded systems are connected to network with network interfaces to be accessed or to access other resources. The connected network can be Local Area Network (LAN), Wide Area Network (WAN), or Internet. The connection can be wired or wireless. A home security system is an example of LAN networked embedded system where all sensors (e.g. motion detectors, light sensors, or smoke sensors) are wired and running on the TCP/IP protocol. A home Security system can be integrated into a web based security system with additional web camera running on HTTP protocol. A versaile output interface that can control external devices direct from your computer. Uses freely available software and works with both windows and Linux.

Notes Any PC that has a free parallel printer port available should work with this circuit. The schematic shown above requires little explanation. Any data sent to the printer port is already "latched" and just requires buffering to be able to drive an external ciruit. In this case I have chosen to use the ULN2083 octal transistor array to buffer the output current from the parallel port. The IC pinout for the ULN2083 is shown below.

Question 2 Software is normally designed to accomplish a task in an efficient manner. The primary concept about the designer of the software in embedded system is to obtain the greatest amount of control over system response. Systems that required little control and poor response can be done with simple architectures, while rapid response system will require more complex program designer to be successful. The four basic architecture which can be covered in software are: Round Robin that is very simple ROUND Robin with interrupt Function- Queue Scheduling Real Time Operating System , that is the most complex.

Round Robin with interrupt Interrupt routines deal with the very urgent needs of devices. Interrupt routines set flags to indicate the interrupt happened Main while loop polls the status of the interrupt flags and does any follow-up processing required by a set flag. RR with interrupts advantages. More control over priorities

-Device routines can be serviced in any order Processor interrupt priority settings can be used Interrupt routines get good response

_Main loop can be suspended -Interrupt routine are (must/ should be) shrt. Interrupt code inherently has a higher priority than task code. RR with interrupts disadvantages More complicated than Round Robin Contex problems can occur: Saving and restoring context inside interrupt routines becomes necessary when number of register is small. Share data problems. Debugging becomes more complicated. Same latency/prioty issues causing (A,C,B,C)still exist.

Question 3 From an implementation viewpoint, there is a major difference between a computer and an embedded system. Embedded systems are often required to provide Real-Time response. A Real-Time system is defined as a system whose correctness depends on the timeliness of its response. Examples of such systems are flight control systems of an aircraft, sensor systems in nuclear reactors and power plants. For these systems, delay in response is a fatal error. Real-Time Systems can be classified as:

Real-time embedded systems: A system is said to be real-time if the response time is critical. In other word, some particular work must be done in a specified time period. In addition to functional correctness, the time constraint must be satisfied. i. Hard real-time systems: For a hard or immediate real-time system, the completion of an operation after its deadline may lead to a critical failure and result in life, loss and property damage. For example: A car airbag control system is a hard real-time system because a delayed reaction may cause drivers life and the delay response in heart pacemakers will also lead to a severe result. ii. Soft real-time system: In some other embedded system, there is response deadline but the lateness can be tolerated to some degrees. The violation of time constraints will

10

result in degraded quality, but the system can continue to operate. Microwave and washing machine fall into this sub-category. Operating Systems for Embedded Systems Operating Systems for embedded systems are classified into Real-Time Operating Systems and Non-Real-Time Operating Systems. Real Time Operating Systems are operating systems which guarantee responses to each event within a defined amount of time. This type of operating system is mainly used by time-critical applications such as measurement and control systems. Some commonly used RTOS for embedded systems are: VxWorks, OS-9, Symbian, RTLinux. Non-Real Time Operating Systems do not guarantee defined response times. Those systems are mostly used if multiple applications are needed. Windows CE and PalmOS are examples for such embedded operating systems. An embedded system can be defined as a control system or computer system designed to perform a specific task. An embedded system has three main components: embedded hardware, main application software and Real Time operating system. A microprocessor is a single-chip CPU. Modern RISC processors can execute one instruction per clock cycle most of the time and high-performance processors can execute several instructions per cycle. Software performance and energy consumption are very important properties when we are connecting our embedded computers to the real world. Embedded systems are often required to provide Real-Time response. Operating Systems (for embedded systems) are classified into Real-Time Operating Systems and Non-Real-Time Operating Systems. Question 4 An open queuing network for analyzing multilayered window flow control mechanisms consisting of different subnetworks is presented. The number of customers in each subnetwork is controlled by a semaphore queue. The queuing network is analyzed approximately using decomposition and aggregation. The approximation was validated against exact numerical and simulation data, and it was found to have an acceptable relative error. The queuing model is easy to implement, and it can be included in a software package. Using this queuing network, a case study involving the modeling and analysis of the ISO X25 flow control mechanism is presented What is a semaphore and a semaphore timeout?

In a multitasking environment there is often a requirement to synchronize the execution of 11

various tasks or ensure one process has been completed before another begins. This requirement is facilitated by the use of a software switch known as a Semaphore or a Flag. The function of this is to work in much the same way a railway signal would; only allowing one train on the track at a time. A semaphore timeout is where the railway signal has been set in one state too long, maybe because the train has broken down.

Example of a semaphore timeout in Notes/Domino An example of this in Notes/Domino is when the indexer needs to completely rebuild an index, it locks a semaphore so that other tasks cannot use the index until it is rebuilt. If a user task now tries to open that index while it is being rebuilt, it will have to wait for the indexer to finish the rebuild and then unlock the semaphore. As a result, the user task is stuck until that semaphore is unlocked. While it is stuck waiting for the semaphore, it keeps track of how long it has been waiting. If it is stuck for more than 30 seconds, this is considered a semaphore timeout and in debug mode a message will be logged to the console. The task will continue to wait for the semaphore, timing out every 30 seconds, until the semaphore is unlocked or the task is ended. For most operations, a task might only wait a few microseconds and hence not time-out. With a complicated view on a large database, the task may have to wait several minutes for the index semaphore. If an important semaphore is locked by a task and is never unlocked, all tasks can be stopped waiting for that semaphore. This can happen in several different ways. The most common is where a task locks the semaphore and then crashes. This can also happen if a task locks the semaphore and then goes into an endless loop or it gets an error and forgets to unlock it. Semaphore deadlock can occur when two tasks try to lock two different semaphores in a different order. For example, Task A locks Semaphore 1 and then tries to lock Semaphore 2. In the meantime, Task B has already locked Semaphore 2 and is now trying to lock Semaphore 1. Task A is stuck waiting for Semaphore 2 and Task B is waiting for Semaphore 1 -- deadlock.

Reasons for semaphore timeouts

When you receive semaphore timeout messages, the messages are usually the result of one of the following: 1. A heavy load on the server is causing processes to be delayed from releasing semaphores. 2. A process has crashed while holding a semaphore, causing other processes to block when trying to acquire the semaphore. 12

3. Deadly embrace, semaphore contention where two tasks are waiting on each other and neither task is able to break the loop. In the simplest case, thread A is trying to get a semaphore which is owned by B, while B is trying to get a different semaphore which is owned by A. More complex combinations are also possible: A wants a semaphore owned by B, who wants a semaphore owned by C, who wants a semaphore owned by A, etc. 4. If a process was to fail to set a semaphore during execution, another process dependent on the semaphore will be blocked awaiting the semaphore.

Determining if a semaphore timeout has occurred

If an issue is a semaphore issue, it will be reported in two ways: 1. Sem.Timeouts

At the server console, you will see the Sem.Timeouts statistic. To view this statistic, type the following: sh stat sem.timeouts If the problem has occurred, you will see something similar to the following, depending upon the nature of the semaphore timeout Sem.Timeouts = 430D:58 0A13:42 030B:28 0116:26 0A12:21 NOTE: The statistic Sem.Timeouts will not appear in the Statrep if the customer is not experiencing semaphore timeouts. The first number is the semaphore ID. The ID tells us what the semaphore is used for. For example, 0x030B is the collection semaphore used by NIF. The second number is a decimal number which shows the number of times the semaphore timeout occurred. It is not unusual in a heavily used server to get semaphore timeouts. The following table lists some of the semaphores you may encounter:
Semaphore Function

13

0244

NSF per-database semaphore OS File system semaphore NSF per-database fulltext semaphore NSF database opening semaphore NIF collection semaphore NAMELookup semaphore Log commit semaphore console semaphore Buffered log package semaphore Collection semaphore Handle table free chain consistency semaphore Session table semaphore Handle table movement semaphore New to Domino 4.5, AdminP's semaphore for ACL modification internal control semaphore BSAFE semaphore (RSA encryption stuff)

410F

0266

4245

030B

430D

0A13 0116 0A12

030B 4117

0A0B

4113

33d5

4253

5708

14

0255 0294

NSF B-Tree semaphore Directory Manager Queue semaphore Transfer queue lock semaphore Task sync semaphore NSF buffer pool container DBCONT page zero semaphore

1120

0931 0256

03A8

2. Error: "Session semaphore held for [n] seconds" The second way of determining if there is a semaphore issue, is when you see (at the server console) the following message: "Session semaphore held for [n] seconds." Note: This error does not print to the log file.

Troubleshooting Semaphore Timeouts

The following parameters can be added to the NOTES.INI file: NOTE: Before enabling any debug parameters, discuss them with IBM Support beforehand. There may be issues surrounding their use, or special precautions that must be considered. These debug parameters might require a large amount of disk space, dependent upon when the server encounters problems; the longer the server stays up, the larger the debug files will be. These files can grow large enough to cause disk space shortages. Debug_Capture_Timeout=1 Debug_Show_Timeout=1 See the following technote for additional information: "How to Turn on Semaphore Debugging Parameters in the NOTES.INI for Domino" After adding these parameters, if semaphores are generated, they will be captured in a file 15

called SEMDEBUG.TXT in the Domino program directory: Output of SEMDEBUG.TXT: THREAD [02AB:0123] WAITING FOR FRWSEM 0x030B Collection semaphore (@0BE65A20) (R=0,W=1,WRITER=0080:015E,1STREADER=0000:0000) FOR 30000 ms THREAD [01FE:0220] WAITING FOR FRWSEM 0x0244 open database semaphore (@00ECBDD2) (R=0,W=1,WRITER=0080:015E,1STREADER=0000:0000) FOR 30000 ms

Output of SEMDEBUG.TXT for Unix: THREAD [01676:00001] WAITING FOR RWSEM 0x412C (@EE100210) (R=0,W=1,WRITER=05067:00001,1STREADER=05067:00001) FOR 30000 ms THREAD [01684:00001] WAITING FOR RWSEM 0x412C (@EE100210) (R=0,W=1,WRITER=05067:00001,1STREADER=05067:00001) FOR 30000 ms

What does the output mean? 0x030B - Indicates the type of semaphore [01FE:0220] The first number (01FE) indicates the process ID. This number is in hex and must be converted to decimal. This number will be completely different when the server is rebooted. The second number (0220) is the thread ID.

What does the output mean (in Unix example): 0x412C - Indicates the type of semaphore [01684:00001] The first number (01684) indicates the process ID. This number is the PID as indicated in the NSD output and will be completely different when the server is rebooted.

16

References
1. www.csun.edu/~jeffw/.../SoftwareArchitecture 2. HG Perros - , IEEE Transactions on, 1990 - ieeexplore.ieee.org 3. os-concepts.blogspot.com/2008/.../interrupt_12.ht www.cs.pitt.edu/~don/projects/pdg-charlotte.htmEn cache www.eeherald.com/section/design.../esmod12.htm www.zen22142.zen.co.uk/.../Interface/pc_int. www. programing-tutorial.bl... www.logix4u.net/parallelport1.htmEn cache -

4. www-01.ibm.com/support/docview.wss?uid

17

Você também pode gostar