Lesson 2:
Microcontrollers
and
Microprocessors
1 © William Kim 2019 Introduction to Embedded Systems
Lecture Outline
• Embedded HW selection
• Definition of a Microprocessor
• Definition of a Microcontroller
• Microprocessor & Microcontroller
Comparison
• STM32 Microcontroller Introduction
2 © William Kim 2019 Introduction to Embedded Systems
Choosing a Microprocessor or
Microcontroller
• Once the purpose of an embedded system
is defined then the appropriate hardware
may be determined
• Some questions to ask to make this
determination:
o What processing power is required?
o What interfaces are required?
o How much storage and memory is required?
o How much power is available?
o Is the products footprint a concern (form/fit requirements)?
o Is the system geared towards a specific task? Or multiple tasks?
o What environment will the system operate under?
3 © William Kim 2019 Introduction to Embedded Systems
Terminology
• Bus
o A set of conductors intended to transmit data, address or control
information
• Instruction Set
o The set of commands that the processor can understand
o Allows the software to interact with the hardware
• Word Size
o Number of bits the processor can processed in a single operation
o Also the number of bits in registers and the internal data bus
• Cache Memory
o Random Access Memory (RAM) that is integrated into the processor
o Stores data and instructions that are frequently accessed
o Much faster than having to go out to external RAM
• Clock Speed
o The rate at which a processor executes instructions/operations
o Typically measured in clock cycles per second
4 © William Kim 2019 Introduction to Embedded Systems
What is a
Microprocessor?
• The Heart of a Computer System
• A Central Processing Unit (CPU)
contained on a single Integrated
Circuit (IC)
• Can be specialized to perform
specific tasks but generally known as
a General Purpose Processor
5 © William Kim 2019 Introduction to Embedded Systems
What does a
Microprocessor contain?
• A Microprocessor contains exactly what one would
think – a processor (or CPU)
o Arithmetical and Logical Unit (ALU)
• Performs arithmetic and logic functions
o Control Unit
• Controls the flow of data and instructions
o Instruction Decoder
• Reads binary data and commands the ALU
o Registers
• Used for calculations and maintaining addressing information
o Cache (accessed via internal data bus)
• Very small amount but also very fast
• All other components are located externally
o No RAM, ROM, I/O Ports, Timers, or Peripherals
6 © William Kim 2019 Introduction to Embedded Systems
A Simple Microprocessor
System
• Microprocessor interfaces externally using
busses
o Data: Passes data to/from the microprocessor and external
resources
o Address: Locations on the chip and memory locations of external
resources
o Control: Initiate and control the transfers of data (read/write)
o All are synchronized via a clock
7
© William Kim 2019 Introduction to Embedded Systems
Why use a
Microprocessor?
• Ability to mix and match external
components and peripherals
• Ability to perform several tasks rather
than a single or few specialized tasks
• Higher processing power (albeit this
comes at a cost of higher energy
consumption)
• More versatile than a microcontroller
8 © William Kim 2019 Introduction to Embedded Systems
Some Popular Microprocessor
Manufacturers
• This is just a small subset of some of
the more popular companies that
manufacture microprocessors:
o AMD
o Intel
o IBM (PowerPC)
o ARM
o Atmel
o Freescale
9 © William Kim 2019 Introduction to Embedded Systems
What is a Microcontroller?
• A microcontroller is a single IC that is
typically used for a specific application
and designed to implement certain tasks
o A “single chip” computer
o Contains all components to perform its task within a single
IC
o Essentially a microcontroller takes inputs, performs some
processing, and performs an action based on the
processing
o A microcontroller contains a microprocessor that usually
has the clock speed scaled down to be just enough for the
task at hand
10 © William Kim 2019 Introduction to Embedded Systems
What does a
Microcontroller Contain?
• CPU
• RAM
• Flash
• Peripherals
(I/O)
• Serial Bus
• Timers
Source: Max Embedded
11 © William Kim 2019 Introduction to Embedded Systems
Why use a
Microcontroller?
• To perform a specific task
• To save money
• To take up less space
• To use less power
• To perform real-time, deterministic
tasks
12 © William Kim 2019 Introduction to Embedded Systems
Some Popular Microcontroller
Manufacturers
• This is just a small subset of some of
the more popular companies that
manufacture microcontrollers:
o Texas Instruments
o Intel
o Freescale
o STMicroelectronics
o ZiLog
13 © William Kim 2019 Introduction to Embedded Systems
Microcontrollers vs
Microprocessors
Microprocessor Microcontroller
Heart of a computer system Heart of an embedded system
Only a processor Processor, RAM, Flash, I/O, etc
Higher power consumption Low power consumption
Higher cost Lower cost
Slower I/O due to external Faster I/O due to internal
components components
Larger footprint (single IC + external Smaller footprint (single IC)
components)
Performs general tasks Performs a specific task
Higher clock speed Lower clock speed
More space / storage Less space / storage
Expandable Not Expandable
14 © William Kim 2019 Introduction to Embedded Systems
B-L475E-IOT01 Discovery
Board
• Utilizes the STM32L475 MCU
• Geared towards Internet of Things (IoT)
• Allows for development of applications
with direct connectivity to the cloud
• Utilizes low power communications
• Contains multiple sensors
• Allows easy expansion via Arduino Uno
V3 and Peripheral Module Interface
(PMOD) connectivity
15 © William Kim 2019 Introduction to Embedded Systems
B-L475E-IOT01 Discovery Board
• Utilizes STM32L475 • 3-axis magnetometer
Microcontroller • 3D
o 80 Mhz
o 1 Mbyte of Flash memory Accelerometer/Gyroscope
o 128 Kbytes of SRAM
• Barometer
• Bluetooth
• Time of Flight / Gesture
• RF
Detection
• Wifi
• Supports Arduino
• NFC
Expansion
• Microphones
• Supports PMOD
• Temperature / Humidity
Sensor Expansion
16 © William Kim 2019 Introduction to Embedded Systems
B-L475E-IOT01 Board Physical Block
Diagram
17 © William Kim 2019 Introduction to Embedded Systems
B-L475E-IOT01 Top View
18 © William Kim 2019 Introduction to Embedded Systems
B-L475E-IOT01 Bottom
View
19 © William Kim 2019 Introduction to Embedded Systems
Homework & Quiz #2
• Download and review the STM32 MCU
Board Datasheet
o Familiarize yourself with the various components of the
board
o https://www.st.com/resource/en/datasheet/stm32l475vg.pdf
• Homework Assignment #2 will consist of:
o Various scenarios to choose a microcontroller or
microprocessor
• This weeks quiz will focus on:
o Microcontrollers and Microprocessors
o STM32 MCU Datasheet + B-L475E-IOT01 User Manual
(from lesson 1)
20 © William Kim 2019 Introduction to Embedded Systems