Advanced Microcontrollers Grzegorz Budzyń Lecture. 1: Introduction

Similar documents
Universität Dortmund. ARM Architecture

Microcontrollers. Microcontroller

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

ELC4438: Embedded System Design Embedded Processor

COMPUTER ORGANIZATION AND ARCHITECTURE

CN310 Microprocessor Systems Design

AVR Microcontrollers Architecture

Embedded Systems Design (630414) Lecture 1 Introduction to Embedded Systems Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

INTEL Architectures GOPALAKRISHNAN IYER FALL 2009 ELEC : Computer Architecture and Design

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

ECE 471 Embedded Systems Lecture 2

ECE 471 Embedded Systems Lecture 2

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

EE 354 Fall 2015 Lecture 1 Architecture and Introduction

Typical Processor Execution Cycle

Embedded Computing Platform. Architecture and Instruction Set

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Computer Organization

Introduction to Microcontrollers

Computer Hardware Requirements for Real-Time Applications

Computer and Hardware Architecture I. Benny Thörnberg Associate Professor in Electronics

Microcomputer Architecture and Programming

Module 2: Introduction to AVR ATmega 32 Architecture

Chapter 5. Introduction ARM Cortex series

COMPUTER STRUCTURE AND ORGANIZATION

ARM Cortex core microcontrollers 3. Cortex-M0, M4, M7

EE 308: Microcontrollers

Microprocessors and Microcontrollers. Assignment 1:

ARM ARCHITECTURE. Contents at a glance:

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Microprocessor Architecture Dr. Charles Kim Howard University

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY COMPUTER ARCHITECURE- III YEAR EEE-6 TH SEMESTER 16 MARKS QUESTION BANK UNIT-1

Slides for Lecture 6

ECE2049 E17 Lecture 4 MSP430 Architecture & Intro to Digital I/O

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

MICROPROCESSOR BASED SYSTEM DESIGN

Memory Models. Registers

In this tutorial, we will discuss the architecture, pin diagram and other key concepts of microprocessors.

Choosing a Micro for an Embedded System Application

CSCE 5610: Computer Architecture

Introduction to Computers - Chapter 4

15CS44: MICROPROCESSORS AND MICROCONTROLLERS. QUESTION BANK with SOLUTIONS MODULE-4

Micro computer Organization

CISC RISC. Compiler. Compiler. Processor. Processor

Computer Architecture

Instruction Set Design

PART A (22 Marks) 2. a) Briefly write about r's complement and (r-1)'s complement. [8] b) Explain any two ways of adding decimal numbers.

MaanavaN.Com CS1202 COMPUTER ARCHITECHTURE

Lecture 4: Instruction Set Architecture

PIPELINE AND VECTOR PROCESSING

EE 4980 Modern Electronic Systems. Processor Advanced

Computer Architecture

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY. Department of Computer science and engineering

ECE 486/586. Computer Architecture. Lecture # 7

Computer organization by G. Naveen kumar, Asst Prof, C.S.E Department 1

ARM Architecture and Assembly Programming Intro

CS1004: Intro to CS in Java, Spring 2005

RISC Processors and Parallel Processing. Section and 3.3.6

BASIC INTERFACING CONCEPTS

A First Look at Microprocessors

Embedded Systems: Hardware Components (part I) Todor Stefanov

Hercules ARM Cortex -R4 System Architecture. Processor Overview

DSP Platforms Lab (AD-SHARC) Session 05

Real instruction set architectures. Part 2: a representative sample

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

ARM Processors for Embedded Applications

Computer Organisation CS303

5 Computer Organization

EC 413 Computer Organization

INTRODUCTION TO MICROPROCESSORS

538 Lecture Notes Week 1

Lecture 1: Introduction to Microprocessors

Latches. IT 3123 Hardware and Software Concepts. Registers. The Little Man has Registers. Data Registers. Program Counter

8051 microcontrollers

Von Neumann architecture. The first computers used a single fixed program (like a numeric calculator).

Introduction to the ARM Architecture. or: a loose set of random facts blatantly copied from tech sheets and the Architecture Ref.

Lecture 4: RISC Computers

5 Computer Organization

Lecture 4: RISC Computers

8051 Overview and Instruction Set

General Purpose Processors

GUJARAT TECHNOLOGICAL UNIVERSITY

Automation Engineers AB Pvt Ltd, NOIDA Job-Oriented Course on Embedded Microcontrollers & Related Software Stack

ARM Ltd. ! Founded in November 1990! Spun out of Acorn Computers

CSEE 3827: Fundamentals of Computer Systems

UNIT I BASIC STRUCTURE OF COMPUTERS Part A( 2Marks) 1. What is meant by the stored program concept? 2. What are the basic functional units of a

Part II Instruction-Set Architecture. Jan Computer Architecture, Instruction-Set Architecture Slide 1

EMBEDDED SYSTEM DESIGN (10EC74)

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

COMP2121: Microprocessors and Interfacing. Introduction to Microprocessors

TMS320C3X Floating Point DSP

EC-801 Advanced Computer Architecture

Proven 8051 Microcontroller Technology, Brilliantly Updated

Microprocessors/Microcontrollers

Fig 1. Block diagram of a microcomputer

Basics of Microprocessor

CPE300: Digital System Architecture and Design

Computer Organization CS 206 T Lec# 2: Instruction Sets

Transcription:

Advanced Microcontrollers Grzegorz Budzyń Lecture 1: Introduction

Plan Introduction Course requirements Workplan for thesemester Firstlecture Basic definitions, Microcontroller, Microprocessor

Introduction Whatisthiscourseabout Whatistheaimofthiscourse

Courserequirements Course consists of: Lecture 2h/week Project 2h/week Courseendswithanexam Course completion requires passing project classandtheexam Theexamwill be heldduringexamination period andwill be oral

Lecture1 Workplanfor thesemster Basic definitions. Embedded systems. Main elements of embedded systems Lecture2 8-bit microcontrollers: AVR family. PIC Micro family Lecture3 8-bit/16-bitmicrocontrollers:8051 family, MSP430 family

Lecture4 Workplanfor thesemster 32-bit microcontrollers: AVR32 and PIC32 family Lecture5 32-bit microcontrollers: ARM family. ARM7, ARM9, ARM11, Cortex M, R, A Lecture6 32-bit microcontrollers: ARM based microcontrollers: STM, NXP

Lecture7 Workplanfor thesemster DSC & PSoCcontrollers Lecture8 DSP processors Lecture 9,10 Serial interfaces: USB, RS232, SPI, I2C, CAN

Workplanfor thesemster Lecture11 ADC anddac Lecture 12,13 RTOS introduction, main parameters Lecture14 RTOS -examples Lecture15 Methods of interfacing ADC and DAC to advanced microcontrollers

Lecture1 Embedded systems Microcontrollers

Embedded systems

Embedded systems Embedded system a system designed to perform/ control specific function in a larger design Often with real time computing constraints (i.e. with predictable response)

Embedded systems

Embedded systems Because Embedded System has defined functionality, thus it can be heavily optimized in order to: Minimize total cost Maximize performance Maximize perfomance/cost ratio

Embedded systems Main elements: Microcontrollers: 8-bit 16-bit 32-bit Digital Signal Processors Digital Signal Controllers FPGA / ASIC programmable logic

Embedded systems Embedded software architecture: Simple control tasks/loops: Used for simples applications Used mostly for 8-bit and 16-bit constructions Efficient (in assembly code even very efficient) Difficult to construct for more complicated tasks

Embedded systems Embedded software architecture: Interrupt based system: Most common type of embedded system software architecture Can be very efficient and rapid in development even for quite complicated tasks/devices Functionality depends greatly on the used microcontroller : Number of serviced interrupt sources Interrupt latency

Embedded systems Embedded software architecture: Simple real-time operating system: Very usable for programming different, nondependent on themselves tasks Very usable for parallel development by a few programmers Timing control & latency control worse than in simpler systems Cooperative or Preemptive multitasking can be used

Embedded systems Embedded software architecture: Monolithic operating system: Large kernel gives programmers an environment similar to a desktop operating systems like MS Windows (WinCE, Win 8 RT), Linux or Android Usable in the largest applications like GPS or cell phones Hardware layer controlled totally by the system applications isolated from the hardware

Microcontroller- basics

Microcontrollers - basics Microcontroller is a combination of a microprocessor and peripheral blocks like: Memory (RAM, ROM, flash) Serial port Ethernet controllers USB controllers ADC DAC etc

Microcontrollers - basics Microprocessor (CPU) inside a microcontroller (MCU) is supervising data transfer berween peripherals over data buses Main advantages of MCUs are: High integration scale Low cost

Microprocessor- operation

Microprocessor - basics Microprocessor: is a programmable device accepts digital input data processes the data according to instructions stored in memory provides results as output operates on symbols represented in binary numeral system

Microprocessor - basics Main elements: Arithmethic Logic Unit Status Register Stack Pointer Program Counter Instruction Decoder Registers / Scratch Memory

Microprocessor - basics

Microprocessor - ALU ALU Arithmetic Logic Unit is the heart of microprocessor Width of A,B and R defines if microprocessor is 8-, 16-, 32- or 64 bits!!!

Microprocessor - ALU Functionality of ALU depends on the paticular realisation Usually it offers: Addition Subtraction Comparison Logical operations Multiplication Division

Microprocessor Status register Status register contains various flags and control bits Flags in the register are modified by different assembly code instructions

Microprocessor Stack Pointer TheStackismainlyused: for storing temporary data for storing local variables for storing return addresses after interrupts and subroutine calls The Stack Pointer Register always points to the top ofthestack the Stack is implemented as growing from higher memory locations to lower memory locations

Microprocessor Program Counter Program Counter (PC) - a special register holding the address of the instruction currently being executed Programcounter is automatically advanced to point to the next instruction in the case of a jump, subroutine call, etc., a new value will simply be loaded into the program counter in order to cause a jump

Microprocessor Instruction decoder Instruction decoder fetches instructions from a proper memory In the next cycle the instructions are decoded and then executed For faster execution pipelining is used

Microprocessor Registers Each CPU consists of a certain number of universal registers They are usually used as temporary storage of data In some CPUs instead of registers a memory is used Access to the registers/momey is much faster than to external memory

Microprocessor program flow

Microprocessor program flow The program control logic and programaddressgenerationlogicworktogetherto provide proper program flow Normally, theflowofa program issequential: the CPU executes instructions at consecutive program-memory addresses Discontinuities are caused by branches, function calls or interrupts

Microprocessor program flow Program execution starts from the address pointed by a special RESET pointer Instructionsareina machinecode i.e. streamof8-, 16-or32b longvalues For simplicity assembly code is used:

Microprocessor memory map

Microprocessor addressing modes

Microprocessor addressing modes Direct Single Register Addressing Direct Register Addressing, Two Registers I/O Direct Addressing Direct Data Addressing Data Indirect with Displacement Data Indirect Addressing Data Indirect Addressing with Pre-decrement

Microprocessor addressing modes Data Indirect Addressing with Post-increment Program Memory Constant Addressing Program Memory Addressing with Postincrement Direct Program Memory Addressing Indirect Program Memory Addressing Relative Program Memory Addressing

DirectSingle Register Addressing Very simple, efficient and fast addressing mode Usableonlyfor accessto register file

Direct Register Addressing, Two Registers Very simple, efficient and fast addressing mode Usableonlyfor accessto register file

I/O Direct Addressing Easyandefficientaccessto I/O memory Access only to limited memory space(6-bit wide)

DirectData Addressing Access to wholememoryspace Instruction takes much more memory Instruction decoding lasts long

Data IndirectwithDisplacementAddressing Target address calculated in dependance on the special addressing-register (Y orz)

Data IndirectAddressing Targetaddresstakefromthespecial addressing-register (X, Y orz)

Data Indirect Addressing with Pre-decrement The content of an addressing register is decremented before use Especially useful in higher level languages

Data IndirectAddressingwithPost-increment The content of an addressing register is incremented after use Especially useful in higher level languages

Program MemoryConstantAddressing Access to program memory(loadingwithlpm or storing with SPM instructions)

Program Memory Addressing with Post-increment Access to program memory(loadingwithlpm or storing with SPM instructions) Z-register incremented after use

DirectProgram MemoryAddressing Program execution continues at the address immediate in the instruction word UsedinJMP andcall instructions

IndirectProgram MemoryAddressing Program execution continues at address contained by the Z-register (i.e., the PC is loaded with the contents of the Zregister)

RelativeProgram MemoryAddressing Program executioncontinuesataddresspc + k + 1. Therelativeaddressk isfrom-2048 to 2047.

Microprocessor- classifications

Microprocessorclassifications SIMD ang. Single Instruction Multiple Data SISD ang. Single Instruction Single Data MIMD ang. Multiple Instruction Multiple Data MISD ang. Multiple Instruction Single Data

Microprocessorclassifications CISC ang. Complex Instruction Set Computers RISC ang. Reduced Instruction Set Computers

Microprocessorclassifications Architectures: Von Neuman Harvard Harvard modified

Microprocessorclassifications SISD features: One data stream One instruction stream Simple construction Reduced efficiency Very popular Most microcontrollers works with this architeture Source: [1]

Microprocessorclassifications MISD features: Many instruction streams Single data stream Parallel operation Many unitsmakesthe same operationon one data Rarely used Source: [1]

Microprocessorclassifications SIMD features: Single instruction stream Many data streams Efficient parallel processing Different data processed in the same way Used in supercomputers, vector coprocessors and DSP Source: [1]

Microprocessorclassifications MIMD features: Many instruction streams Many data streams Efficient parallel processing Many units operates independently and asynchronously Used in computation networks Source: [1]

Microprocessorclassifications CISC architecture: Large number of instructions Small optimization Some instructions need many clock cycles Existance of complex instructions Large number of addressing modes Smallerprocessorclockingas comparedto RISC architecture

Microprocessorclassifications RISC architecture: Reduced number of instructions(even below 30) Most instructions performed in one clock cycyle Instructions simple or very simple Limited access to memory Large number of auxiliary registers

Microprocessorclassifications Von Neumann architecture Source: [2]

Microprocessorclassifications Harvard architecture Source: [2]

8-bits vs16-bits vs32-bits Some remarks: More bits= easier operation with large number of data More bits = less problems with computation errors More bits faster operation

8-bits vs16-bits vs32-bits Some remarks: Simpler processors can be overclocked more easily 32-bit processors are usually fasterbecause that is necessary Smaller processors are very often much more efficient and simpler for programming then their large brothers

Numbers in microcontrollers CPUs natively support only integer numbers signed or unsigned CPU accumulator width defines size of supported numbers: 8b -> [0;0xff] = [0;255] 16b -> [0;0xffff] = [0;65535] 32b -> [0;0xffffffff] = [0;4294967296]

Numbers in microcontrollers Signed integers are usually written in U2 code: i.e. -1 = 0xff -128 = 0x80

Numbers in microcontrollers In CPUs there is problem with non-integer numbers Some CPUs support fractional numbers Some have additional coprocessor (Floating Point Unit FPU) for real numbers calculation

Numbers in microcontrollers Comparison of Integer and Fractional numbers:

Numbers in microcontrollers Integer: 8-bit (Byte) 16-bit (Word) 32-bit (Long) Float: Single precision (float) Double precision (double)

Numbers in microcontrollers Single precision: S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF 0 1 8 9 31 X = ( 1) S 1. F 2 E 127 S sign E exponent bits F - fraction

Numbers in microcontrollers Double precision: S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0 1 11 12 63 X = ( 1) S 1. F 2 E 1023 S sign E exponent bits F - fraction

Endiannes Endiannes is the same as byte-order Big-endian = MSB goes first Little-endian = LSB goes first

Benchmarking

Benchmarking Benchmarking is used for speed comparation of microprocessors and microcontrollers Comparing microprocessors is difficult Comparing microcontrollers is even more difficult itisfairlyeasyto comparecoresbut very hard to compare peripherals!!!

Benchmarking Main measures of microcontrollers core speed are: MIPS DMIPS FLOPS

Benchmarking-MIPS MIPS Millions of Instructions Per Second Simplealgorithmusuallyused speedofnop instruction Comparison of processors speeds requires thorough analysis. The speed of a given CPU is dependent upon many factors: the type of instructions being executed, the execution order and the presence of branch instructions(pipeline!)

Benchmarking-MIPS CPU instruction rates are usuallydifferent from clock frequencies Each instruction usuallyrequire several clock cycles to complete The number of cycles required for instructions to complete is dependent upon the instruction being executed MIPS can be useful when comparing performance between processors made from a similar architecture

Benchmarking-DMIPS DMIPS anothernamefor Dhrystonetype computer speed test Dhrystone is a synthetic computing benchmark intended to be representative of system (integer) programming Thealgorithmiswelldocumentedandcan be made to work on almost any system

Benchmarking-DMIPS DMIPS shortcomings: it features unusual code that is not usually representative of real-life programs it is susceptible to compiler optimizations Dhrystone'ssmall code size may fit in the instruction cache of a modern CPU, so that instruction fetch performance is not rigorously tested

Benchmarking-FLOPS FLOPS - FLoating-point Operations Per Second Measure of floating point arithmetic operation speed of a microcontroller Similarto MIPS but for floatingpoint numbers

Thank you for your attention

References [1] www.wikipedia.org [2] http://www.scribd.com/doc/1532910/von-neumann- Computer-Architecture [3] www.atmel.com