EECS 373 Design of Microprocessor-Based Systems

Similar documents
EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

Amarjeet Singh. January 30, 2012

18-349: Introduction to Embedded Real-Time Systems

Serial Communication. Spring, 2018 Prof. Jungkeun Park

Growing Together Globally Serial Communication Design In Embedded System

Basics of UART Communication

Introduction to I2C & SPI. Chapter 22

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

or between microcontrollers)

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Communication Module No: CS/ES/11 Quadrant 1 e-text

Universität Dortmund. IO and Peripheral Interfaces

Serial Communication. Simplex Half-Duplex Duplex

Serial Communication Prof. James L. Frankel Harvard University. Version of 2:30 PM 6-Oct-2015 Copyright 2015 James L. Frankel. All rights reserved.

Design Development and Implementation of SPI

Real-Time Embedded Systems. CpE-450 Spring 06

Sender Receiver Sender

EECS 373 Design of Microprocessor-Based Systems

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

Interfacing Techniques in Embedded Systems

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

UART TO SPI SPECIFICATION

EECS 373 Design of Microprocessor-Based Systems

Raspberry Pi - I/O Interfaces

EECS 373 Design of Microprocessor-Based Systems

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

Microcontroller basics

Serial Interfaces Part 1. ECE 153B Sensor & Peripheral Interface Design Winter 2016

SPI (Serial & Peripheral Interface)

CprE 488 Embedded Systems Design. Lecture 4 Interfacing Technologies

Serial Communications

ELE492 Embedded System Design

Prototyping Module Datasheet

Select a Data Communication Interface

TKT-3500 Microcontroller systems

Integrity Instruments Application Notes. Release 1

EECS 373 Design of Microprocessor-Based Systems

8051SERIAL PORT PROGRAMMING

Embedded Systems and Software

Serial Communications

AN10428 UART-SPI Gateway for Philips SPI slave bridges

Electronics Single wire communication

By: Haron Abdel-Raziq

Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of

Pmod modules are powered by the host via the interface s power and ground pins.

Informatics for industrial applications

Dariusz Makowski Department of Microelectronics and Computer Science tel

MIKROPROCESORY PRO VÝKONOVÉ SYSTÉMY. Serial Data Transmission (Stručný přehled) České vysoké učení technické Fakulta elektrotechnická

SPI Universal Serial Communication Interface SPI Mode

Embedded Systems and Software. Serial Communication

ECE251: Thursday November 8

Part 1 Using Serial EEPROMs

PCI Host Controller 14a Hardware Reference Release 1.2 (October 16, 2017)

Communication. Chirag Sangani

Serial Communication. Simplex Half-Duplex Duplex

McMaster University Embedded Systems. Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016

ISA Host Controller 15a Hardware Reference Release 1.2 (October 16, 2017)

EASY219 / IEC CANopen Master / Slave

ECE 1160/2160 Embedded Systems Design. Midterm Review. Wei Gao. ECE 1160/2160 Embedded Systems Design

I2C a learn.sparkfun.com tutorial

HZX N03 Bluetooth 4.0 Low Energy Module Datasheet

Lecture 5: Computing Platforms. Asbjørn Djupdal ARM Norway, IDI NTNU 2013 TDT

How to create your own peripheral modules for use with the ARC EMSK and embarc

Lecture 25 March 23, 2012 Introduction to Serial Communications

ELEG3923 Microprocessor Ch.10 Serial Port Programming

ECE 471 Embedded Systems Lecture 20

PARALLEL COMMUNICATIONS

An SPI interface for the 65(C)02 family of microprocessors

Digital Circuits Part 2 - Communication

UNIT IV SERIAL COMMUNICATIONS

Learn how to communicate

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Hierarchy of I/O Control Devices

NS9750B-0. Use in conjunction with: Errata , Rev G. Release date: May Phone: Web:

8051 Microcontroller

3.3V regulator. JA H-bridge. Doc: page 1 of 7

Serial Interfacing. Asynchronous Frame

< W3150A+ / W5100 Application Note for SPI >

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4

Introduction. Serial Peripheral Interface (SPI) SPI Basics. Capabilities of SPI

Chapter 11: Input/Output Organisation. Lesson 05: Asynchronous RS232C Serial Port data transfer

To be familiar with the USART (RS-232) protocol. To be familiar with one type of internal storage system in PIC (EEPROM).

MCS-51 Serial Port A T 8 9 C 5 2 1

RS485 3 click. How does it work? PID: MIKROE-2821

Serial communication

Lecture 14 Serial Peripheral Interface

Raspberry Pi. Hans-Petter Halvorsen, M.Sc.

EECS 373 Design of Microprocessor-Based Systems

RS-232 DATA COMMUNICATIONS WITH THE TANDY COLOR COMPUTER

PRACTICAL DESIGN TECHNIQUES FOR SENSOR SIGNAL CONDITIONING

Digital Storage Oscilloscope

Design with Microprocessors

School of Computer Science Faculty of Engineering and Computer Science Student ID Number. Lab Cover Page. Lab Date and Time:

8051 Serial Communication

Bluetooth was originally started as a project by the Ericsson Company.

Multicommunication Type Identifying Debugging Probe

4.3 Digital Communication

Lecture #11 Serial Ports Embedded System Engineering Philip Koopman Wednesday, 17-February-2016

Transcription:

EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Timers Material taken from Dreslinski, Dutta, Le, Ramadas, Smith, Tikhonov & Mahal 1

Agenda A bit on timers Project overview Serial Buses (we won t finish this today, bring slides on Wednesday) Introduction UART SPI I2C 2

Timer Program Hardware Timer //Setup Timer Count: Interrupt ISR //Do Something 3

Virtual Timer Virtual Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Virtual Timer Code //Update Event Queue //Adjust Timer if needed Hardware Timer Count: Interrupt //Setup Timer @D2 Program 3 //Setup Timer @D7 Program 4 //Setup Timer @4 Program 1-Handler //Do Seomthing Program 2-Handler //Do Something Program 3-Handler //Do Something Program 4 -Hanlder //Do Something Virtual ISR //Figure out source bl bl bl bl //Insert new event? //Set new time 4

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 //Setup Timer @D2 Head Ptr Null Hardware Timer Count: Program 3 //Setup Timer @D7 Program 4 //Setup Timer @4 5

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 3 Hardware Timer Count: 3 //Setup Timer @D2 Program 3 //Setup Timer @D7 Program 4 //Setup Timer @4 6

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 3 Hardware Timer Count: 3 //Setup Timer @D2 Program 3 //Setup Timer @D7 5 Program 4 //Setup Timer @4 7

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 3 Hardware Timer Count: 2 //Setup Timer @D2 Program 3 //Setup Timer @D7 5 Program 4 //Setup Timer @4 2 2 Delta 8

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 2 2 Delta Hardware Timer Count: 2 //Setup Timer @D2 Program 3 //Setup Timer @D7 3 Program 4 //Setup Timer @4 5 9

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 2 2 Delta Hardware Timer Count: 2 //Setup Timer @D2 Program 3 //Setup Timer @D7 3 Program 4 //Setup Timer @4 5 7 7 Delta 10

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 2 2 Delta Hardware Timer Count: 2 //Setup Timer @D2 Program 3 //Setup Timer @D7 3 Program 4 //Setup Timer @4 4 5 7 7 Delta 11

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 2 2 Delta Hardware Timer Count: 0 //Setup Timer @D2 Program 3 //Setup Timer @D7 3 Program 4 //Setup Timer @4 4 5 7 7 Delta 12

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 2 2 Delta Hardware Timer Count: 0 //Setup Timer @D2 Program 3 //Setup Timer @D7 3 Virtual ISR //Figure out source //Remove head //Insert new event? //Set new time Program 4 //Setup Timer @4 4 5 7 7 Delta 13

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Head Ptr 2 2 Delta Hardware Timer Count: 0 Program 2 //Setup Timer @D2 Program 3 //Setup Timer @D7 1 Virtual ISR //Figure out source //Remove head //Insert new event? //Set new time Program 4 //Setup Timer @4 2 3 5 7 Delta 14

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 1 Hardware Timer Count: 0 //Setup Timer @D2 Program 3 //Setup Timer @D7 2 Virtual ISR //Figure out source //Remove head //Insert new event? //Set new time Program 4 //Setup Timer @4 2 2 Delta 3 5 7 Delta 15

Event Queue Program 1 //Setup Timer @3 //Setup Timer @5 Program 2 Head Ptr 1 Hardware Timer Count: 1 //Setup Timer @D2 Program 3 //Setup Timer @D7 2 Virtual ISR //Figure out source //Remove head //Insert new event? //Set new time Program 4 //Setup Timer @4 2 2 Delta 3 5 7 Delta 16

Event Queue - Caveats Head Ptr No new event added for one-shot 1 2 Handler may need to loop to handle multiple events at same time 2 2 Delta 3 5 7 Delta 17

Caveats Previous slides assumed scheduling of events all when timer was first set. What if we need to schedule an event and we have already expired some of the timer? Need to update the entire virtual time queue before inserting new event. 18

Agenda Serial Buses Introduction UART SPI I2C Glitches Asynchronous resets and glitches Design rules Set-up and hold time. Review Dealing with external inputs Design rules 19

Serial interfaces ISA Software Hardware EECS 370 fault traps & exceptions SVC# INT# CPU ldr (read) str (write) C Assembly Machine Code interrupts Interrupts System Buses AHB/APB GPIO/INT Timers USART DAC/ADC Internal & External Memory Internal External 20

External memory attaches to the processor via the external memory controller and bus Atmel SAM3U 21

UART Universal Asynchronous Receiver/Transmitter a type of "asynchronous receiver/transmitter", a piece of computer hardware that translates data between parallel and serial forms. UARTs are commonly used in conjunction with communication standards such as EIA, RS-232, RS-422 or RS- 485. The universal designation indicates that the data format and transmission speeds are configurable and that the actual electric signaling levels and methods (such as differential signaling etc.) typically are handled by a special driver circuit external to the UART. Most of the UART stuff (including images) Taken from Wikipedia! 22

Fun with buses A multidrop bus (MDB) is a computer bus in which all components are connected to the same set of electrical wires. (from Wikipedia) In the general case, a bus may have more than one device capable of driving it. That is, it may be a multi-master bus as discussed earlier.

How can we handle multiple (potential) bus drivers? (1/3) Tri-state devices, just have one device drive at a time. Everyone can read though Pros: Cons: Very common, fairly fast, pinefficient. Tri-state devices can be slow. Especially drive-to-tristate? Need to be sure two folks not driving at the same time Let out the magic smoke. Most common solution (at least historically) Ethernet, PCI, etc.

How can we handle multiple (potential) bus drivers? (2/3) MUX Just have each device generate its data, and have a MUX select. That s a LOT of pins. Consider a 32-bit bus with 6 potential drivers.» Draw the figure.» How many pins needed for the MUX? Not generally realistic for an on-pcb design as we ll need an extra device (or a lot of pins on one device) But reasonable on-chip In fact AHB, APB do this.

How can we handle multiple (potential) bus drivers? (3/3) pull-up aka open collector aka wired OR Wire is pulled high by a resistor If any device pulls the wire low, it goes low. Pros: If two devices both drive the bus, it still works! Cons: Rise-time is very slow. Constant power drain. Used in I2C, CAN

Agenda Serial Buses Introduction UART SPI I2C 27

UART Universal Asynchronous Receiver/Transmitter Hardware that translates between parallel and serial forms Commonly used in conjunction with communication standards such as EIA, RS-232, RS-422 or RS-485 The universal designation indicates that the data format and transmission speeds are configurable and that the actual electric signaling levels and methods (such as differential signaling etc.) typically are handled by a special driver circuit external to the UART. Most of the UART stuff (including images) Taken from Wikipedia! 28

Protocol Each character is sent as a logic low start bit a configurable number of data bits (usually 7 or 8, sometimes 5) an optional parity bit one or more logic high stop bits. with a particular bit timing ( baud or baudrate ) Examples 9600-N-8 <baudrate><parity><databits><stopbits> 9600-8-N <baudrate><databits><parity><stopbits> 29

Variations and fun times UART is actually a generic term that includes a large number of different devices/standards. RS-232 is a standard that specifies electrical characteristics and timing of signals, the meaning of signals, and the physical size and pin out of connectors. 30

Signals (only most common) The RXD signal of a UART is the signal receiving the data. This will be an input and is usually connected to the TXD line of the downstream device. The TXD signal of a UART is the signal transmitting the data. This will be an output and is usually connected to the RXD line of the downstream device. The RTS# (Ready to Send) signal of a UART is used to indicate to the downstream device that the device is ready to receive data. This will be an output and is usually connected to the CTS# line of the downstream device. The CTS# (Clear to Send) signal of a UART is used by the downstream device to identify that it is OK to transmit data to the upsteam device. This will be an input and is usually connected to the RTS# line of the upstream device. 31

DB9 stuff DTE vs DCE Pinout of a DCE? Common ground? Noise effects? Wiring a DTE device to a DCE device for communication is easy. The pins are a one-to-one connection, meaning all wires go from pin x to pin x. A straight through cable is commonly used for this application. In contrast, wiring two DTE devices together requires crossing the transmit and receive wires. This cable is known as a null modem or crossover cable. 32

RS-232 transmission example 33

Agenda Serial Buses Introduction UART SPI I2C 34

Introduction What is it? Basic Serial Peripheral Interface (SPI) Capabilities Protocol Pro / Cons and Competitor Uses Conclusion Serial Peripheral Interface http://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/ SPI_single_slave.svg/350px-SPI_single_slave.svg.png

What is SPI? Serial Bus protocol Fast, Easy to use, Simple Everyone supports it

SPI Basics A communication protocol using 4 wires Also known as a 4 wire bus Used to communicate across small distances Multiple Slaves, Single Master Synchronized

Capabilities of SPI Always Full Duplex Communicating in two directions at the same time Transmission need not be meaningful Multiple Mbps transmission speed Transfers data in 4 to 16 bit characters Multiple slaves Daisy-chaining possible

Protocol Wires: Master Out Slave In (MOSI) Master In Slave Out (MISO) System Clock (SCLK) Slave Select 1 N Master Set Slave Select low Master Generates Clock Shift registers shift in and out data

Wires in Detail MOSI Carries data out of Master to Slave MISO Carries data from Slave to Master Both signals happen for every transmission SS_BAR Unique line to select a slave SCLK Master produced clock to synchronize data transfer

Shifting Protocol Master shifts out data to Slave, and shift in data from Slave http://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/spi_8-bit_circular_transfer.svg/400px-spi_8-bit_circular_transfer.svg.png

Diagram Some wires have been renamed Master and multiple independent slaves http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/spi_three_sla ves.svg/350px-spi_three_slaves.svg.png Master and multiple daisychained slaves http://www.maxim-ic.com/appnotes.cfm/an_pk/3947

Pros and Cons Pros: Fast and easy Fast for point-to-point connections Easily allows streaming/constant data inflow No addressing/simple to implement Everyone supports it Cons: SS makes multiple slaves very complicated No acknowledgement ability No inherent arbitration No flow control

Uses Some Serial Encoders/Decoders, Converters, Serial LCDs, Sensors, etc. Pre-SPI serial devices

Summary SPI 4 wire serial bus protocol MOSI MISO SS SCLK wires Full duplex Multiple slaves, master Best for point-to-point streaming data Easily Supported

Agenda Serial Buses Introduction UART SPI I2C Glitches Asynchronous resets and glitches Design rules Set-up and hold time. Review Dealing with external inputs Design rules 46

48

49

50

51

52

53

54

55

56

57

58