25
Departamento de Engenharia Inform´ atica UNIVERSIDADE T ´ ECNICA DE LISBOA INSTITUTO SUPERIOR T ´ ECNICO Architectures for Embedded Computing MEIC-A, MEIC-T, MERC Lecture Slides Version 3.0 - English Lecture 21 Title: Microcontrollers and Smart-Cards Summary: Architectures; Examples of current devices. 2010/2011 [email protected]

UNIVERSIDADE TECNICA DE LISBOA - Técnico Lisboa - · PDF filePeripherals (timer, serial port, etc.) are external to the C PU ... Motorola I 8-bit 68HC05 68HC08 68HC11 I 16-bit 68HC12

  • Upload
    buimien

  • View
    222

  • Download
    4

Embed Size (px)

Citation preview

Departamento

de Engenharia

Informatica

UNIVERSIDADE TECNICA DE LISBOA

INSTITUTO SUPERIOR TECNICO

Architectures for Embedded Computing

MEIC-A, MEIC-T, MERC

Lecture Slides

Version 3.0 - English

Lecture 21

Title: Microcontrollers and Smart-Cards

Summary: Architectures; Examples of current devices.

2010/2011

[email protected]

Microcontrollers and Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 1 / 47

Architectures for EmbeddedComputing

Previous Class

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 2 / 47

In the previous class...

� Digital Signal Processors (DSP)

� Architectures

◮ Example: TMS320C55

� Parallelism exploitation (SIMD, VLIW)

◮ Example: TMS320C6x

� DSP market and their future

Road Map

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 3 / 47

Summary

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 4 / 47

Today:

� Microcontrollers & Smart-Cards:

◮ Architectures;

◮ Examples of current devices.

Microcontroller

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 5 / 47

Microcontroller

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 6 / 47

� Processing unit particularly suited to the control of simpleprocedures or devices in embedded systems;

� Processor families:

◮ General Purpose Processors (GPP): transfer anddata manipulation operations (MOVs); conditionalexecution operations (IF ... ELSE ...);

◮ Digital Signal Processors (DSP): mathematicalcomputation (mainly, multiplications);

◮ Microcontrollers: interface with the outside world(peripherals).

� Common applications: control, actuators, instrumentation,etc.

Application examples

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 7 / 47

� Personal appliances:

◮ Cellular phones;

◮ Watches;

◮ Calculators;

◮ PDAs.

� Computer components:

◮ Mouse;

◮ Keyboards;

◮ Modem;

◮ Fax;

◮ Battery charger.

Application Examples

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 8 / 47

� Home appliances:

◮ Alarms;

◮ Thermostats;

◮ Ar conditioners;

◮ Remote controllers;

◮ Most domestic machines.

� Industrial applications:

◮ Industrial robots (manipulators);

◮ Belt conveyor systems;

◮ Lifts;

◮ Automatic control;

◮ Instrumentation.

Application Examples

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 9 / 47

� Car industry:

◮ On-board computer;

◮ Controllers of traction, injection,transmission, break (ABS), etc.;

◮ Air bag;

◮ Air conditioning;

◮ Instrumentation.

� Entertainment:

◮ Video games;

◮ Consoles;

◮ Toys.

GPPs versus Microcontrollers

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 10 / 47

� General Purpose Processors(GPPs):

◮ CPU, Memory and IO inte-grated in a single chip, board orseveral boards.

GPPs versus Microcontrollers

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 10 / 47

� General Purpose Processors(GPPs):

◮ CPU, Memory and IO inte-grated in a single chip, board orseveral boards.

� Microcontrollers:

◮ CPU, Memory, IO andperipherals integrated in asingle chip.

GPPs versus Microcontrollers

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 11 / 47

� General Purpose Processors (GPPs):

◮ High performance CPU, in an independent chip;

◮ Absence of any RAM, ROM and IO modules in the CPU chip:

• The used memory space should be defined and adjustedaccording to each particular application;

◮ Peripherals (timer, serial port, etc.) are external to the CPUchip.

◮◮ Expansible, versatile and general purpose

GPPs versus Microcontrollers

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 12 / 47

� Microcontrollers:

◮ CPU with few resources (e.g.: 8-bits);

◮ RAM, ROM and IO integrated within the CPU chip;

• The available memory space is fixed;

◮ Peripherals integrated within the CPU chip.

◮◮ Suitable for low-cost and restricted (power, HW, etc.)applications

GPPs versus Microcontrollers

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 13 / 47

� Adopted architectures:

◮ Von Neumann architecture:

• Single memory shared by program and data;

• The processor is interconnected by a data and anaddress bus.

◮ Harvard architecture:

• Separated memories for program and data;

• Independent data data and address buses for eachmemory device.

Microcontroller’s CPU and Peripherals

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 14 / 47

� Simple CPU, implemented either with:

◮ Single-cycle state machine;

◮ Control unit with a state machine;

◮ Microprogrammed control unit;

◮ Very simple pipeline.

� On-chip peripherals:

◮ I/O ports;

◮ RAM and ROM memories;

◮ Timer;

◮ Interruptions controller;

◮ USART;

◮ Parallel port; etc.

Microcontrollers Families

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 15 / 47

� Most manufacturers offer a wide set of devices, withdifferent performance levels;

� Processing power: 4-bits, 8-bits, 16-bits, 32-bits:

◮ 8-bits microcontrollers are the most widely adoptedand used by the majority of the applications;

◮ 32-bits and 64-bits are only requested by veryspecialized and reduced markets, with very specificrequisites:

• Communications;

• Signal processing;

• Video processing;

• etc.

Microcontrollers Families

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 16 / 47

� Atmel

◮ AVR

� ARM

� Intel

◮ 8-bit

• 8XC42• MCS48• MCS51• 8xC251

◮ 16-bit

• MCS96• MXS296

� Microchip

◮ 12-bit instruction PIC◮ 14-bit instruction PIC

• PIC16F84

◮ 16-bit instruction PIC

� NationalSemiconductor

◮ COP8

� NEC

� Motorola

◮ 8-bit

• 68HC05• 68HC08• 68HC11

◮ 16-bit

• 68HC12• 68HC16

◮ 32-bit

• 683xx

� SGS/Thomson

◮ ST62

� Texas Instruments

◮ TMS370◮ MSP430

� Zilog

◮ Z8◮ Z86E02

Microcontrollers Market

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 17 / 47

� Market:

◮ About 16 Billions, in 2000;

◮ 8-bits microcontrollers satisfy half of the market needs!

� Dominant microcontrollers:

◮ Microchip 16Fxx

◮ Intel 8051

◮ Motorola MC68HC05

◮ National COP800

◮ SGS/Thomson ST62

◮ Zilog Z86Cxx

Microcontrollers Market

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 18 / 47

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 19 / 47

Intel 8051 microcontroller

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 20 / 47

� 8-bits microcontroller;

� Introduced in the market by Intel (8051) by the end of the1970’s;

� One of the most popular microcontrollers (about 40% of themarket);

� Today, it is produced by several manufacturers in differentformats:

◮ Intel: 8751 microcontroller UV-EPROM

◮ Atmel: AT89C51, Flash (erase before write)

◮ Dallas Semiconductor: DS5000 NV-RAM, RTC

◮ Philips: 8051 AD, DA, extended I/O, OTP and flash

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 21 / 47

� CPU, RAM, ROM, I/O, interrupt logic, timer, etc. in a singlechip;

� 8-bits data bus;

� 16-bits address bus: can accede 216 =64 kB memory positions(RAM and ROM);

� On-chip RAM - 128 bytes (”Data Memory”);

� On-chip ROM - 4 kB (”Program Memory”);

� 4-bytes bi-directional IO port;

� UART (serial port);

� 2 × 16-bit counters/timers;

� Interrupt controller (2 priority levels);

� Low-power mode.

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 22 / 47

� Architecture:

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 23 / 47

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 24 / 47

� Some elements of the 8051 family:

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 25 / 47

� Internal peripherals:

◮ Parallel IO ports;

◮ Clock generator;

◮ Serial port;

◮ Timers;

◮ Interrupt controller.

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 26 / 47

� Parallel IO ports:

◮ Each port can be configured either for input or output;

◮ The direction is defined by special registers.

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 27 / 47

� Serial port:

◮ Data is sent/received serially;

◮ The transmission rate (BAUD rate) and thetransmission mode are configured with specificregisters (SFR).

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 28 / 47

� 2 × internal timer:

◮ Each timer increments the counter at each clock cycle;

◮ The count limit is configured using specific timerregisters (TH0, TL0, TH1, TL1);

◮ The current count value can be read in registers TH0,TL0, TH1, TL1;

◮ At the end of the count:

• An interruption is generated;

• Dedicated bits at SFR register are activated.

Example:Intel MCS-51 Microcontrollers Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 29 / 47

� Interrupt controller:

◮ 5 types of interruption:

• Timer 1 Overflow ;

• Timer 2 Overflow ;

• External interruption 1;

• External interruption 2;

• Serial port event (buffer full, buffee empty, etc.).

◮ Interruptions are activated/inhibited using the SFR register.

Example:Microchip Microcontrollers PIC Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 30 / 47

� Large microcontrollers (PIC)family:

◮ Wide processing capacityoffer:

• 8, 16 or 32 bits;

◮ Several (memory) addressingspaces available:

• RAM

• ROM

• EEPROM

• Flash

◮ Advanced communicationperipherals and protocols.

Example:Microchip Microcontrollers PIC Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 31 / 47

PIC microcontrollers family:

Example:Microchip Microcontrollers PIC Family

Microcontroller

Smart-Cards

Prof. Nuno Roma ACE 2010/11 - DEI-IST 32 / 47

Vast set of peripherals and protocols:

� Communication peripheralsand protocols:

◮ RS232/RS485◮ SPI◮ I2C◮ CAN◮ USB◮ TCP/IP◮ Ethernet

� Control and timer peripherals:

◮ Acquisition and comparison◮ Pulse Width Modulation

(PWM)◮ Counters and timers◮ Watchdogs

� Visual peripherals:

◮ LED drivers◮ LCD drivers

� Analog peripherals:

◮ A/D converters up to12-bits

◮ D/A converters◮ Comparators and sig-

nal amplifiers◮ Voltage detectors◮ Temperature sensors◮ Oscillators◮ Voltage references◮ Voltage regulators

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 33 / 47

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 34 / 47

Smart-Cards - Are they another particular application ofmicrocontrollers?

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 35 / 47

� Appeared in the beginning of the 1970’s, but...

◮ Only by the beginning of the 1980’s were thesupporting technologies developed.

� Two types of cards appeared:

◮ Memory card (without CPU);

◮ Card with microprocessor.

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 36 / 47

� Applications:

◮ Information technology:

• Secure access and user authentication;

• Storage of digital certificates and passwords;

• Encryption of critical data;

◮ Cellular phones (GSM)

• Subscriber authentication;

• Data storage;

◮ e-Commerce:

• e-Banking and e-Payments;

• Identification and access control (tickets);

• Parking;

• Phone credit (decrement of a credit counter).

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 37 / 47

� Smart-Cards WITHOUT microprocessor:

◮ They are usually based on the I2C bus (serial memory);

◮ Typical storage space: 256 Bytes;

◮ EEPROM memory:

• Non-volatile;

• 10.000 write/erase cycles;

• 10ms to write a given cell or a group of cells;

◮ Low cost.

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 38 / 47

� Smart-Cards WITH microprocessor

◮ Processor:

• Usually, 8-bits @ 3.5-5.0 MHz. E.g.: Intel’s 8051;

◮ Memory:

• ROM (16 kBytes - 32 kBytes) for the operating system;

• RAM (256 Bytes - 512 Bytes) for data;

• EEPROM (4 kBytes - 16 kBytes) for persistent data;

• ROM size ≈ 4 × EEPROM size ≈ 16 × RAM size;

◮ File system supported on the installed memory;

◮ Small silicon area (5mm2), due to space and energyrestrictions.

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 39 / 47

� Communication:

◮ Contact-based;◮ Contact-less (transmission with an antena);

� Serial protocol, 9600 bps.

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 40 / 47

� Power-supply:

◮ With battery;

◮ Without battery: the CPU is powered with aninductive circuit.

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 41 / 47

� Cipher algorithms:

◮ Public / Private key algorithms:

• RSA (Rivest-Shamir-Adleman): 1024 bits

• EC-167 (Elliptic Curve Cryptography): 167 bits

◮ Symmetric key algorithms:

• AES (Advanced Encryption Standard)128/192/256 bits

• DES (Data Encryption Standard) 56/112 bits

• SG-LFSR (Shrinking Generator - Linear FeedbackShift Register)

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 42 / 47

� Dedicated commands to support secure / cryptographyprotocols:

◮ Access control:• Examples: check key(), change key()

◮ Authentication:• Examples: autenticate()

◮ Encryption:• Examples: start encription(), stop encription()

◮ Atomic operations:• Examples: exchange(), increment(), decrement()

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 43 / 47

� Other examples:

◮ Key generation to access e-Banking systems:

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 44 / 47

� Other examples: Dallas’ iButton:

Applications:

◮ Access control;

◮ Storage;

◮ Security;

Interface:

◮ Only two wires:

• Power + Data

• Ground

◮ Serial communication:

• 16kbps a 142kbps

Smart-Cards

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 45 / 47

� Other examples: Dallas’ iButton:

Functionality:

◮ Each unit has an unique address;

◮ When existent, the installed micropro-cessor has very scarce resources andis dedicated to the target application(e.g.: encryption engine).

Available models:

◮ Address-only (ID only);

◮ Memory-only;

◮ Real-time clock;

◮ Authentication/encryption key;

◮ Sensor (thermometer, hydrometer);

◮ Data-logger.

Next Class

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 46 / 47

Next Class

Microcontroller

Smart-Cards

Next Class

Prof. Nuno Roma ACE 2010/11 - DEI-IST 47 / 47

� Dedicated architectures:

◮ Application Specific Instruction-set Processors (ASIPs)

� Architectures extensions:

◮ Instruction Set Architecture (ISA) extensions