Fundamentals of MCUs Session 1

Embed Size (px)

Citation preview

  • 8/13/2019 Fundamentals of MCUs Session 1

    1/31

    12/02/2013Jacob Beningo

    Introduction to Microcontrollers

    1

    Fundamentals of Microcontrollers(MCUs) : Hands -on Workshop

  • 8/13/2019 Fundamentals of MCUs Session 1

    2/31

    Course Overview

    Introduction to Microcontrollers Selecting the Right Microcontroller

    An Overview of the STM32F4 Discovery Board Digital Signal Processing with the STM32F4 Introduction to Graphics Processing

    2

  • 8/13/2019 Fundamentals of MCUs Session 1

    3/31

    Session Overview

    Introduction to Microcontrollers Common Microcontroller Architectures

    Pipelining An Overview of Peripherals

    3

  • 8/13/2019 Fundamentals of MCUs Session 1

    4/31

    Introduction to Microcontrollers What is a microcontroller?

    A microcontroller is a single chip with a processorcore, embedded memory and input/outputperipherals

    4

  • 8/13/2019 Fundamentals of MCUs Session 1

    5/31

    What are MCUs used for?

    5

    Introduction to Microcontrollers

  • 8/13/2019 Fundamentals of MCUs Session 1

    6/31

    Mobile (Battery Powered) Smaller Form Factors Lower Power Less expensive Cloud Connected IoT Moores Law

    6

    Introduction to Microcontrollers

  • 8/13/2019 Fundamentals of MCUs Session 1

    7/31

    Low Power Operation

    7

    Introduction to Microcontrollers

  • 8/13/2019 Fundamentals of MCUs Session 1

    8/31

    8Introduction to Microcontrollers

    STM32L1x 128 Kbytes Flash die

  • 8/13/2019 Fundamentals of MCUs Session 1

    9/31

    Introduction to Microcontrollers STM32L1

    Full 1.8V 3.6V VDD range functionality @ 32 MHz Aggressive consumption in Stop mode (25 C @ 3.6V) with:

    Stop Mode: 0.57 A Stop Mode + RTC: 1.2 A @ 1.8V Stop Mode + RTC: 1.4 A @ 3.6V

    Aggressive consumption in Standby mode (25 C @ 3.6V) with: Standby Mode: 0.3 A Standby Mode + RTC: 0.9 A @ 1.8V

    Standby Mode + RTC: 1.1 A @ 3.6V Backup register retention (80Bytes)

    I/O leakage: 10nA

  • 8/13/2019 Fundamentals of MCUs Session 1

    10/31

    MCU Supervisor Functions Integrated reset & brown out detection Watchdog timers Internal / External high and low speed clock sources Single voltage supplies Internal programmable regulators

    Results? Smaller form factor Decreased BOM costs

    10

    Introduction to Microcontrollers

  • 8/13/2019 Fundamentals of MCUs Session 1

    11/31

    Introduction to Microcontrollers What peripherals does a microcontroller have?

    11

    I2C SPI CAN LIN Ethernet USB UART LCD

    Controller MPU

    Timers Digital Input / Output Analog to Digital Converters Pulse Width Modulation Input Capture Direct Memory Access (DMA) Capacitive Touch Quadrature decoding Memory Expansion EEPROM or Emulated EEPROM

  • 8/13/2019 Fundamentals of MCUs Session 1

    12/31

    Introduction to Microcontrollers Who manufactures microcontrollers?

    12

  • 8/13/2019 Fundamentals of MCUs Session 1

    13/31

    13

    Introduction to Microcontrollers What makes up a microcontroller?

    Images courtesy of ARM Ltd

  • 8/13/2019 Fundamentals of MCUs Session 1

    14/31

    14

    Memory Architecture - Princeton

  • 8/13/2019 Fundamentals of MCUs Session 1

    15/31

    15

    Memory Architecture - Harvard

  • 8/13/2019 Fundamentals of MCUs Session 1

    16/31

    16

    ARM Architecture

    Images courtesy of ARM Ltd

  • 8/13/2019 Fundamentals of MCUs Session 1

    17/31

    17

    ARM Instruction Set

    Images courtesy of ARM Ltd

  • 8/13/2019 Fundamentals of MCUs Session 1

    18/31

    18

    Pipelining What is pipelining?

    A technique for increasing the number of instructions thatcan be executed in a given period of time

    What does a typical pipe look like?

    Fetch Decode Execute

    Images courtesy of ARM Ltd

  • 8/13/2019 Fundamentals of MCUs Session 1

    19/31

    19

    Pipelining An Example

    Instruction #1Instruction #2Instruction #3

  • 8/13/2019 Fundamentals of MCUs Session 1

    20/31

    20

    Digital Input / Output Digital Logic

    Organized into ports consisting of 8, 16 or 32 pins per port Bidirectional and configurable Logic 0 or 1 Multiplexed with peripheral functions

    Setup Direction (Input or Output) State (High or Low) Function select

    Example Use Drive an LED Control a relay Read a sensor state

  • 8/13/2019 Fundamentals of MCUs Session 1

    21/31

    21

    Timers Timers

    8, 16, 32 bit counters Scalable based on the input clock frequency

    Setup Configure the input clock Setup type of timer

    Use System Tick Measuring timing High Precision Timers for

    SMPS Motor Control

  • 8/13/2019 Fundamentals of MCUs Session 1

    22/31

    22

    Analog to Digital Converters (ADC) Peripheral

    Converts analog signals to digital values Typically 10, 12, 16 bit Sample rates upwards of 5 MHz

    Setup Configure sample rate Setup Polling or ISRs Select channels to sample Convert the channels

    Use Read analog sensors

  • 8/13/2019 Fundamentals of MCUs Session 1

    23/31

  • 8/13/2019 Fundamentals of MCUs Session 1

    24/31

    24

    Memory Protection Unit (MPU) Peripheral

    Isolate memory regions Access permission rules

    Setup Select memory regions Enable ranges See particular datasheet

    Use Operating Systems Task managers

  • 8/13/2019 Fundamentals of MCUs Session 1

    25/31

    25

    UART or SCI Peripheral

    Transmit and Receive lines 8 or 16 bit transfer Up to 11.25 Mbps (115200 std)

    Setup Baud rate setup Configure pins Data in buffer

    Use Tx Data Rx Data

  • 8/13/2019 Fundamentals of MCUs Session 1

    26/31

    26

    Serial Peripheral Interface (SPI) Peripheral

    3 Lines (MOSI, MISO, CLK) Chip Select Up to 45 Mbps

    Setup Select clocks Set Master/Slave Mode

    Use Transferring data off chip Retrieving off chip data

  • 8/13/2019 Fundamentals of MCUs Session 1

    27/31

  • 8/13/2019 Fundamentals of MCUs Session 1

    28/31

    28

    USB Peripheral

    4 or 5 Wire Operation Modes Up to 480 Mbps

    Setup Device, Host, OTG? Use USB framework

    Use Interfacing to high speed devices Interfacing to external storage

  • 8/13/2019 Fundamentals of MCUs Session 1

    29/31

    29

    Display Controllers Peripheral

    Segmented LCD Simple dot matrix SVGA color LCD

    Setup Depends on display Peripheral dependent

    Use Display text data Display basic images

  • 8/13/2019 Fundamentals of MCUs Session 1

    30/31

    2013 Jacob Beningo, All Rights Reserved

    QuestionsContact Info

    Jacob Beningo ( [email protected] )www.beningo.com

    Jacob_Beningo

    Beningo Engineering

    JacobBeningo

    Embedded Basics

    mailto:[email protected]://www.beningo.com/http://www.beningo.com/mailto:[email protected]
  • 8/13/2019 Fundamentals of MCUs Session 1

    31/31

    Next Time in Session 2

    10 Steps to Selecting a Microcontroller What to look for in a Development Kit Hands-on Workshop Tool Setup

    31