serial communication protocols

Upload: vissu-sweet

Post on 04-Apr-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Serial Communication Protocols

    1/32

    Serial CommunicationProtocols

    Dedicated to New Learners by13-02-13 K.Viswanath

  • 7/29/2019 Serial Communication Protocols

    2/32

    Mode of Communication Clock Pulse and Its significance.

    Asynchronous and synchronous Protocol. UART(RS232/485/422). SPI(Serial Peripheral Interface).

    I2C(Inter Integrated Circuit). Methods of SW Implementation. Interfacing with Peripherals

    Contenido.

  • 7/29/2019 Serial Communication Protocols

    3/32

    Mode of Communication

  • 7/29/2019 Serial Communication Protocols

    4/32

    Clock Pulse and Its significance

    In electronics and especially synchronous digital circuits, a ClockSignal is a particular type of signal that oscillates between a highand a low state and is utilized like a metronome.

    Metronome is a machine, to coordinate actions of circuits.

    Although the word signal has a number of other meanings, theterm here is used for "transmitted energy that can carry

    information".

    In other words to say which drives other peripherals.

  • 7/29/2019 Serial Communication Protocols

    5/32

    Application

    Mechanical metronome

    A metronome is any device thatproduces regular, metrical ticks(beats, clicks) settable in beats

    per minute.

    These ticks represent a fixed,regular aural pulse.

  • 7/29/2019 Serial Communication Protocols

    6/32

    Difference Asynchronous and

    synchronous

    In asynchronous serial transmission, each character is packaged inan envelope, and sent across a single wire, bit by bit to a receiver.Because no signal lines are used to convey clock (timing)information, this method groups data together into a sequence of bits

    (5-8), then prefixes them with a start bit and appends the data witha stop bit.This is very flexible but has a lot of overhead.

  • 7/29/2019 Serial Communication Protocols

    7/32

    In synchronous transmission, envelop the information, but withmore characters between the start and end sequences.The start and stop bits are replaced with a new format thatpermits greater flexibility. An extra ending sequence is added toperform error checking.Receiver and Transmitter are synchronized by a clock signal,either transmitted over a separate wire. More data can be sentafter a short synchronizing sequence.Which achieves Lower

    overhead and thus,greater throughput.

    Ex: SPI and I2C.

    Difference Asynchronous and

    synchronous

  • 7/29/2019 Serial Communication Protocols

    8/32

    UART(RS232/485/422)

    A Universal Asynchronous Receiver/Transmitter.UARTs are commonly used in conjunction with communication standards such

    as EIA, RS-232, RS-422 or RS-485.The electric signaling levels and methods (such as differential signaling etc.)

    are handled by a driver circuit external to the UART.

  • 7/29/2019 Serial Communication Protocols

    9/32

    Bit Time = 1/Baud Rate

    One frame contains 1+8+1 = Start Bit + Data Byte + Stop bit

    Character framing

    http://en.wikipedia.org/wiki/File:Charactercode.png
  • 7/29/2019 Serial Communication Protocols

    10/32

    RS232

    RS-232(Recommended Standard 232) is a standard for serial binarydata signals connecting between a Data Terminal Equipment (DTE) and aData Communication Equipment (DCE). Significant differences betweenTTL level UART and RS-232 is the voltage level.

    Valid signals in RS-232 are 3 to 15V, and signals near 0V is not avalid RS-232 level.Besides voltage level, the RS-232 also has a few extra pins specificallydesigned for the communication between PC and modem. The pinouts ofthe DB-9 and their functions

  • 7/29/2019 Serial Communication Protocols

    11/32

    RS232 DB9 Connector

    Name Pin Description

    Transmitted Data

    (TxD)

    3 Serial data output

    Received Data

    (RxD)

    2 Serial data input

    Request to Send

    (RTS)

    7 This line informs the DCE (Modem)

    that the DTE (PC) is ready to

    exchange data

    Clear to Send(CTS)

    8 This line indicates that the DCE isready to exchange data

    Data Terminal

    Ready (DTR)

    4 Asserted by DTE to indicate that it is

    ready to be connected

    Data Set Ready

    (DSR)

    6 Asserted by DCE to indicate the DCE

    is powered on and is ready to receive

    commands or data for transmissionfrom the DTE

    Data Carrier

    Detect (DCD)

    1 Asserted by DCE when a connection

    has been established with remote

    equipment

    Ring Indicator

    (RI)

    9 Asserted by DCE when it detects a

    ring signal from the telephone line

  • 7/29/2019 Serial Communication Protocols

    12/32

    interfacing microcontroller to PC

    serial port

  • 7/29/2019 Serial Communication Protocols

    13/32

    RS-422 - RS-485

    RS-422 (also EIA-422) is a technical standard that specifies electricalcharacteristics of a digital signaling circuit. Differential signaling cantransmit data at rates as high as 10 million bits per second, or may besent on cables as long as 1500 meters. Some systems directlyinterconnect using RS-422 signals, or RS-422 converters may beused to extend the range of RS-232 connections. The standard onlydefines signal levels; other properties of a serial interface are set byother standards

    EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining

    the electrical characteristics of drivers and receivers for use in balanceddigital multipoint systems. The standard is published bythe Telecommunications Industry Association/Electronic IndustriesAlliance (TIA/EIA). Digital communications networks implementing theEIA-485 standard can be used effectively over long distances and in

    electrically noisy environments. Multiple receivers may be connected tosuch a network in a linear multi-dro confi uration. These characteristics

  • 7/29/2019 Serial Communication Protocols

    14/32

  • 7/29/2019 Serial Communication Protocols

    15/32

  • 7/29/2019 Serial Communication Protocols

    16/32

    SPI (Serial Peripheral Interface)

    http://en.wikipedia.org/wiki/File:SPI_8-bit_circular_transfer.svg
  • 7/29/2019 Serial Communication Protocols

    17/32

    SPI (Serial Peripheral Interface)

    http://en.wikipedia.org/wiki/File:SPI_timing_diagram2.svg
  • 7/29/2019 Serial Communication Protocols

    18/32

    SPI (Serial Peripheral Interface)

  • 7/29/2019 Serial Communication Protocols

    19/32

  • 7/29/2019 Serial Communication Protocols

    20/32

  • 7/29/2019 Serial Communication Protocols

    21/32

    I2C.

  • 7/29/2019 Serial Communication Protocols

    22/32

  • 7/29/2019 Serial Communication Protocols

    23/32

  • 7/29/2019 Serial Communication Protocols

    24/32

  • 7/29/2019 Serial Communication Protocols

    25/32

  • 7/29/2019 Serial Communication Protocols

    26/32

  • 7/29/2019 Serial Communication Protocols

    27/32

    I2C Bus Arbitration:

  • 7/29/2019 Serial Communication Protocols

    28/32

  • 7/29/2019 Serial Communication Protocols

    29/32

    Methods of SW Implementation

    Polling Method. Interrupt Method. Bit-banging or peripheral in Controller

    SW Development Steps:

    Configuration.

    Reception.

    Transmission. Error Status/Acknowledgement.

  • 7/29/2019 Serial Communication Protocols

    30/32

    SW Development Steps:

    Polling Method.

    Ex: UART: for Transmission :

    while(Transmitter empty flag & UxTCTL){

    // source code lines}

    For Reception mostly Interrupt method is used

    ( either peripheral IO or GPIO interrupt for bit banging)

    Interrupt Method.

    Ex: UART: for Transmission :1. Place the Data into the UART_TxBUFFER_REGISTER

    Enable the Interrupt Flag in the UART Interrupt Register.2. Few code lines will be placed in the Tx Interrupt, to check the

    end of the data Byte.

  • 7/29/2019 Serial Communication Protocols

    31/32

  • 7/29/2019 Serial Communication Protocols

    32/32