architetture e programmazione dei sistemi...

46
ARCHITETTURE E PROGRAMMAZIONE DEI SISTEMI ELETTRONICI INDUSTRIALI T-A Modulo I - Luca Benini DEI Università di Bologna AA 2017-2018

Upload: buihanh

Post on 23-May-2018

213 views

Category:

Documents


1 download

TRANSCRIPT

ARCHITETTURE E PROGRAMMAZIONE DEI

SISTEMI ELETTRONICI INDUSTRIALI T-A

Modulo I - Luca Benini

DEI Università di Bologna

AA 2017-2018

Universität Dortmund

Class Organization• Web: http://courses.eees.dei.unibo.it/LABARCH/2018/

• Teacher: Prof. Luca Benini [email protected] (Prof. Davide Rossi mod. 2)

• Teaching assistant: Dott. Ing. Simone Benatti ([email protected])

• Organization:

– Friday 17-19 Lectures (Benini/Rossi) – Aprl 19 last lecture (Mod 1)

– Thursday afternoon (14-18): LAB2 – Starting 9/3

• Examination:

– Lab Reports + Discussion (Oral)

• Pre-requisites

– Basic digital electronics and logic (i.e. Logic gates, FSMs, Memories, Digital arithmetic) Reti logiche T

– C programming (i.e. pointers, compiler, debugger) Fondamenti di Informatica e Laboratorio T-AB

Universität Dortmund

• Electronics everywhere– Disappearing computer.

– Ubiquitous computing.

– Pervasive computing.

– Ambient intelligence.

– Post-PC era.

• Basic technologies:– Embedded Systems.

– Communication technologies.

Motivation for the Course

Universität Dortmund

Definition

• Embedded system: Any device that includes a programmable computer, but is not itself a general-purpose computer.

• An embedded system has hardware and software parts.

• Take advantage of application characteristics to optimize the design.

• Respond, monitor and control the external environment using sensors and actuators.

Universität Dortmund

Definition (2)

• From Wikipedia:

An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Embedded systems control many of the common devices in use today.

The number of computers per person grows

Mainframe

Mini Computer

Personal Computer

Workstation

Smartphone

Smart Sensors

1 per Enterprise

1 per Company

1 per Professional

1 per person

Ubiquitous

1 per Family

1 per Engineer Laptop

100 – 1000’s per person

log

(p

eo

ple

pe

r c

om

pu

ter)

[Bell et al. Computer, 1972, ACM, 2008]

1950 1960 1970 1980 1990 2000 2010 2020

7

Computer volume shrinks by 100x every decade

Mainframe

Mini Computer

Personal Computer

Workstation

Smartphone

100x smaller every decade

[Nakagawa08]

1 per Enterprise

1 per Company

1 per Professional

1 per person

Ubiquitous

1 per Family

1 per Engineer

Laptop

100 – 1000’s per person

Smart Sensors

1950 1960 1970 1980 1990 2000 2010 2020

Siz

e (

mm

2)

10T

100mm

8

Price falls dramatically, and enables new applications

Mainframe

Mini Computer

Personal Computer

Workstation

Smartphone

1 per Enterprise

1 per Company

1 per Professional

1 per person

Ubiquitous

1 per Family

1 per Engineer

Laptop

100 – 1000’s per person

Smart Sensors

1950 1960 1970 1980 1990 2000 2010 2020

Pri

ces (

US

Do

lla

rs)

100000

0.01

Number Crunching

Data Storage

The Internet of Things—some popular projections

What is driving the embedded explosion?

Moore’s Law (a statement about economics):IC transistor count doubles every 18-24 months

Photo Credit: Intel

Dennard Scaling made transistors fast and low-power:

So everything got better!

Radio technologies enabling pervasive computing

Source: Steve Dean, Texas Instruments

http://eecatalog.com/medical/2009/09/23/current-and-future-trends-in-medical-electronics/

Bell’s Law: A new computer class every decade

“Roughly every decade a new, lower priced computer class

forms based on a new programming platform, network,

and interface resulting in new usage and the establishment of a

new industry.”

- Gordon Bell [1972,2008]

Technology Scaling

• Moore’s Law– Made transistors cheap

• Dennard’s Scaling– Made them fast

– And low-power

• Result– Holding #T’s constant

• Exponentially lower cost

• Exponentially lower power

– Small, cheap & low-power

• Microcontrollers

• Memory

• Radios

Technology Innovations

• MEMS technology– Micro-fabricated sensors

• New memories– New cell structures (11T)

– New tech (FeRAM, FinFET)

• Near-threshold computing– Minimize active power

– Minimize static power

• New wireless systems– Radio architectures

– Modulation schemes

• Energy harvesting

What is driving Bell’s Law?

Source: Joe Cross, DARPA MTO

Typical Embedded System Challenges (1-2)

• Small Size, Low Weight

– Handheld electronics

– Transportation applications weight costs money

• Low Power

– Battery power for 8+ hours (laptops often last only 2 hours)

– Limited cooling may limit power even if AC power available

Slides from CMU course 18-349, Anthony Rowe

Typical Embedded System Challenges (2-2)

• Harsh environment

– Heat, vibration, shock

– Power fluctuations, RF interference, lightning

– Water, corrosion, physical abuse

• Safety-critical operation

– Must function correctly

– Must not function incorrectly

• Extreme cost sensitivity

– $.05 adds up over 1,000,000 units

Slides from CMU course 18-349, Anthony Rowe

CPU: An All Too Common View of Computing

• Measured by: Performance

CPU

An Advanced Computer Engineer's View

• Measured by: Performance

• Compilers matter too...

CPU

On-chip Mem Off-Chip Mem

An Enlightened Computer Engineer's View

• Measured by: Performance, Cost • Compilers & OS matter

CPU

On-Chip Mem Off-Chip Mem

I/O

Microcontroller

An Embedded Computer Designer's View

• Measured by: Cost, I/O connections, Memory Size, Performance

CPU

On-chip Mem

Memory

I/OMMI

D/AA/D

An Embedded Application Designer's View

• Measured by: Cost, Timetomarket, Cost, Functionality, Cost & Cost.

CPU

On-chip Mem

Memory

I/OMMI

D/AA/D

Microcontroller

Sensors Actuator

Diagnostic

toolsAuxiliary Systems

(power, cooling)

External

Environment

Electro-mechanical

backup and safety

Modern Embedded Systems View

• Measured by: Does it actually work? (and all of the other stuff)

CPU

On-Chip Mem

Memory

I/OMMI

D/AA/D

Microcontroller

Sensors Actuator

Auxiliary Systems

(power, cooling)

Diagnostic

tools

External

Environment

Electro-mechanical

backup and safety

CPU

On-chip Mem

Memory

I/OMMI

D/AA/D

Microcontroller

Sensors Actuator

Auxiliary Systems

(power, cooling)

Diagnostic

tools

External

Environment

Electro-mechanical

backup and safety

CPU

On-chip Mem

Memory

I/OMMI

D/AA/D

Microcontroller

Sensors Actuator

Auxiliary Systems

(power, cooling)

Diagnostic

tools

External

Environment

Electro-mechanical

backup and safety

Network

Network

Network

Distributed!

Embedded Computers Rule the Marketplace

• ~80 Million PCs vs. ~3 Billion Embedded CPUs annually – Embedded market growing; PC market mostly saturated

• Domain Experts Needed…– General Computing

• Set-top boxes, video game consoles, ATM, …

– Control Systems• Airplane, Heating and Cooling System

– Signal Processing• Radar, Sonar, Video Compression, Human-Brain interface

– Communication• Internet, Wireless Communication, VoIP…

Misconceptions (1)

• Embedded systems = low end microcontrollers

Slides from CMU course 18-349, Anthony Rowe

Misconceptions (2)

• Embedded system programing = programming in assembly to optimize the code for space, time etc.

• Compilers are typically better then humans at generating the best code

• Code portability issues -> some device-driver dependent code written in assembly, but most app code is written in higher-level languages

Slides from CMU course 18-349, Anthony Rowe

Misconceptions (3)

• Embedded systems = old topic

• Always new and exciting developments that track technology

– New sensors / actuators

– More powerful chips

– New communication mechanisms

• Embedded systems + Internet = Internet of Things

– Massively hot topic right now!

Slides from CMU course 18-349, Anthony Rowe

Specifications for an embedded system

Inputs: What data will be collected, what are the controls?

Outputs: What will be transmitted, displayed, or controlled?

Sample rate: What interval does it need to collect data?

Communication: What data needs to be sent and received, how?

Storage: What data needs to be stored and for how long?

Processing: What processing needs to be done on the data?

Power: How long does it need to last between charges?

Form factor: How will the device fit into the physical world?

Cost: How much will the users be willing to pay?

Case study: motion tracking

Inputs: IMU sensor data collected by an MCU via serial interface

Outputs: Motion trajectory output at 1-60Hz with mm accuracy

Sample rate: varies, but around 1KHz

Communication: 1KHz*???

Storage: How much buffering do we need on the target device?

Processing: Are we computing locally or in the cloud?

Power: Powered by battery ideally, but can we?

Form factor: Small enough to be mounted on a human body

Cost: ~$500

Motion tracking hardware platform

MIMO WiFitransmitter

Xsens IMU

MPU9250 IMU

SPI

I2C

Programmer Serial port

WiFi receiver & computer

Motion tracking algorithms

Motion tracking hardware platform

IMU sensor: connects to the MCU via I2C and SPI serial interface

MCU: AtMega 328 that connects to the IMU sensor and the WiFi radio

MIMO WiFi radio: Intel 5300 MIMO WiFi card

Intel NUC: runs Ubuntu OS, controls the WiFi radio, and connects to the

MCU via serial port

WiFi receiver: Receive WiFi packets, extract IMU sensor data, and does

motion tracking using IMU sensor data + WiFi radio

Universität Dortmund

• Embedded devices can be found everywhere in large numbers!

• Most new devices are using 32-bit processors.

• The C family (C, C++, C#) is the most widely used language for embedded systems.

– Simpler systems often are matched by simpler languages…

Summary

34Alberto Macii - Politecnico di Torino

Universität Dortmund

Implemementing Embedded

Systems: ARM MCUs

Gra

phic

s: ©

Ale

xandra

Nolte,

Gesin

e M

arw

edel, 2

003

Universität Dortmund

Options for Building Embedded Systems

Dedic

ate

d H

ard

ware

Soft

ware

Runnin

g o

nG

eneric H

ard

ware

Implementation DesignCost

Unit Cost

Upgrades& Bug

Fixes

Size Weight Power SystemSpeed

Discrete Logic low mid hard large high ? very fast

ASIC high ($500K/ mask set)

very low hard tiny - 1 die very low low extremely fast

Programmable logic –FPGA, PLD

low to mid mid easy small low medium to high very fast

Microprocessor + memory + peripherals

low to mid mid easy small to med. low to moderate medium moderate

Microcontroller (int. memory & peripherals)

low mid to low easy small low medium slow to moderate

Embedded PC low high easy medium moderate to high medium to high fast

Universität Dortmund

ARM Processors Families

37

Universität Dortmund

STM32 product series7 product series

High-performance Cortex™-M4 MCU

STM32 F4 series

STM32 F4 series:

Most powerful Cortex-M

Key features

STM32 F4 series

High-performance digital signal controller

Single precision

Ease of use

Better code efficiency

Faster time to market

Eliminate scaling and saturation

Easier support for meta-language tools

FPU

Harvard architecture

Single-cycle MAC

Barrel shifter

DSP

Ease of use of C

programming

Interrupt handling

Ultra-low power

MCU

Cortex-M4

What is Cortex-M4?

STM32 F4 series – applications served

Points of sale/inventory management

Industrial automation and solar panels

Transportation

Medical

Building

Security/fire/HVAC

Test and measurement

Consumer

Communication

Universität Dortmund

STM32 Market

STM32 F4 block diagram

Features highlight

168 MHz Cortex-M4 CPU

Floating point unit (FPU)

ART Accelerator TM

Multi-level AHB bus matrix

1-Mbyte Flash,

192-Kbyte SRAM

1.7 to 3.6 V supply

RTC: <1 µA typ, sub second

accuracy

2x full duplex I²S

3x 12-bit ADC

0.41 µs/2.4 MSPS

168 MHz timers

http://www.st.com/content/st_com/en/products/mi

crocontrollers/stm32-32-bit-arm-cortex-

mcus/stm32f4-series/stm32f407-

417/stm32f407vg.html

Important doc:

1. Datasheet, 2. Reference Manual, 3.

Programmer manual….

Evaluation board for full product feature evaluation

Hardware evaluation platform for all interfaces

Possible connection to all I/Os and all

peripherals

Discovery kit for cost-effective evaluation and

prototyping. Available on http://it.rs-online.com for

18.72€

Large choice of development IDE solutions from the

STM32 and ARM ecosystem

Lab Board and Tools

STM32F407G-DISC1

Universität Dortmund

46

STM32 Discovery Kit • STM32F407VGT6 microcontroller featuring 32-bit

ARM Cortex®-M4 with FPU core, 1 MB Flash memory, 192 KB RAM in an LQFP100 package

• On-board ST-LINK/V2 with selection mode switch to use the kit as a

standalone ST-LINK/V2 (with SWD connector for programming and

debugging)

• Board power supply: through USB bus or from an external 5 V supply

voltage

• External application power supply: 3 V and 5

• LIS302DL or LIS3DSH ST MEMS 3-axis accelerometer

• MP45DT02 ST MEMS audio sensor omni-directional digital microphone

CS43L22 audio DAC with integrated class D speaker driver

• Eight LEDs:

• LD1 (red/green) for USB communication

• LD2 (red) for 3.3 V power on

• Four user LEDs, LD3 (orange), LD4(green), LD5 (red) and LD6

(blue)

• 2 USB OTG LEDs LD7 (green) VBus

• LD8 (red) over current

• Two push buttons (user and reset)

• USB OTG FS with micro-AB connector

• Extension header for all LQFP100 I/Os for quick connection to

prototyping board and easy probing

• Comprehensive free software including a variety of examples, part of

STM32CubeF4 package or STSW-STM32068 for legacy standard

libraries usage