1 / 19

Introduction

Introduction. Purpose This course introduces basic facts about microcontrollers. Objectives Understand the differences between microcontrollers (MCUs) and microprocessors (MPUs) Obtain an overview of on-chip functions and basic system signals

treva
Download Presentation

Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction Purpose • This course introduces basic facts about microcontrollers. Objectives • Understand the differences between microcontrollers (MCUs) and microprocessors (MPUs) • Obtain an overview of on-chip functions and basic system signals • Learn about the typical questions engineers ask when choosing MCUs for new embedded system designs Content • 19 pages Learning Time • 25 minutes

  2. What is a Microcomputer? • General definition: Small computer capable of performing specific tasks • Examples of tasks: controlling operation and functions of alarm systems, power tools, digital cameras, traffic signals, etc. • Acts as “brain” of an embedded system, executing functions according to stored instructions (application software) • More-specific definition: Computer chip with Central Processing Unit (CPU) – Two classifications • Microprocessor unit (MPU) • Microcontroller unit (MCU)

  3. MPU MCU CLASSIFICATION Device Typically contains only the main processor (CPU core) — no memory for program storage Contains CPU core, memory, peripherals, and I/O integrated System implementation MCU Multiple chips Single chip MPU (Typically, only the CPUCore) Memory IO Peripherals CPUCore Memory Peripherals I/O Processor core (CPU) 32 bits or above 4, 8, 16, or 32 bits Necessary for very complex, high performance and expandable systems Needs external memory & peripherals to accomplish a task Application considerations Self-contained to complete a task with no/few external components Ideal for small, compact, and low-cost systems Application examples Handheld multimedia phone, car navigation system Washing machine, rice cooker, air conditioner Renesas product lines SH-3 and SH-4 series M16C, H8, SH-1, and SH-2 series Differences Between MPUs and MCUs

  4. Main Clock CPU(16-bit H8 type) Sub-Clock RAM I/O ROM PWM I/O Output Port PWM Timer I/O Port I/O Port Timer Timer I/O I/O Port Serial Interface Timer I/O Port Timer WDT I/O Port ADC LCDController Input Port Example: H8/38024 16-bit MCU Typical MCU On-chip Functions • CPU • Memory (RAM and ROM) • Clock(s) • Low-power Modes • Input/Output Ports • Timers & Watchdog Timer (WDT) • Pulse Width Modulator (PWM) • Analog-to-Digital Converter (ADC) • Serial Interface • Bus Controller • On-chip Debug • Other

  5. RISC CISC Instruction execution Fast: 1 instruction/cycle Slower: Many instructions take multiple cycles Code efficiency Lower: Moderate High: Very compact code Processor Core (CPU) • Function • Fetches and executes machine code • Provides levels of code efficiency and performance • Architectural design features • CISC type or RISC type• RISC has fewer instructions • Word size: 4, 8, 16, or 32 bits • Arithmetic Logic Unit for arithmetic and floating point operations • General registers for data processing and temporary storage • Special registers (program counter, stack, conditional, status) to assist in program control • Data bus for interconnections • Operating frequency/clock speed range Voltage dependent • Measuring CPU performance • • MIPS (million instructions per second) • - Number of machine instructions that a computer can execute in one second • - Benchmark tests provide only a rough indication of performance • - Ultimate test is how well the MCU or MPU performs in the actual application

  6. Memory Type Mask ROM PROM/OTP Flash DRAM SRAM Data Retained? Yes Yes Yes No No Reprogram-mable? No No Yes Reads & writes, but temporary storage only Memory (ROM/RAM) • ROM (Read Only Memory) = Non-volatile • Used for program and fixed data storage • Contents retained when power is turned off • Size: from 1KB to 512KB and more • Examples: • Mask ROM • Programmable Read-Only Memory (PROM), also called One-Time Programmable (OTP) • Flash ROM (reprogrammable) • RAM (Random Access Memory) = Volatile • Used for temporary data storage • Contents lost when power is turned off • Size: from 256 bytes to 48KB or more • Examples: • Dynamic RAM (DRAM) — needs refresh • Static RAM (SRAM) — uses less power • Other: Cache — tightly coupled to CPU of high-performance MPUs/MCUs

  7. Main Clock Circuit MCU OSC1 OSC2 Quartz crystal C1 C2 Clocks • Essential for MCU operation • Typically there are two clocks - Main clock • Drives CPU and controls its operation • Can be divided or multiplied for slower or faster operating speed • External design uses crystal and two capacitors • Internal design built with modern technology produces 40MHz with 1% accuracy; saves cost, simplifies design - Sub-clock • Generates a second (lower) frequency that drives CPU in a slower, low-power mode (Standby mode, etc.) • Also used for driving some peripheral functions • Typically a 32.768kHz clock that enables accurate generation of a second frequency via a 16-bit counter

  8. Low-power Modes • Required for portable devices that achieve extended operating time on battery power, as well as many other energy-efficient products • Reduce power consumption by various means • Running at slower speed, such as sub clock (32.768kHz) • Sleep, Sub-active, Standby modes • Shutting off unused peripherals • Module Stop mode In some of the latest MCUs, Standby mode consumes <1µA

  9. Ports: I/O, Input and Output Interface to the “outside world” • I/O ports monitor and control communication between devices • Can be parallel or serial • Input-only ports acquire data from external sensors, etc. • Output-only ports drive external displays and actuators, etc. • High-current (20mA) port • Drives an LED directly • Open-collector/drain port • Interfaces with higher-level supply circuitry • Implements wired-NOR condition MCU Port Types Input/Output (SCI, I2C, etc.) Input only (ADC, etc.) Output only (DAC, LED drive, etc.)

  10. Watchdog Timer Internal Reset Signal Overflow Timers and Watchdog Timer (WDT) • Count clock pulses to control sequences of events or processes • Timers (8-bit or 16-bit) • Measure timing of events or generate output signals • Have various operating modes and features for different applications • Can be cascaded to create larger timers • WDT (Watchdog Timer) • Safeguards MCU by providing safe exit from a malfunctioning program • Must be reset at regular intervals or reset/restart will be generated

  11. Pulse Width Modulator (PWM) • Generates continuous pulses at preset intervals • Width of pulse can be set and varied in response to a control signal • Can be used to drive a motor, light an LED, change power level, etc. PWM Signals PWM Output Control signal sets nominal width of PWM output pulse and causes it to vary

  12. Digitaloutput ADC Analoginput Digitalinput DAC Analogoutput (Serial [PWM] or Parallel) ADCs and DACs Provide interfaces to the analog (real) world • Analog-to-digital converter (ADC or A/D) • Converts analog signal levels to digital values • Important characteristics • Accuracy and Resolution (determined by number of bits: 10, 12, 14…) • Sampling frequency • Conversion technology (successive approximation, delta-sigma, etc.) • Digital-to-analog converter (DAC or D/A) • Converts digital values to analog signal levels • Can be improvised using a low-pass filter after a PWM output

  13. CAN #1 CAN #2 CAN #3 CAN #4 X CAN: a high-integrity, asynchronous serial data communication bus for automotive and industrial applications Accept Accept Prepare Select Select Select Sendmessage Receivemessage Receivemessage Receivemessage CAN bus Serial Interface • Connects MCU to other parts of embedded system or to other systems • Various types • Asynchronous mode (most widely used) • Synchronous mode (has higher transfer rate) • Other examples: USB, I2C, SPI, LIN, CAN • Based on industry standards • Optimized for certain applications • Generally uses only 3 pins • Serial In, Serial Out, and Clock

  14. MCU CPU ExternalMemory (DRAM) RAM ROM Bus Controller Bus Controller • Incorporated in MCUs that must access external memory as well as internal memory • Manages internal and external memory buses • Controls bus communication functions • Refresh for DRAM • Length of wait states • Bus arbitration • Other signal-control tasks

  15. Typical System Debug Setup PC OCD Emulator(Example: Renesas E8) USB I/F Target Board MCU On-Chip Debug (OCD) • Circuitry incorporated in MCU for system development and debugging • JTAG interface commonly used (No standard for JTAG debugging) • Debugger (typically purchased from MCU manufacturer or custom built) • Usually requires only a few device pins to implement MCU control via a “JTAG-like” emulator on a PC • Mode selection • Data in/out • Clock

  16. M16C/28 ADC (AN0, AN1) OSCD Currents 3-phase Motor Control Timer IPM BLDC DCCT Currents ADC (AN2, AN3) INT0 Error Pulse PressureSensor ADC (AN6) Hall Sensors DMA Timer A0 Pulse-width Measurements ADC (AN7) Bus-voltage Sensor INT3 INT4 I/Os TimerA3 LEDs INT5 Other On-chip Functions • Many other peripherals can be integrated to perform specific tasks • LCD controller, power-line communication (PLC), Ethernet MAC, 3-phase motor control timer, DMA, and more • Additional functions enhance fail-safe design of embedded systems • Low-voltage detection (LVD), power-on reset (POR), oscillation-stop detection (OSD) Application example: MCU control of brushless DC motor

  17. System Requirements Application Needs Debugging(Optional) VCC Clock Inputs(keypad, sensors, switches, etc.) Mode MCU Reset Outputs(Control signals, display drive, actuator drives, etc.) Interrupts(Internal) GND Basic Embedded System Signals • Required for MCU/system operation • Power (VCC & GND), Clock, Mode, Reset, and Debugging (optional) • Used by application • Inputs (keypad, switches, sensor data, network communication, etc.) • Outputs (motor control, LCD drive, network communication, actuator energization, etc.)

  18. What System Developers Want 1. Sufficient performance 2. Small code size MCUs that meet the requirements of the application 3. Requisite peripherals 4. Low power consumption 5. Good EMC performance 6. Fail-safe features 7. Good Flash ROM technology Support tools that shorten system development time 8. Good development environment 9. Complete set of SW/HW tools

  19. Course Summary • Differences between MCUs and MPUs • Functions within an MCU • Basic embedded system signals • Questions engineers ask when choosing an MCU For more information, please visit our Web site: www.renesas.com

More Related