introduction to ee383 -...

28
EE383: Introduction to Embedded Systems University of Kentucky James E. Lumpp Includes material from: - Jonathan Valvano, “Introduction to ARM Cortex-M Microcontrollers”, Volume 1 Ebook, EE 319K Lecture Notes EE383/Spring 2015/L1 James E. Lumpp 1 Introduction to EE383

Upload: others

Post on 23-Apr-2020

23 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

EE383: Introduction to Embedded Systems University of Kentucky

James E. Lumpp

Includes material from: - Jonathan Valvano, “Introduction to ARM Cortex-M Microcontrollers”, Volume 1 Ebook, EE 319K Lecture Notes

EE383/Spring 2015/L1 James E. Lumpp 1

Introduction to EE383

Page 2: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

EE383/Spring 2015/L1 James E. Lumpp 2

Page 3: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Embedded Systems • An embedded computer system includes a

microcomputer – mechanical, chemical, and electrical devices – specific dedicated purpose, and – packaged as a complete system

EE383/Spring 2015/L1 James E. Lumpp 3

• Applications • communications • automotive • military • medical • consumer • machine control

Page 4: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

“Embedded System” “Microcontroller” “Microprocessor”

• Embedded – “hidden inside so one can’t see it” – computer/processor

EE383/Spring 2015/L1 James E. Lumpp 4

I/O Ports

Microcontroller Electrical,mechanical,

chemical,or

opticaldevices

Embedded system

Bus ADCAnalogsignals

LM3S or LM4F

DAC

Processor

RAM

ROM

Page 5: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

What is a microprocessor?

The microprocessor is the integration of a number of useful functions into a single IC package:

1. The ability to execute a stored set of instructions to

carry out user defined tasks.

2. The ability to be able to access external memory chips to both read and write data from and to the memory.

EE383/Spring 2015/L1 James E. Lumpp 5

Page 6: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

One-Bus Architecture

• Simple Processor Architecture

• IR: Instruction Register • PC: Program Counter • Rx : Operand Registers • Y, Z: ALU registers • MAR: Memory Address

Register • MDR: Memory Data

Register • “Memory Mapped” I/O

EE383/Spring 2015/L1 James E. Lumpp 6

Page 7: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

History of Microprocessors • The first microprocessor was developed by what was then a small company called Intel

(short for Integrated Electronics) in the early 1970s. The chipset was a success and within a short while Intel developed a general purpose 4 bit microprocessor called the 4004.

• In 1974 the more powerful second generation microprocessor (the 8008) was announced fabricated as a single chip. This was quickly followed by the Intel 8080.

• At about the same time Motorola released its first microprocessor, the 6800, which was also an 8 bit processor with about the same processing power as that of the Intel 8080.

• The architectures used in the Intel 8080 and the Motorola 6800 were very different.

• In due course the Intel 8080 core processor was used for a range of microcontrollers (8048 and 8051 to name but two).

• Motorola followed in a similar vein with a range of microcontrollers based on the 6800 (6805, 6808, 6811 which survive to this day).

EE383/Spring 2015/L1 James E. Lumpp 7

Page 8: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

History

EE383/Spring 2015/L1 James E. Lumpp 8

Page 9: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

ARM ISA: Registers, Memory-map

James E. Lumpp EE383/Spring 2015/L1 9

R0R1R2R3R4R5R6R7R8R9

R10R11R12

R13 (MSP)R14 (LR)R15 (PC)

Stack pointerLink register

Program counter

Generalpurpose

registers

TI TM4C123 Microcontroller

256k FlashROM

32k RAM

I/O ports

Internal I/OPPB

0x0000.0000

0x0003.FFFF

0x2000.0000

0x2000.7FFF

0x4000.0000

0x400F.FFFF

0xE000.0000

0xE004.1FFF

Condition Code Bit s Indicates N negative Result is negative Z zero Result is zero V overflow Signed overflow C carry Unsigned overflow

Page 10: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Control Unit

Datapath

ArithmeticLogic Unit

Registers

Processor

Common Bus (address, data, & control)

Memory

ProgramStorage

Data Storage

OutputUnits

InputUnits

Figure 1.1 Computer Organization

EE383/Spring 2015/L1 James E. Lumpp 10

Microcontroller

1. The CPU core 2. Memory (both ROM and RAM) 3. I/O – parallel, serial, analog, digital

Page 11: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Microcontroller Processor – Instruction Set

– CISC vs. RISC Memory Non-Volatile

o ROM o EPROM, EEPROM, Flash

Volatile o RAM (DRAM, SRAM)

Interfaces H/W: Ports S/W: Device Driver Parallel, Serial, Analog, Time

I/O – Memory-mapped vs. I/O mapped

EE383/Spring 2015/L1 James E. Lumpp 11

Page 12: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Microcontroller Die

EE383/Spring 2015/L1 James E. Lumpp 12

Page 13: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

STM

32F1

00C

4T6B

— is

the

smal

lest

mic

roco

ntro

ller

mad

e by

ST

Mic

roel

ectr

onic

s ba

sed

on A

RM

Cor

tex-

M3

core

.

Die

siz

e - 2

854x

3123

µm.

EE383/Spring 2015/L1 James E. Lumpp 13 http://zeptobars.ru/en/read/how-to-open-microchip-asic-what-inside

Page 14: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Texas Instruments TM4C123

EE383/Spring 2015/L1 James E. Lumpp 14

ARM Cortex-M4 + 256K EEPROM + 32K RAM + JTAG + Ports + SysTick + ADC + UART

GPIO Port D

GPIO Port A

ADC2 channels12 inputs12 bits

PA7PA6

PA5/SSI0TxPA4/SSI0RxPA3/SSI0FssPA2/SSI0Clk

PA1/U0TxPA0/U0Rx

PC7PC6PC5PC4

PC3/TDO/SWOPC2/TDI

PC1/TMS/SWDIOPC0/TCK/SWCLK

PE5PE4PE3PE2PE1PE0

GPIO Port C

GPIO Port E

JTAG

FourSSIs

EightUARTs

PB7PB6PB5PB4PB3/I2C0SDAPB2/I2C0SCLPB1PB0

PD7PD6PD5PD4PD3PD2PD1PD0

PF4PF3PF2PF1PF0

GPIO Port B

FourI2Cs

USB 2.0

Cortex M4 SystickNVIC

Two AnalogComparators

Advanced Peripheral Bus

TwelveTimers

Six64-bit wide

CAN 2.0

System Bus Interface

GPIO Port F

Advanced High Performance Bus

Two PWMModules

Page 15: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Embedded Systems • An embedded microcomputer system

– accepts inputs – performs calculations – generates outputs – runs in “real time”

• A real time system – specifies an upper bound on the time required

to perform the input/calculation/output response to external events

EE383/Spring 2015/L1 James E. Lumpp 15

Page 16: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Embedded “Systems”

•Analysis (What?) –Requirements -> Specifications

•Design (How?) –High-Level: Block Diagrams –Engineering: Algorithms, Data Structures, Interfacing

•Implementation(Real) –Hardware, Software

•Testing (Works?) –Validation:Correctness –Performance: Efficiency

•Maintenance (Improve)

EE383/Spring 2015/L1 James E. Lumpp 16

Done • Hardware • Software

• Specifications • Constraints

Analyzethe

problem

New requirements

Highlevel

design

New constraints

Implement-ation

• Call graphs • Data structures • I/O interfaces

Testing

Not doneEngineering

design

• Block diagrams • Data flow graphs

Page 17: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

SW Development Environment

EE383/Spring 2015/L1 James E. Lumpp 17

0x00000142 49120x00000144 68080x00000146 F040000F0x0000014A 6008

Start; direction register LDR R1,=GPIO_PORTD_DIR_R LDR R0,[R1] ORR R0,R0,#0x0F; make PD3-0 output STR R0, [R1]

Source code

Build Target (F7)

DownloadObject code

Processor

Memory

I/O

SimulatedMicrocontroller

Address Data

Editor KeilTM uVision®

Processor

Memory

I/O

RealMicrocontroller

StartDebugSession

StartDebugSession

Page 18: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Development Board

EE383/Spring 2015/L1 James E. Lumpp 18

Page 19: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Servo Motor Control

James E. Lumpp 19 EE383/Spring 2015/L1

Page 20: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

BiPed robot V-3 http://www.instructables.com/id/BiPed-robot-V-3/

James E. Lumpp 20 EE383/Spring 2015/L1

Page 21: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

GPS – Trimble Copernicus SparkFun.com

Cost: 75$ Output: 4800 baud serial (SCI subsystem), NMEA format $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 Where: GGA Global Positioning System Fix Data 123519 Fix taken at 12:35:19 UTC 4807.038,N Latitude 48 deg 07.038' N 01131.000,E Longitude 11 deg 31.000' E 1 Fix quality: 0 = invalid 1 = GPS fix (SPS) 2 = DGPS fix 3 = PPS fix 4 = Real Time Kinematic 5 = Float RTK 6 = estimated (dead reckoning) (2.3 feature) 7 = Manual input mode 8 = Simulation mode 08 Number of satellites being tracked 0.9 Horizontal dilution of position 545.4,M Altitude, Meters, above mean sea level 46.9,M Height of geoid (mean sea level) above WGS84 ellipsoid (empty field) time in seconds since last DGPS update (empty field) DGPS station ID number *47 the checksum data, always begins with * James E. Lumpp 21 EE383/Spring 2015/L1

Page 22: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

GSM Module SparkFun.com

Cost: 50$ Interface: RS232 (UART subsystem) The ADH8066 is a miniature, quad-band GSM 850/EGSM 900/DCS 1800/PCS 1900 module, which can be integrated into a great number of wireless projects. You can use this module to accomplish almost anything a normal cell phone can - SMS text messages, GSM/GPRS, TCP/IP, and more! It also includes a SIM card socket on the back!

James E. Lumpp 22 EE383/Spring 2015/L1

Page 23: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Serial Enabled LCD Display SparkFun.com

Cost: 25$ Interface: RS232 (SCI subsystem) Communication with SerLCD requires 5V TTL serial at a default baud rate of 9600bps (8-N-1). You can adjust the baud to any standard rate between 2400 and 38400bps.

James E. Lumpp 23 EE383/Spring 2015/L1

Page 24: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Robotic Claw SparkFun.com

Cost: 10$ Interface: Servo Motor This robotic claw arm is great for all your gripping needs. They are made from metal and are pretty heavy-duty. The claw opens to about 2" and depending on the servo motor used, it can pick up some relatively heavy objects. Because the arms move parallel to each other, you get a better grip.

James E. Lumpp 24 EE383/Spring 2015/L1

Page 25: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Picaxe Robot - BOT120 SparkFun.com

Cost: 75$ The BOT120 PICAXE 20x2 Microbot is a simple to assemble kit that uses a unique design which requires no soldering of wires to build and/or reconfigure a versatile robot. At the heart of the Microbot is a motherboard which contains a powerful PICAXE 20x2 microcontroller which can be programmed using flowcharts, the 'Logicator for PICAXE' software, or in the PICAXE BASIC language. The Microbot can be programmed on Windows, Linux, and Mac systems.

James E. Lumpp 25 EE383/Spring 2015/L1

Page 26: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

CMOS Camera - 1300x1040 SparkFun.com

Cost: 10$ The TCM8240MD is a high quality, very small 1.3 mega-pixel color camera from Toshiba with the standard data+I2C interface. The nice thing is that we have a complete datasheet on this camera along with a good supplier. This camera is also unique in that it offers on-board JPEG compression.

James E. Lumpp 26 EE383/Spring 2015/L1

Page 27: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

Sensors SparkFun.com

Electret Microphone - $8

9 Degrees of Freedom - Sensor Stick - $100 ADXL345 accelerometer, HMC5843 magnetometer, ITG-3200 gyro.

Flex Sensor 4.5“ - $13

Humidity and Temperature Sensor - DHT22 Infrared Proximity Sensor

Long Range - $15

Methane CNG Gas Sensor - $5

James E. Lumpp 27 EE383/Spring 2015/L1

Page 28: Introduction to EE383 - courses.engr.uky.educourses.engr.uky.edu/ideawiki/data/media/classes/15s/383/1_ee383_… · History of Microprocessors • The first microprocessor was developed

SparkFun.com Modem Long Range 433MHz

Cost: 45$ 433MHz Long Range Radio from HAC. These small modems use a seamless serial interface - whatever enters the TX pin at 9600bps shows up on the other unit's RX pin. All buffering and error detection is handled internally. And the best part - with 10mW output, it reaches over 500m (1600 ft) !

James E. Lumpp 28 EE383/Spring 2015/L1