Embedded Systems z Embedded Systems are specialized or dedicated computers used to control appliances, devices and z Platforms that use embedded systems include consumer appliances, IT devices and industrial/commercial machines z Consumer: PDAs, game consoles, set top boxes, automotive control systems, home appliances z IT: Printers, copiers, faxes, teller machines, telecom switches and routers, modems, videoconferencing, disk controllers z Industrial/commercial: robotics, acquisition, manufacturing control, process control, medical imaging and monitoring, aerospace, satellite systems, radar systems

1 Other automobile applications

• entertainment system • theft deterrent systems • climate control • dashboard display • traction control • navigation systems

Electronic components and software will, to a large extent, shape tomorrow‘s vehicles (90% of vehicle innovations).

2 Smart Kitchens z 1/3 of European consumers want technology to make home life easier and more fun z Two most desired smart products: - One-button washing - Intelligent oven z Consumers want technology to: - Reduce environmental waste - Save energy costs

Smart Technology in the kitchen

3 Online gaming potential z Online gaming set to become a significant part of the total games market z Console-based online gaming passed PC- based online gaming in 2003-2004

GPS Handheld

4 Growth of Embedded Devices

z Embedded devices will be pervasive z On average, 3 embedded devices/person on the planet by 2011

What will be embedded? z Everything that is Now Electro-Mechanical, Machines (Nano-Machines) z Anything that communicates z Lots of stuff in our cars z Our Bodies: Pacemakers, De-Fibrillators, Insulin Dispensers z All sorts of interfaces, analog, speech, DNI, etc.

5 What will be embedded? z Computers are, and will be, everywhere z The world itself is becoming more intelligent z Our infrastructure will have major software content – Most of our access to information will be through embedded systems z Economics will inexorably drive deployment of embedded systems z The Internet is one important factor in this trend z EVERY tech and mfg. business will need to become good at .

Microcontrollers (MCUs)

ƒ Micro-controllers includes ƒ CPU, ROM, RAM ƒ Interface with the world (digital I/O, ADC, DAC, Buses like Ethernet, Firewire, USB, PCI etc.) ƒ Integrated services (timers, graphic displays, PWM etc)

ƒ Goal: ƒ System on chip (SoC) ƒ No external hardware ƒ Fit application “perfectly”

6 (MCUs) z CPU Bitwidths: 4 to 64 bits – Most common: 8 bit (4G units) – 32-bit growing fastest z Frequency: DC to 2 GHz z Memory on chip: From 0.5 kB to 5 MB z Power: mW (and up)

Example: Microchip PIC 12CE674 z Memory arch: Harvard z Program memory: 2048 x 14 (OTP/Flash) z EEPROM: 16 bytes z RAM: 128 bytes z ADC channels: 4 (8 bits) z I/O ports: 6 z Timers: One 8-bit, One WDT (watchdog timer) z Clock: onchip crystal, 10MHz z Package: 8 pins (Pentium 4: 700 pins) z Cost: <$1.00 (Pentium 4:>$200.00)

7 Example: Atmel AT91M42800A z ARM7TDMI 32-bit core – Static design: 0 to 33 Mhz z Memory – 8 kB SRAM on chip – External memory interface, 8/16 bit interface z Devices – 6 timers – 2 serial ports z JTAG debug interface z About 0.5 W power z About $18 USD z 144 Pin package z One of 13 AT91variants

Intel 8051 and 8096 Family

ƒ Common microcontrollers: , Motorola 68hc11, or Microchip PIC ƒ a full set of development tools ƒ at the price you can afford, ƒ and good documentation. Good for hobbyists.

ƒ 8051: 8-bit math and control applications ƒ 8096: 16-bit high speed/high performance applications

ƒ Piles of software, both commercial and free, are available for the 8051 line. ƒ Many manufacturers supply what must be a hundred different variants of this chip for any requirement.

8 Hardware features of 8051

ƒ 4 KB on-chip ROM; 128 bytes of on-chip RAM ƒ serial I/O interface; two16-bit timer/counter ƒ Extensive single-bit logic processing capabilities

The 8051-family includes

ƒ the ROM-less 8031; 8751 which has on-chip EPROM. ƒ Many other variations, e.g. Siemens’ 80515 is a superset of 8051 that contains A/D Converter .

Hardware features of 8096

ƒ Fast arithmetic capabilities (6.25 Multiply and Divide)

ƒ High speed I/O (for closed-loop servo control),

ƒ PWM Output; 10-Bit ADC with S/H

ƒ The 8096-family includes the 8796 (8 KB on- chip EPROM), 87196 (16 KB on-chip EPROM).

9 Development Processes

ƒ Macroassemblers (ASM-51, ASM-86, ASM-96)

ƒ Linkers (RL-51, Link86/Loc86, RL-96)

ƒ Object to Hexadecimal converter (OH utility)

ƒ Simulator (eg EMILY-51): A simulator is a software that runs your program on a host machine (such as your PC). You can step through the code to see exactly what is happening as the program runs. A simulator can't support real or devices.

ƒ Emulator (eg V'NICE-51): An emulator is a sophisticated hardware that pretends that it is the itself, while at the same time capturing information. It provides full and total control over your target, while at the same time not requiring any resources from the target.

Note: ƒ Our lab can programme the 87xx MCUs. ƒ Our lab has Emily51 & V'NICE52.

SURVEY OF OTHER FAMILIES TABLE 15.3 SOME MANUFACTURERS OF 8-BIT MICROCONTROLLERS

Manufacturer Web Site

Advanced Micro Devices http://www.amd.com/ California Micro Devices http://www.calmicro.com/ Dallas Semiconductor Group http://www.dalsemi.com/ Fujitsu Microelectronics, Inc. http://www.fujitsu.com/ Harris Semiconductor http://www.semi.harris.com/ Hitachi America, Inc. http://www.hitachi.com/ Intel Corp. http://www.intel.com/ Mitsubishi Electric http://www.mitusbishi.com/ Motorola, Inc. http://www.mot.com/ National Semiconductor Corp. http://www.national.com/ NEC Electronics, Inc. http://www.nec.com/ Oki Semiconductors, Inc. http://www.oki.com/ Philips Components http://www.philips.com/ Rockwell International http://www.rockwell.com/ SGS-Thompson Microelectronics, Inc http://www.st.com/ Siemens Components, Inc. http://www.siemens.com/ Signetics Corp. http://www.signetics.co.kr/ Texas Instruments http://www.ti.com/ Toshiba America http://www.toshiba.com/ Zilog,Inc. http://www.zilog.com/

Look out for the annual edition of the EDN microprocessor directory. This directory is an invaluable aid for designers.

10 Microcontrollers (MCUs)

Zilog ƒ taken an application-specific approach. ƒ e.g. automotive/consumer applications.

Texas Instruments offers the TMS370 family ƒ provides 8 PWM outputs and 6 input captures. ƒ A/D subsystem, two power saving modes, watchdog timer.

Microcontrollers (MCUs)

NEC supplies the μCOM-78K series ƒ a minimum instruction cycle of 333ns ƒ can transfer data between memory and peripherals using a dedicated channel.

Mitsubishi offers the series 740 ƒ includes PWM outputs, LCD drivers, VFF drivers, and 3-V battery operation.

11 Microcontrollers (MCUs)

Dallas Semiconductor supplies the DS5000 ƒ built on an 8051 core. ƒ features a built-in lithium battery to provide nonvolatile registers and RAM.

National Semiconductor’s COP800 family ƒ emphasize industrial ruggedness, eg. against CMOS latch-up.

Microcontrollers (MCUs)

Siemens, Philips, and Signetics offer families based on the 8051 core.

ƒ Philips: most feature-rich collection of 8051- based MCUs. ƒ Atmel: use EEPROM technology. Useful for hobbyists to experiment with.

12 CHOOSING A MICROCONTROLLER

Costs ƒ small difference is significant ƒ software support

Analyzing the application ƒ data processing, I/O, power consumption, memory requirements

Microcontrollers (MCUs)

Data Processing ƒ perform critical calculations? ƒ precision and range of data?

I/O ƒ quantity, amount, and types ƒ serially linked network of low-cost MCUs?

13 Microcontrollers (MCUs)

Power ƒ battery operated? ƒ low-power modes?

Memory ƒ volume of product decides choice of EPROM, OTP, ROM, FLASH. ƒ Write pseudo-code to determine the size of memory. ƒ estimate RAM space as a % of required ROM.

Microcontrollers (MCUs)

What Bit Size? ƒ Cost vs funtions

I/O Throughput ƒ dedicated features for real-time interrupts?

PC Compatible Controller ƒ Intel 386EX: controller version of 80386. ƒ can run PC software such as Windows and its applications.

14 WATCHDOG TIMER

ƒ A watchdog circuit is just a counter. When an overflow happens, the watchdog asserts the system RESET line and the controller resets.

ƒ Under normal operation, the code running in the controller will periodically clear the watchdog counter so that it will not overflow.

ƒ When the controller enters an infinite loop, or gets lost, the controller will fail to hit the watchdog. After a while, the watchdog will overflow .

How to Handle Watchdog Timer?

ƒ Assume hitwd () to be the simplest function possible to hit and reset the watchdog. Can your applications just have calls to hitwd () sprinkled throughout the code?

ƒ When errors occur, CPU may not hang. It often continues to execute the code, but with out-of-sequence or unintended instructions. If the application is calling hitwd () frequently, the watchdog reset may never trip.

ƒ It is also a bad idea to hit a watchdog in an ISR. The main application may fail, but a periodic may still cause the ISR to reset the watchdog.

15 How to Handle Watchdog Timer?

ƒ ISR should first perform a sanity check on the application

z We make use of a virtual watchdog, which is simply a software counter that the application increments and the ISR decrements. – If the virtual watchdog reaches zero, the ISR disables interrupts and enters an infinite loop to wait for the hardware watchdog to reset the processor. – Otherwise, the ISR resets the hardware watchdog.

z If multiple tasks are running concurrently, an array of virtual watchdogs can be used to verify the sanity of each task. – If any task fails, the ISR can determine if the hardware watchdog should be tripped or just deal with the errant task.

How to Handle Watchdog Timer?

ƒ You should also perform a check that ISR is not executed by an errant CPU. Two possibilities: ƒ errant CPU executes instructions while linearly approaching the ISR. ƒ errant CPU branches the execution path into the middle of the ISR code.

ƒ Two safeguards: ƒ The instructions immediately before the ISR should be an infinite loop. Then the CPU will hang and the virtual watchdog will not be serviced. ƒ The first instructions in the ISR should fill a fixed memory location with a sentinel value. Just before the ISR hits the watchdog, the memory location is checked for the proper sentinel value. The last thing the ISR should do is clear the ISR’s memory location.

16 Input Capture Functions

ƒ records the time when an active transition occurred. ƒ can calculate period, frequency, or pulse width

Automobiles: ƒ speed measured by sensors attached to the wheels. ƒ cruise control ƒ anti-skid braking system

Flow-meters: ƒ use spinning turbines to measure fluid flow. ƒ flow rate corresponds to the frequency of the sensor pulses.

Microcontrollers (MCUs)

Figure. Input Capture Sequence

17 Sequence of Operations

ƒ When an edge is detected, the value of the timer is latched ƒ Flag is set. Interrupt generated if interrupt enable bit is set ƒ Program reads the value of latched time, clears flag

Microcontrollers (MCUs) Pulse Width Example

*Listing *Pseudocode to measure pulse width of high pulse

Configure: capture on rising edge Clear capture flag Wait_for_rise If flag == 1, then rise_time = capture time Else repeat wait_for_rise

Configure: capture on falling edge Clear capture flag Wait_for_fall If flag == 1, then fall_time = capture time Else repeat wait_for_fall

Pulse_width = fall_time-rise_time

18 Microcontrollers (MCUs)

Limitations:

ƒ Can't handle short pulses ƒ Remedy: use two input capture functions

ƒ Very long pulses result in timer overflow.

Pulse

Can be in several modes ƒ Measure pulse width in Gated-Time Accumulation Mode ƒ counts up once every 64 clock cycles when its input pin (PAI) is at the active level. ƒ If PAI changes level, it continues counting from where it left off once input returns to the enabling level again.

ƒ Typical applications: flow-meter.

19 Pulse-Width Discriminator

ƒ Distinguish a wide pulse from a narrow pulse. ƒ write a value to counter PACNT that is halfway between the values of the narrow and wide pulse widths. ƒ When a narrow pulse arrives, the edge flag (PEDGE) sets first. ƒ When a wide pulse arrives, the overflow flag sets first.

Microcontrollers (MCUs)

Figure. Pulse Accumulator in Gated-Time Accumulation Mode

20 ASIPs/ASSPs z Application specific integrated/standard processor – Targeting a particular niche market – More targeted than microcontroller – Domain specific accelerators z Usually more upscale – 32 bit processors – Multiprocessors – Expensive peripherals – External memory assumed – Higher performance

Example: Motorola PowerQUICC III

z Target market – Communications – Third generation (3G) mobile network z Processing – PowerPC e500 – 666-1000 Mhz – 256 kB cache z Networking – CPM module, RISC- based z About 160 USD

21 Example: Infineon C167CS z Target Market – Automotive control z Processing – 16-bit C16x core – 4-stage simple pipeline – 40 Mhz operation – 16 MB memory space, including ROM, RAM, z 144 pin package – Tolerates -40 to +125 C z About 25 USD

DIGITAL SIGNAL PROCESSORS

ƒ A DSP application is more math intensive.

ƒ A DSP executes arithmetic instructions faster

ƒ Common applications: PIC control, digital filters, FFTs.

22 DIGITAL SIGNAL PROCESSORS

ƒ main operations is the multiply and accumulate, e.g. in matrix multiplication

c ij = a i 1 b 1 j + a i 2 b 2 j + L + a in b nj

n c ij = ∑ a ik b kj k = 1

ƒA MCU such as the 68HC11 would take a long time to perform many multiply and accumulate operation.

Digital Implementation of audio effects

23 Multiply and Accumulate Using the 68HC16 ƒ 68HC16 is upward-compatible with 68HC11.

ƒ has instructions and internal hardware for DSP capability.

ƒ has extra registers dedicated to multiply and accumulate.

ƒ has extra instructions, e.g. MAC (multiply and accumulate) and RMAC (repeat MAC).

Multiply and Accumulate Using the 68HC16

The MAC instruction multiplies the contents of registers H and I and adds the product to register AM. After this, it loads registers H and I with the next elements to be multiplied. The RMAC instruction repeats MAC the number of times specified by the contents of register E, another new 16-bit register.

24 Multiply and Accumulate Using the 68HC16 ƒ 68HC16 executes MAC in 12 cycles (16.78 MHz )

ƒ RMAC requires 6 + 12*MAC cycles

ƒ modest performance by DSP standards: DSP56000 can do 24-bit multiply, 56-bit accumulate, and load data for the next operation during one clock cycle at 33MHz.

SOME RECENT TRENDS z Complexity trend: a lot of additional functions z Size trend: aim at being as basic as possible, squeezing into small packages to keep costs down z Flash Shifts Design: ROM based units are still the lowest- cost option in high volume, but the flexibility that Flash offers is gaining converts

– provides an opportunity for vendors to differentiate their processors through application-specific software. – Because the programming is in Flash, users can alter the programming to suit their specific situation

25 SOME RECENT TRENDS z See the notes for other features: – 64 bit controllers – high clock speed up to 600 MHz – PSOC – Application specific microcontrollers . z Motes : Interconnected Sensor Networks – seeding forests with a layer of dust to instantly detect and pinpoint the start of a forest fire. – Everything you own will have a tiny ID tag that’ll scream over the radio if it’s stolen. z Embedded Internet: to access and manage the electronic devices we use every day – Networking these devices still cost too much to develop, produce, and purchase

z Over 56% reported just a single processor per product. z four bits refuses to die. z 8- and 16-bit parts continue to hold their own (cost sensitive applications) z A whopping 54% of us use 32 bitters today

26 z big peak for 10 to 99MHz clock rates z 1GHz beauty sucks power z Slower parts ease meeting FCC emissions requirements z Cache needed for rates past 50MHz : costly

27