Embedded Systems and Microcontrollers - NTNU

Embedded Systems and Microcontrollers Dr. Gaute Myklebust Director, Product Development Atmel Corporation 2 ® Atmel Norway -- AVR Microcontroller yAtm...

8 downloads 656 Views 860KB Size
Atmel Norway -- AVR Microcontroller ®

®

y Atmel Norway designs the AVR Microcontroller Family y Predecessor: µRISC ¾ Developed as a Diploma Thesis at NTH (NTNU) ¾ In cooperation with Nordic VLSI

y Used as internal workhorse in several Nordic VLSI ASICs y Processor core acquired by Atmel Corporation autumn 1995 y Atmel Norway started November 1st, 1995

Embedded Systems and Microcontrollers Dr. Gaute Myklebust Director, Product Development Atmel Corporation

2

What is a Microprocessor

®

What is an Embedded System ? ®

y Definitions vary ¾ “An Embedded System is any electronic product that incorporates a microprocessor” ¾ “An Embedded System is a computer that is incorporated into another device, such as a car.”

y Definitions are fairly consistent ¾ “A computer with its entire CPU contained on one integrated circuit.” ¾ “A central processing unit implemented on a single chip.” ¾ “A silicon chip that contains a CPU”

y Examples ¾ ¾ ¾ ¾ ¾

y Common understanding too narrow ¾ Intel Pentium architectures ¾ PowerPC

y Embedded Processors Account for 98% of the world’s microprocessors

Cellular Phones PDAs Cars Washing Machines Battery Chargers

3

What is a Microcontroller ?

®

y y y y y

Processor Core Memories Digital Input/Output Analog Input/Output Peripherals ¾ USART, USB ¾ Timers ¾ And more

Integrates a number of required components in an embedded system.

4

Existing microcontrollers

®

y y y y y y y y y

Atmel AVR Motorola 68HC05, 68HC08, 68HC11, 68HC12 Intel 80C51, 80C251 Hitachi H8/300, H8/500, H8S Microchip PIC16, PIC17, PIC18 ARM7, ARM7T, ARM9, ARM10 Texas Instruments TMS370, MSP430 Mitsubishi M16C, M32C And many more ...

Microcontroller Applications

®

y y y y y y y

Applications in a Car

®

y y y y y y

POS Terminals Cars Battery Chargers Cellular Phones Harddisks Keybords, Mice, … Laser Printers

ABS Anti-spin Instrument Panel Cruise Control Keyless entry Anti-Collision System

Embedded Systems usually incorporate one or several microcontrollers.

AVR Block Diagram

®

Example: ATmega128

®

y y y y y y y y y y

64-pin Device (56 I/O, 8 Special Function) 128 Kbytes ISP Self-programmable Flash 4Kbytes SRAM 4Kbytes EEPROM 10-bit ADC with 8 Multiplexed Inputs Separate 32 kHz Oscillator with RTC Software Selected Clock Frequency UART, SPI, TWI Built-in Emulator support and more ...

9

Peripheral example: A/D converter

®

Peripheral Example: Digital I/O

®

DDRx ADC data register (ADCH/ADCL)

0 Data Bus

Data Bus

ADC Control and Status Register(ADCSR)

Successive approximation logic

Pull-Up

PORTx

0

10-bit DAC

ADC multiplexer select(ADMUX)

8Channel Mux

Analog input

PINx

Physical Pin

X

X

Direction: Pull-Up:

INPUT OFF (Tri-State)

Peripheral Example: Sleep controller ®

C Programming – need Extensions

®

y Idle mode y y y y y y

¾ CPU stopped ¾ Peripherals and oscillator running ¾ Typical power consumption: 10% of execution

y Power down mode ¾ CPU stopped ¾ Peripherals and oscillator stopped ¾ Typical power consumption: 0.01% of execution

Initialization function for Hardware setup Special Function Register (SFR) for I/O access Interrupt functions Monitor functions for critical regions Routines for accessing Flash Intrinsic functions: ¾ SEI, CLI, NOP, OPC, LPM, SLEEP, WDR

y EEPROM access routines ¾ EEPUT, EEGET

y Essential for battery powered applications

13

C Example: SFR / Intrinsics

®

sfrb sfrb

MCUCR = 0x35; GIMSK = 0x3B;

int __low_level_init(void) { GIMSK = 0xC0; /* Enable ext interrupts MCUCR = 0x0F; /* Rising edge enable _SEI(); /* Enable interrupts return(1); }

C Example: Interrupts

®

interrupt[INT0_vect] void myInterruptHandler(void) { unsigned char ucData; ucData = PORTB ; if(ucData & 0x80) { FunCall(ucData); } }

*/ */ */

Developing a Microcontroller ®

Digital Design

®

Specification

Digital design and Verification

y CPU, Interrupt Controller, DMA, Peripheral Functions etc.

Analog design and Verification

y Developed in HDL (Verilog) y Verification on HDL model y Module Reuse and Improvement y IP Modules y HDL synthesis

Digital/analog Co-verification

Lay-out

Verilog Example: always @ ( posedge clk ) begin // Register write if((adr==UCSRB_adr)&iowe) begin rxcie <= `DD dbus[7]; txcie <= `DD dbus[6]; udrie <= `DD dbus[5]; rxen <= `DD dbus[4]; txen <= `DD dbus[3]; chr9 <= `DD dbus[2]; end end

Final Verification

17

18

Analog Design

®

Lay Out

®

y

Memories, ADCs, DACs, Regulators, Oscillators, PADs, etc.

y The Digital Design has been synthesized to a low level representation

y

Analog modules implemented as schematic drawings Digital Interfaces IP Modules Process shrink (libraries) 0.35µ, 0.25µ, 0.18µ, 0.13µ

y The Digital Design has to be merged with the Analog Design

y y y

y The Lay Out must meet performance and size constraints

19

®

Silicon Die

20

New Package Options

®

y AVR Die Sales Program ¾ AVR devices available in Die Form

y Micro Lead Frame Packaging ¾ Low cost package technology ¾ Very good noise immunity substrate connected to ground ¾ Smallest standard package available ¾ Near chip-scale package size; Save up to 69% of board space

TQFP size MLF size TQFP area 9x9 5x5 81 12 x 12 7x7 144 16 x 16 9x9 256 Size in millimeters

MLF 25 49 81

area 31 % 34 % 32 %

Area in mm2

21

®

Development Tools y Complete suite of development tools needed to be made y ANSI compliant C Compilers y Macro-Assemblers y Linkers/Librarians y Debuggers/Simulators y RTOS y In-Circuit Emulators y Evaluation boards y Programmers y Design notes, Application notes and Reference designs

22

STK500 Development Board

®

y y y y

23

Supports all AVR devices Supports all Operating Systems Interfaces with AVR Studio Early support for new devices

24

Emulators ®

®

Battery Charger Reference Design

y Complete C and Assembly Source Code for AT904433 and ATtiny15 y Code library for SLA, NiCd, NiMh and Li-Ion Batteries y Complete Battery Charger design based on Buck Converter y RS-232 Port For General Use

25

26

The Internet ®

®

y Information y Services ¾ Bank services ¾ Shopping

y Remote Control ¾ Smart House, Video, Alarm, Camera

y Automatic ¾ Washing machine ¾ Micro Wave Oven ¾ Refrigerator

27

®

Embedded Internet Toolkit

y Complete reference design for web server y Full TCP/IP stack y Complete modular C-source code y Onboard Ethernet interface

29

28