You are on page 1of 31

Fundamentals of Microcontrollers (MCUs) : Hands-on Workshop

Introduction to Microcontrollers
12/02/2013 Jacob Beningo

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

Session Overview
Introduction to Microcontrollers Common Microcontroller Architectures Pipelining An Overview of Peripherals

Introduction to Microcontrollers
What is a microcontroller?
A microcontroller is a single chip with a processor core, embedded memory and input/output peripherals

Introduction to Microcontrollers
What are MCUs used for?

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

Introduction to Microcontrollers
Low Power Operation

Introduction to Microcontrollers
STM32L1x 128 Kbytes Flash die

Introduction to Microcontrollers
STM32L1
Full 1.8V 3.6V VDD range functionality @ 32 MHz
Aggressive consumption in Stop mode (25C @ 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 (25C @ 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

Introduction to Microcontrollers
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
What peripherals does a microcontroller have?
Timers Digital Input / Output Analog to Digital Converters

I2C
SPI

CAN LIN Ethernet USB UART LCD Controller MPU

Pulse Width Modulation


Input Capture Direct Memory Access (DMA)

Capacitive Touch
Quadrature decoding Memory Expansion

EEPROM or Emulated EEPROM

11

Introduction to Microcontrollers
Who manufactures microcontrollers?

12

Introduction to Microcontrollers
What makes up a microcontroller?

Images courtesy of ARM Ltd

13

Memory Architecture - Princeton

14

Memory Architecture - Harvard

15

ARM Architecture

Images courtesy of ARM Ltd

16

ARM Instruction Set

Images courtesy of ARM Ltd

17

Pipelining
What is pipelining?
A technique for increasing the number of instructions that can be executed in a given period of time

What does a typical pipe look like?


Fetch Decode Execute

Images courtesy of ARM Ltd

18

Pipelining
An Example

Instruction #1 Instruction #2 Instruction #3

19

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

20

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

21

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

22

Direct Memory Access (DMA)


Peripheral
Efficiently move data throughout the processor

Setup
Select source device Select destination Enable peripheral Await trigger Transfer the data

Use
Transfer data to/from peripheral Move data around in memory
Images courtesy of ARM Ltd

23

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
24

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

25

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
26

I2C
Peripheral
2 wire interface Addressable slaves Master drives clock 1000 kbps

Setup
Select clock Send data

Use
Sensor interfacing
27

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
28

Display Controllers
Peripheral
Segmented LCD Simple dot matrix SVGA color LCD

Setup
Depends on display Peripheral dependent

Use
Display text data Display basic images
29

Questions
Contact Info Jacob Beningo ( jacob@beningo.com ) www.beningo.com Jacob_Beningo

Beningo Engineering
JacobBeningo Embedded Basics

2013 Jacob Beningo, All Rights Reserved

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

You might also like