87
Team Emertxe Communication Protocols 1

Communication protocols - Embedded Systems

Embed Size (px)

DESCRIPTION

Communication protocols in Embedded Systems. This presentation focused mainly on lower level protocols. Ideal for the beginner to build understanding on these protocols like I2C, USB, SPI etc.

Citation preview

Page 1: Communication protocols - Embedded Systems

Team Emertxe

Communication Protocols 1

Page 2: Communication protocols - Embedded Systems

CommunicationProtocols I

● Introduction

● UART

● SPI

● I²C

● CAN

● USB

Page 3: Communication protocols - Embedded Systems

Introduction

Page 4: Communication protocols - Embedded Systems

Introduction

● What do mean by Communication?

● Mode of Communications

● Type of Communications

● Why Protocols?

Page 5: Communication protocols - Embedded Systems

IntroductionModes of Communication

● Simplex

● Half Duplex

● Duplex

Page 6: Communication protocols - Embedded Systems

UART

Page 7: Communication protocols - Embedded Systems

UART

Page 8: Communication protocols - Embedded Systems

Serial Peripheral Interface

Page 9: Communication protocols - Embedded Systems

SPI

● Introduction

● Interface

● Hardware Configurations

● Data Transmission

– Data Propagation

– Data Validity

Page 10: Communication protocols - Embedded Systems

SPIIntroduction

● Synchronous

● Full Duplex

● Master / Slave

Page 11: Communication protocols - Embedded Systems

SPIInterface

● SCLK● MOSI● MISO● nSS

Page 12: Communication protocols - Embedded Systems

SPIHardware Configuration

Page 13: Communication protocols - Embedded Systems

SPIHardware Configuration

Page 14: Communication protocols - Embedded Systems

SPIHardware Configuration

Page 15: Communication protocols - Embedded Systems

SPIData Transmission

Page 16: Communication protocols - Embedded Systems

SPIData Transmission

Page 17: Communication protocols - Embedded Systems

SPIData Transmission

Page 18: Communication protocols - Embedded Systems

SPIData Transmission

Page 19: Communication protocols - Embedded Systems

SPIData Transmission

Page 20: Communication protocols - Embedded Systems

SPIData Transmission

Page 21: Communication protocols - Embedded Systems

SPIData Transmission

Page 22: Communication protocols - Embedded Systems

SPIData Transmission

Page 23: Communication protocols - Embedded Systems

SPIData Transmission

Page 24: Communication protocols - Embedded Systems

SPIData Validity

Page 25: Communication protocols - Embedded Systems

Inter Integrated Circuits

Page 26: Communication protocols - Embedded Systems

● Introduction to I²C

● I²C Bus Features

● The I²C Bus Protocol

● Bus Speeds

I2C

Page 27: Communication protocols - Embedded Systems

● Synchronous

● Half Duplex

● Multi Master / Slave

I2CIntroduction

Page 28: Communication protocols - Embedded Systems

● Two Line Interface

● Software Addressable

● Multi Master with CD

● Serial, 8 bit Oriented, Bidirectional with 4 Modes

● On Chip Filtering

I2CBus Features

Page 29: Communication protocols - Embedded Systems

● Example

● Signals

● A Complete Data Transfer

I2CProtocol

Page 30: Communication protocols - Embedded Systems

I2CExample

Page 31: Communication protocols - Embedded Systems

● Two-wired Interface

– SDA

– SCL● Wired-AND

● Conditions and Data Validity

● Transmission

I2CSignals

Page 32: Communication protocols - Embedded Systems

I2CSignals – Wired-AND

Page 33: Communication protocols - Embedded Systems

I2CSignals – Conditions and Data Validity

Page 34: Communication protocols - Embedded Systems

I2CSignals – Transmission

● Data on SDA

● Clocking on SCL

● Clock Synchronization

● Data Arbitration

Page 35: Communication protocols - Embedded Systems

I2CSignals – Data on SDA

Page 36: Communication protocols - Embedded Systems

I2CSignals – Data on SDA

Page 37: Communication protocols - Embedded Systems

I2CSignals – Data on SDA

Page 38: Communication protocols - Embedded Systems

I2CSignals – Data on SDA

Page 39: Communication protocols - Embedded Systems

I2CSignals – Data on SDA

Page 40: Communication protocols - Embedded Systems

I2CSignals – Clocking on SCL

Page 41: Communication protocols - Embedded Systems

I2CSignals – Clock Synchronization

Page 42: Communication protocols - Embedded Systems

I2CSignals – Data Arbitration

Page 43: Communication protocols - Embedded Systems

I2CA Complete Data Transfer

Page 44: Communication protocols - Embedded Systems

I2CBus Speeds

● Bidirectional Bus

– Standard Mode - 100 Kbit/s

– Fast Mode - 400 Kbits/s

– Fast Mode Plus - 1 Mbits/s

– High Speed Mode - 3.4 Mbits/s● Unidirectional Bus

– Ultra Fast Mode – 5 Mbits/s● Uses Push-Pull Drivers (No Pullups)

Page 45: Communication protocols - Embedded Systems

Controller Area Network

Page 46: Communication protocols - Embedded Systems

● Introduction to CAN● Basic Concepts● Message Transfer● Message Filtering● Message Validation● Coding● Error Handling● Fault Confinement● Oscillator Tolerance● Bit Timing Requirement

Controller Area Network

Page 47: Communication protocols - Embedded Systems

● Asynchronous● Half Duplex● Multi Master / Slave

CANIntroduction

Page 48: Communication protocols - Embedded Systems

● Example

● Versions

● Absence of node addressing

– Message identifier specifies contents and priority

– Lowest message identifier has highest priority

● Non-destructive arbitration system by CSMA with collision detection

● Simple Transmission Medium

– Twisted pair – CAN H and CAN L

● Properties

● Layered Architecture

CANBasic Concepts

Page 49: Communication protocols - Embedded Systems

CANBasic Concepts - Example

Page 50: Communication protocols - Embedded Systems

CANBasic Concepts - Versions

NOMENCLATURE STANDARDMAX SIGNALING

RATE IDENTIFIER

Low Speed CAN ISO 11519 125 kbps 11 bit

CAN 2.0A ISO 11898:1993 1 Mbps 11 bit

CAN 2.0B ISO 11898:1995 1 Mbps 29 bit

Page 51: Communication protocols - Embedded Systems

● Prioritization of Messages

● Guarantee of Latency Times

● Configuration of Flexibility

● Multicast Reception with Time Synchronization

● System wide Data Consistency

● Multi master

● Error Detection and Error Signaling

● Automatic Retransmission

● Distinction between temporary errors and permanent failures of nodes and autonomous switching off of defect nodes

CANBasic Concepts - Properties

Page 52: Communication protocols - Embedded Systems

CANBasic Concepts - Layered Architecture

Page 53: Communication protocols - Embedded Systems

CANBasic Concepts - Layered Architecture

Page 54: Communication protocols - Embedded Systems

CANBasic Concepts - Layered Architecture

Page 55: Communication protocols - Embedded Systems

CANMessage Transfer

● Frame Formats

– Standard Frame - 11 bits Identifiers

– Extended Frame - 29 bits Identifiers● Frame Types

– Data Frame

– Remote Frame

– Error Frame

– Overload Frame● Frame Fields

Page 56: Communication protocols - Embedded Systems

CANMessage Transfer - Frame Formats

Page 57: Communication protocols - Embedded Systems

CANMessage Transfer – Data Frame

● A data frame consists of seven fields: start-of-frame, arbitration, control, data, CRC, ACK, and end-of-frame.

Page 58: Communication protocols - Embedded Systems

CANMessage Transfer – Remote Frame

● Used by a node to request other nodes to send certain type of messages

● Has six fields as shown in above figure

– These fields are identical to those of a data frame with the exception that the RTR bit in the arbitration field is recessive in the remote frame.

Page 59: Communication protocols - Embedded Systems

CANMessage Transfer – Error Frame

● This frame consists of two fields.

– The first field is given by the superposition of error flags contributed from different nodes.

– The second field is the error delimiter.● Error flag can be either active-error flag or passive-error flag.

– Active error flag consists of six consecutive dominant bits.– Passive error flag consists of six consecutive recessive bits.

● The error delimiter consists of eight recessive bits.

Page 60: Communication protocols - Embedded Systems

CANMessage Transfer – Overload Frame

● Consists of two bit fields: overload flag and overload delimiter

● Three different overload conditions lead to the transmission of the overload frame:

– Internal conditions of a receiver require a delay of the next data frame or remote frame.

– At least one node detects a dominant bit during intermission.

– A CAN node samples a dominant bit at the eighth bit (i.e., the last bit) of an error delimiter or overload delimiter.

● Format of the overload frame is shown in above fig

● The overload flag consists of six dominant bits.

● The overload delimiter consists of eight recessive bits.

Page 61: Communication protocols - Embedded Systems

● Control Field

● Arbitration Field

● Data Field

● CRC Field

● ACK Field

CANMessage Transfer – Frame Fields

Page 62: Communication protocols - Embedded Systems

● The first bit is IDE bit for the standard format but is used as reserved bit r1 in extended format.

● r0 is reserved bit.

● DLC3…DLC0 stands for data length and can be from 0000 (0) to 1000 (8).

CANFrame Fields – Control Field

Page 63: Communication protocols - Embedded Systems

● The identifier of the standard format corresponds to the base ID in the extended format.

● The RTR bit is the remote transmission request and must be 0 in a data frame.

● The SRR bit is the substitute remote request and is recessive.

● The IDE field indicates whether the identifier is extended and should be recessive in the extended format.

● The extended format also contains the 18-bit extended identifier.

CANFrame Fields – Arbitration Field

Page 64: Communication protocols - Embedded Systems

● May contain 0 to 8 bytes of data

CANFrame Fields – Data Field

Page 65: Communication protocols - Embedded Systems

● It contains the 16-bit CRC sequence including CRC delimiter.

● The CRC delimiter is a single recessive bit.

CANFrame Fields – CRC Field

Page 66: Communication protocols - Embedded Systems

● Consists of two bits● The first bit is the acknowledgement bit. ● This bit is set to recessive by the transmitter,

but will be reset to dominant if a receiver acknowledges the data frame.

● The second bit is the ACK delimiter and is recessive.

CANFrame Fields – Ack Field

Page 67: Communication protocols - Embedded Systems

CANError Handling

● Error Detection

– Bit Error

– Stuff Error

– CRC Error

– Form Error

– Acknowledgment Error● Error Signaling

Page 68: Communication protocols - Embedded Systems

CANFault Confinement

● Counters– Transmit Error Counter & Receive Error Counter

Page 69: Communication protocols - Embedded Systems

Universal Serial Bus

Page 70: Communication protocols - Embedded Systems

● Introduction

● Technical Overview

● Interfaces

● Architecture

● Power Managment

● Communication Overview

● Extensions

– OTG

– Wireless

Universal Serial Bus

Page 71: Communication protocols - Embedded Systems

● Asynchronous

● Half Duplex

● Master / Slave

● Offers simple connectivity

● Low cost

● Ease of use

● Manages power efficiently

● Supports all kinds of Data

USBIntroduction

Page 72: Communication protocols - Embedded Systems

● Upstream Connection and Downstream Connection

● Device Speeds

– Low Speed cables at 1.5 Mbps

– Full Speed cables at 12 Mbps and

– High Speed cables at 480 Mbps

– Super Speed upto 5.0 Gbps (Raw throughput)

● Two types of Connectors

– Type A and Type B

– Sizes

● Standard, Mini, Micro

USBTechnical Overview

Page 73: Communication protocols - Embedded Systems

● USB 1.X and 2.0

– Vcc

– D-

– D+

– GND

● USB 3.0

– Older USB interface line plus

– SSTX+/-

– SSRX+/-

USBInterfaces

Page 74: Communication protocols - Embedded Systems

● Follows a Tiered star Topology and consists of

– Host controller

– Hubs

– Peripherals

USBArchitecture

Page 75: Communication protocols - Embedded Systems

USBArchitecture - Bus Topology

Page 76: Communication protocols - Embedded Systems

● Host recognizes the peripheral through a process called Enumerations

● Host communicates with the peripheral to learn its identity and identifies which device driver is required

● Host supplies the peripheral with an address

● Host is the controller of the entire network. e.g. PC

USBArchitecture - Host

Page 77: Communication protocols - Embedded Systems

● Allows many USB devices to share a single USB port

● USB devices with some incorporated intelligence

● Increase the logical and physical fan out

● Single upstream connection and one-many down stream connection

● Smart wire passing data between the peripheral and Host ● Direct connection exists between host and peripherals ● Two kinds of Hubs:

– Bus Powered Hub: Draws power from the host computers USB interface

– Self Powered Hub: Has a built in power supply.

USBArchitecture - Hubs

Page 78: Communication protocols - Embedded Systems

● Receive and respond to the commands from the host. E.g. Mice, Keyboard, Joysticks

● Two types of Peripherals – Standalone– Compound Device

USBArchitecture - Peripherals

Page 79: Communication protocols - Embedded Systems

● Peripherals connected regardless of the power state

● A pair of wires to supply power to the peripherals

● Manage power by enabling and disabling power to devices

● Removes electrically ill behaved systems from the network

USBPower Management

Page 80: Communication protocols - Embedded Systems

● End point is a unique point in the device which is the source or the receiver of the data

● End point has a definite address associated with it

● Codes indicate the type of transfer

● 16 end points within each device each end point has a 4 bit address

● End point “0” reserved for control transfers

USBCommunication Overview

Page 81: Communication protocols - Embedded Systems

● Transactions between the host and end point take place through virtual pipes

● Pipes are logical channels which connect the host to the end points

● Once the communication is established the end points return a descriptor

● Descriptor is a data structure tells the host about the end points configuration and expectations

USBCommunication Overview

Page 82: Communication protocols - Embedded Systems

USB supports four transfer types of data:

● Control Transfers: – Exchange information such as configuration, command

information , set up between host and end point

● Bulk Transfers:– Supports bulk amounts of data when timely delivery isn’t critical.

– e.g. Printers and Scanners

● Isochronous transfers: – Handle transfers like streaming data

● Interrupt transfers:– Poll devices to see if they need service

USBCommunication Overview

Page 83: Communication protocols - Embedded Systems

● USB 2.0

● PictBridge Standard to communicate imaging devices

● Microsoft X box console

● IBM Ultraport

● USB 1.0 OTG

● USB 1.0a supplement OTG

● Wireless USB

USBExtensions

Page 84: Communication protocols - Embedded Systems

● USB On-The-Go Technology is used to provide dual role to the peripherals

● Enables direct communication between the hosts without involving the processor

● Incorporates Mini A , Mini B, Mini AB plugs and receptacles

● Highly complex design

USBOTG

Page 85: Communication protocols - Embedded Systems

Advantages:

● Provides Dual Role Devices

● Introduces new connector types, Mini A, Mini B, Mini AB

● Provides with Aggressive Power Management

On the Go Functionality of the USB can be implemented:

● Using a Full solution Approach

● Using a USB microcontroller

● Designing a custom IC

USBOTG

Page 86: Communication protocols - Embedded Systems

● A Paradigm developed by Cypress that allows devices to be connected but appear as if they are connected to the host over normal USB connectivity

● Addresses many of the Design issues of Wireless networking

● An evolution that relies on familiar and existing technologies

● Desirable for point to point devices

● Features of Wireless USB are its Ease of use, simple connectivity and conservation of the battery power

USBWireless

Page 87: Communication protocols - Embedded Systems

Thank You