embedded system

Upload: abhijeet-kumar-srivastava

Post on 11-Oct-2015

24 views

Category:

Documents


0 download

DESCRIPTION

Introduction to embedded system an ARM 7.

TRANSCRIPT

  • CHAPTER 1

    Organization Overview

    HCL Learning is a part of HCL Info systems which deals in educating student for the

    awareness in terms of knowledge and research and development.

    Location-

    Lovely Professional University, Phagwara Punjab

    Specialization in work culture of Organization

    The organization deals with software consulting, engineering and R&D services, remote and

    infrastructure management.

    About External Guide

    Name- Mr Shekhar Singhal.

    B.tech- Tulas Institute.

    M.tech- Sharda University.

    Trainee at Thinks Labs IIT Bombay.

    Developer at CETPA.

    Trainer.

  • Chapter 2

    Embedded system

    Embedded system refers to the combination of the hardware and software. The word

    embedded itself tells to embed the required circuitry in the board for a single purpose.

    An embedded system is a system that has software embedded nto computer-hardware, which

    makes a system dedication for an application or specific part of an application or product or

    part of a larger system

    Lets consider a computer

    A computer is a system that has following or more component.

    A microprocessor.

    A large memory comprising the following two kinds

    1- Primary memory

    RAM, ROM and fast accessible to cache memory

    2- Secondray memory

    Optical memory- in cd rom

    Magnetic memory in hard disk

    I/O units such as keybord.

    Output units like LCD screen

    Operating System

    Three main components of embedded system :-

    Hardware to give computer like functionalities

    Software which is generally flash in the ROM to perform the task

    Embeds a real time operating system(RTOS), which supervises the application

    software task running in the hardware and organizes the access to system resource

    according to priorities and timming contraints of task in the system.

  • Embedded System RTOS

    Enables execution of concurrent processes or threads or tasks.

    Provides a mechanism to let the processor run each process as per scheduling and

    t do contest switch between the various processes (threads of task)

    RTOS sets the rules during execution of application processes to enable finishing

    of the process whining the assign time interval and with assisgned priority

    Sophisticated Embedded system Characteristics

    Dedicated function

    Dedicated complex algorithm

    Dedicated (GUIs) and other user interfaces for the application

    Real time operations :- Defines the ways in which the system works, reacts to the

    events and interrupts ,schedules the system functioning in real time and executes

    by following a plan to control the latencies and to meet the deadlines.

    Multi-rate operation: - different operations may take place at distinct rates. For

    examples the audio, video, network data or stream and events have the different

    rates and time constraints to finish associated processes

    CATEGORIES OF EMBEDDED SYSTEMS :-

    Embedded systems can be classified into the following 4 categories based on their

    functional and performance requirements.

    Stand-alone embedded systems

    Real-time embedded systems -- Hard real-time systems & Soft real-time system

    Networked embedded systems and

    Mobile Embedded systems.

    Based on the performance of the Microcontroller they are also classified into

    (i) Small scaled embedded system

    (ii) (ii) Medium scaled embedded system and

    (iii) (iii) Large scaled embedded system.

  • Stand alone Embedded systems :- A stand-alone embedded system works by itself. It

    is a self-contained device which do not require any host system like a computer.. It takes

    either digital or analog inputs from its input ports, calibrates, converts, and processes the

    data, and outputs the resulting data to its attached output device, which either displays data,

    or controls and drives the attached devices. Temperature measurement systems, Video game

    consoles , MP3 players, digital cameras, and microwave ovens are the examples for this

    category.

    Real-time embedded systems : An embedded system which gives the required output

    in a specified time or which strictly follows the time dead lines for completion of a task is

    known as a Real time system. i.e a Real Time system , in addition to functional correctness,

    also satisfies the time constraints .

    There are two types of Real time systems.(i) Soft real time system and (ii) Hard real time

    system.

    Soft Real-Time system : A Real time system in which ,the violation of time constraints

    will cause only the degraded quality, but the system can continue to operate is known as a

    Soft real time system. In soft real-time systems, the design focus is to offer a guaranteed

    bandwidth to each real-time task and to distribute the resources to the tasks.

    Ex: A Microwave Oven , washing machine ,TV remote etc.

    Hard Real-Time system : A Real time system in which ,the violation of time constraints

    will cause critical failure and loss of life or property damage or catastrophe is known as a

    Hard Real time system.

    These systems usually interact directly with physical hardware instead of through a human

    being .The hardware and software of hard real-time systems must allow a worst case

    execution (WCET) analysis that guarantees the execution be completed within a strict

    deadline. The chip selection and RTOS selection become important factors for hard real-time

    system design.

    Ex: Deadline in a missile control embedded system , Delayed alarm during a Gas leakage ,

    car airbag control system , A delayed response in pacemakers ,Failure in RADAR

    functioning etc.

  • Networked embedded systems : The networked embedded systems are related to a

    network with network interfaces to access the resources. The connected network can be a

    Local Area Network (LAN) or a Wide Area Network (WAN), or the Internet. The

    connection can be either wired or wireless.

    The networked embedded system is the fastest growing area in embedded systems

    applications. The embedded web server is such a system where all embedded devices are

    connected to a web server and can be accessed and controlled by any web browser.

    Ex: A home security system is an example of a 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.

    Mobile Embedded systems : The portable embedded devices like mobile and cellular

    phones , digital camaras,MP3 players, PDA (Personal Digital Assistants) are the example for

    mobile embedded systems. The basic limitation of these devices is the limitation of memory

    and other resources.

    1. Small scaled embedded system : An embedded system supported by a single 816

    bit Microcontroller with on-chip RAM and ROM designed to perform simple tasks is a

    Small scale embedded system.

    2. Medium scaled embedded system : An embedded system supported by 1632 bit

    Microcontroller /Microprocessor with external RAM and ROM that can perform more

    complex operations is a Medium scale embedded system.

    3. Large scaled embedded system: An embedded system supported by 32-64 bit

    multiple chips which can perform distributed jobs is considered as a Large scale embedded

    system.

    Constraints of an Embedded system design:-

    Available system-memory.

    Available processor speed.

    Limited power dissipation when running the system continuously in cycle of the

    system start wait for events ,wake-up and run, sleep and stop.

  • System design constraints :-

    Perfomance

    Power

    Size

    Non recurring design cost ,and

    Manufacturing

    Embedded system Development Tools : Basically the embedded tools are divided

    into two types

    ( i).Hardware Development tools and

    (ii) Software Development tools.

    Hardware development tools : Hardware tools for embedded development include

    development or evaluation boards for specific processors, like Friendly ARMs Mini2440,

    Pandaboard , Beagleboard and Craneboard etc..In addition to this various othes devices like

    Digital multimeters ,Logic Analyzers , Spectrum Analyzers and Digital CROs etc.are also

    required in embedded design.

    The digital multimeter is used to measure voltages, currents and to check the continuity in

    the circuits in an embedded systems. Because the embedded system also contains some

    application specific circuitry which some times require debugging.

    The Logic analyzer is used to check the timings of the signals ,and their correctness.

    The Spectrum analyzer is helpful to to analyze the signals in the frequency domain.

    The digital CRO helps to display the output waveforms and also to store a portion of the

    waveforms etc.

    Software development tools /testing tools : The software development tools include

    the operating system development suite ,cross platform development tools, ROM emulator

    ,EPROM programming and In circuit Emulator (ICE) etc. The operating system

    development suite consists of API calls to access the OS services.This suite can run on either

    Windows or UNIX/Linux systems.

    Under the cross platform tools,the compiler generates the object code for the source code

    developed in high level languages like C and C++ or Java etc.For LINUX systems a number

    of GNU tools are available.

    The EPROM programmer is used to in circuit programming by burning the code in the

    memory of the target system.

  • The instruction set Simulator(ISS) software creates the virtual version of the processor on the

    PC.

    Assembler and Compiler: The binary code obtained by translating an assembly language

    program using an assembler is smaller and runs faster than the binary code obtained by

    translating a high level language using a compiler since the assembly language gives the

    programmer complete control over the functioning of a processor. The advantage of using a

    high level language is that a program written in a high level language is easier to understand

    and maintain than a program written in assembly language. Hence time critical applications

    are written in assembly language while complex applications are written in a high level

    language.

    Application Areas of Embedded Systems: The embedded systems have a huge

    variety of application domains which varies from very low cost to very high cost and from

    daily life consumer electronics to industry automation equipments, from entertainment

    devices to academic equipments, and from medical instruments to aerospace and weapon

    control systems. So,the Embedded systems span all aspects of our modern life. The following

    table gives the various applications of embedded systems.

  • S.No Embedded System Application

    1 Home Appliances Dishwasher, washing machine, microwave, Top-set

    box, security system , HVAC system, DVD,

    answering machine, garden sprinkler systems etc..

    2 Office Automation Fax, copy machine, smart phone system, modern,

    scanner, printers.

    3 Security Face recognition, finger recognition, eye recognition,

    building security system , airport security system,

    alarm system.

    4 Academia Smart board, smart room, OCR, calculator, smart

    cord.

    5 Instrumentation Signal generator, signal processor, power

    supplier,Process instrumentation,

    6 Telecommunication Router, hub, cellular phone, IP phone, web camera

    7 Automobile Fuel injection controller, anti-locking brake system,

    air-bag system, GPS, cruise control.

    8 Entertainment MP3, video game, Mind Storm, smart toy.

    9 Aerospace Navigation system, automatic landing system, flight

    attitude controller, space explorer, space robotics.

    10 Industrial automation Assembly line, data collection system, monitoring

    systems on pressure, voltage, current, temperature,

    hazard detecting system, industrial robot.

    11 Personal PDA, iPhone, palmtop, data organizer.

    12 Medical CT scanner, ECG , EEG , EMG ,MRI, Glucose

    monitor, blood pressure monitor, medical diagnostic

    device.

    13 Banking & Finance ATM, smart vendor machine, cash register ,Share

    market

    14 Miscellaneous: Elevators, tread mill, smart card, security door etc.

  • CHAPTER 3

    Motivation :-

    During the starting of 3rd

    year, we have been introduced by the technology of 8051

    Microprocessor and Microcontroller. We get more into this new field of tech. This influenced

    us to be motivated and to learn some new and advanced technology related to this field.

    During the period of Training, we got the

    opportunity to complete our first step towards our interest .so we decided to join the

    organization and to be a part of our dream.

    During this period, we come to know about many

    thing like ARM7 ,its architecture, its pin diagram, its application and interfacing.

  • CHAPTER 4

    Learning outcome

    ARM(Advance RISC Machine)

    RISC

    RISC, or Reduced Instruction Set Computer. is a type of microprocessor architecture that

    utilizes a small, highly-optimized set of instructions, rather than a more specialized set of

    instructions often found in other types of architectures.

    History

    The first RISC projects came from IBM, Stanford, and UC-Berkeley in the late 70s and early

    80s. The IBM 801, Stanford MIPS, and Berkeley RISC 1 and 2 were all designed with a

    similar philosophy which has become known as RISC. Certain design features have been

    characteristic of most RISC processors:

    one cycle execution time: RISC processors have a CPI (clock per instruction) of one

    cycle. This is due to the optimization of each instruction on the CPU and a technique

    called pipelining

    pipelining: a techique that allows for simultaneous execution of parts, or stages, of

    instructions to more efficiently process instructions;

    large number of registers: the RISC design philosophy generally incorporates a larger

    number of registers to prevent in large amounts of interactions with memory

    The simplest way to examine the advantages and

    disadvantages of RISC architecture is by

    contrasting it with it's predecessor: CISC

    (Complex Instruction Set Computers)

    architecture.

    Multiplying Two Numbers in Memory

    On the right is a diagram representing the

    storage scheme for a generic computer.

  • The main memory is divided into locations numbered from (row) 1: (column) 1 to

    (row) 6: (column) 4. The execution unit is responsible for carrying out all

    computations. However, the execution unit can only operate on data that has been

    loaded into one of the six registers (A, B, C, D, E, or F). Let's say we want to find the

    product of two numbers - one stored in location 2:3 and another stored in location 5:2

    - and then store the product back in the location 2:3.

    The CISC Approach

    The primary goal of CISC architecture is to complete a task in as few lines of

    assembly as possible. This is achieved by building processor hardware that is capable

    of understanding and executing a series of operations. For this particular task, a CISC

    processor would come prepared with a specific instruction (we'll call it "MULT").

    When executed, this instruction loads the two values into separate registers, multiplies

    the operands in the execution unit, and then stores the product in the appropriate

    register. Thus, the entire task of multiplying two numbers can be completed with one

    instruction:

    MULT 2:3, 5:2

    MULT is what is known as a "complex instruction." It operates directly on the

    computer's memory banks and does not require the programmer to explicitly call any

    loading or storing functions. It closely resembles a command in a higher level

    language. For instance, if we let "a" represent the value of 2:3 and "b" represent the

    value of 5:2, then this command is identical to the C statement "a = a * b."

    One of the primary advantages of this system is that the compiler has to do very little

    work to translate a high-level language statement into assembly. Because the length of

    the code is relatively short, very little RAM is required to store instructions. The

    emphasis is put on building complex instructions directly into the hardware.

    The RISC Approach

    RISC processors only use simple instructions that can be executed within one clock

    cycle. Thus, the "MULT" command described above could be divided into three

    separate commands: "LOAD," which moves data from the memory bank to a register,

    "PROD," which finds the product of two operands located within the registers, and

    "STORE," which moves data from a register to the memory banks. In order to

    perform the exact series of steps described in the CISC approach, a programmer

    would need to code four lines of assembly:

  • LOAD A, 2:3

    LOAD B, 5:2

    PROD A, B

    STORE 2:3, A

    At first, this may seem like a much less efficient way of completing the operation.

    Because there are more lines of code, more RAM is needed to store the assembly

    level instructions. The compiler must also perform more work to convert a high-level

    language statement into code of this form.

    RISC CISC

    Emphasis on software Emphasis on hardware

    Single clock ,reduced

    instructions only

    Include multi-clock complex

    instructions

    Register to register load and

    store

    Memory to memrory load and

    store

    Low cycle per second ,large

    code size

    High cycle per second ,small

    code size

    The Performance Equation

    The following equation is commonly used for expressing a computer's performance

    ability:

    The CISC approach attempts to minimize the number of instructions per program,

    sacrificing the number of cycles per instruction. RISC does the opposite, reducing

    the cycles per instruction at the cost of the number of instructions per program.

  • ARM7 is one of the widely used micro-controller family in embedded system application.

    This section is humble effort for explaining basic features of ARM-7.

    ARM is a family of instruction set architectures for computer processors based on a reduced

    instruction set computing (RISC) architecture developed by British company ARM Holdings.

    A RISC-based computer design approach means ARM processors require significantly fewer

    transistors than typical processors in average computers. This approach reduces costs, heat

    and power use. These are desirable traits for light, portable, battery-powered devices

    including smartphones, laptops, tablet and notepad computers), and other embedded systems.

    A simpler design facilitates more efficient multi-core CPUs and higher core counts at lower

    cost, providing higher processing power and improved energy efficiency for servers and

    supercomputers.

    SOME FACTS YOU MUST KNOW

    In 2005, about 98% of all mobile phones sold used at least one ARM processor.

    The low power consumption of ARM processors has made them very popular: 37 billion

    ARM processors have been produced as of 2013, up from 10 billion in 2008.

    The ARM architecture (32-bit) is the most widely used architecture in mobile devices, and

    most popular 32-bit one in embedded systems.

    According to ARM Holdings, in 2010 alone, producers of chips based on ARM architectures

    reported shipments of 6.1 billion ARM Based processors, representing 95% of

    smartphones, 35% of digital televisions and set-top boxes and 10% of mobile computers.

    It is the most widely used 32-bit instruction set architecture in terms of quantity produced.

    LETS START WITH LPC 2148

    LPC2148 is the widely used IC from ARM-7 family. It is manufactured by Philips and it is

    pre-loaded with many inbuilt peripherals making it more efficient and a reliable option for the

    beginners as well as high end application developer.

  • Let us go through the features of LPC214x series controllers.

    8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash program memory.128

    bit wide interface/accelerator enables high speed 60 MHz operation.

    In-System/In-Application Programming (ISP/IAP) via on-chip boot-loader software. Single

    flash sector or full chip erase in 400 ms and programming of 256 bytes in 1ms.

    Embedded ICE RT and Embedded Trace interfaces offer real-time debugging with

    theon-chip Real Monitor software and high speed tracing of instruction execution.

    USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM. In addition,

    the LPC2146/8 provides 8 kB of on-chip RAM accessible to USB by DMA.

    One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide a total of

    6/14analog inputs, with conversion times as low as 2.44 us per channel.

    Single 10-bit D/A converter provides variable analog output.

    Two 32-bit timers/external event counters (with four capture and four comparechannels

    each), PWM unit (six outputs) and watchdog.

    Low power real-time clock with independent power and dedicated 32 kHz clock input.

    Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus(400 kbit/s),

    SPI and SSP with buffering and variable data length capabilities.

    Vectored interrupt controller with configurable priorities and vector addresses.

    Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package.

    Up to nine edge or level sensitive external interrupt pins available.

    On-chip integrated oscillator operates with an external crystal in range from 1 MHz to30

    MHz and with an external oscillator up to 50 MHz.

    Power saving modes include Idle and Power-down.

    Individual enable/disable of peripheral functions as well as peripheral clock scaling

    foradditional power optimization.

    Processor wake-up from Power-down mode via external interrupt, USB, Brown-OutDetect

    (BOD) or Real-Time Clock (RTC).

    Single power supply chip with Power-On Reset (POR) and BOD circuits:

    CPU operating voltage range of 3.0 V to 3.6 V (3.3 V 10 %) with 5 V tolerant I/Opads.

    The list of feature is enough to explain why it has covered such a huge market for high end

    applications such as mobile phones, tablets etc

  • FIRST STEP- HARDWARE REQUIREMENT

    Here is the pin configuration of LPC 2148.

    Now let us start with the hardware requirement of LPC2148.

    LPC2148 need minimum below listed hardware to work properly.

    1. Power Supply

    2. Crystal Oscillator

    3. Reset Circuit

  • 4. RTC crystal oscillator (This is not necessary if you are not using RTC. However

    this is considered as necessary requirement)

    5. UART

    1. Power Supply

    LPC2148 works on 3.3 V power supply. LM 117 can be used for generating 3.3 V supply.

    However, basic peripherals like LCD, ULN 2003 (Motor Driver IC) etc. works on 5V. So AC

    mains supply is converted into 5V using below mentioned circuit and after that LM 117 is

    used to convert 5V into 3.3V.

    Block diagram for power supply is given below.

    Transformer:It is used to step down 230V AC to 9V AC supply and provides isolation

    between power grids and circuit.

    Rectifier: It is used to convert AC supply into DC.

    Filter:It is used to reduce ripple factor of DC output available from rectifier end.

  • Regulator:It is used to regulate DC supply output.

    Circuit for this is as shown below.

    Here, Regulator IC 7805 is used to provide fix 5V dc supply.

    Now we can use LM 117 for generating 3.3V supply from 5V using below circuit.

  • Calculations

    2. Reset Circuit

    Reset button is essential in a system to avoid programming pitfalls and sometimes to manually bring back the

    system to the initialization mode. Circuit diagram for reset is as shown below.

    MCP 130T is a special IC used for providing stable RESET signal to LPC 2148.

  • 3. Oscillator Circuit

    Oscillations, the heartbeat, are provided using a crystal and are necessary for the system to work.

    The value of capacitors C20 & C21 depends upon the frequency of crystal Y3. General circuit and its equivalent

    circuit is as shown below.

  • Recommended values are as shown in table.

    We can also use external oscillator for providing system clock. Circuit for this application is as given below.

  • 4. RTC Oscillator Circuit

    It provides clock for RTC operation.

    5. UART

    LPC 2148 has inbuilt ISP which means we can program it within the system using serial communication on

    COM0. It has also COM1 for serial communication. MAX 232/233 IC must be used for voltage logic conversion.

    Related connections are as given below.

  • CHAPTER 5

    Gantt chart

    References

    INSIDERS GUIDE TO THE ARM BASED MICROCONTROLLER

    By Trevor Martin.

    Engineersgarage.com

    Slideshare.com