Essentials of Communication This simple model requires many guarantees. Sender Receiver Communication Link Data.

Slides:



Advertisements
Similar presentations
INPUT-OUTPUT ORGANIZATION
Advertisements

Serial Communications Interface (SCI) Michael LennardZachary PetersBao Nguyen.
Anurag Dwivedi Rudra Pratap Suman. Scope of Communica tion Telephones and Cell Phones.
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Bits and Bytes + Controlling 8 LED with 3 Pins Binary Counting and Shift Registers.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Serial I/O - Programmable Communication Interface
1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Guest Lecturer Pat Pannuto Lecture 10: Serial buses Oct 6, 2011.
Embedded Systems I2CI2C. Feature 3 wire GND SCL(clock) SDA(data) All devices share the same bus wire Using wire and, each device gain access to bus (become.
Serial Interfaces, Part Deux -I 2 C and SPI December 4, 2002 Presented by Eugene Ho.
Lecture 8: Serial Interfaces
Serial Communication Buses: I 2 C and SPI By Brody Dunn.
Serial Peripheral Interface (SPI)
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Input/Output and Communication
Haptic Belt team Informational Presentation.  I 2 C is a form of control bus (multi-master) which allows communication between multiple integrated circuits.
INPUT-OUTPUT ORGANIZATION
Interfaces A practical approach. Lesson 2 I2C and SPI
1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Lecture 10: Serial buses Oct 6, 2011.
1 © Unitec New Zealand I2C Lecture 10 Date: - 2 Nov, 2011 Embedded Hardware ETEC 6416.
Serial Peripheral Interface (SPI) Bus. SPI Bus There is no official specification for the SPI bus. It is necessary to consult the data sheets of the devices.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
4.0 rtos implementation part II
Input/Output mechanisms
7/23 Inter-chip Serial Communication: SPI and I 2 C Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
Lecture Set 9 MCS-51 Serial Port.
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
Universal Asynchronous Receiver/Transmitter (UART)
Scott Baker Will Cross Belinda Frieri March 9 th, 2005 Serial Communication Overview ME4447/6405.
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK
Universal Asynchronous Receiver/Transmitter (UART)
Microprocessor based Design for Biomedical Applications MBE 3 – MDBA XI : Project Outlooks.
©2008 R. Gupta, UCSD COSMOS Summer 2008 Peripheral Interfaces Rajesh K. Gupta Computer Science and Engineering University of California, San Diego.
AS Computing Data transmission. Basic data transmission Baud The rate that the voltage changes is called the Baud. If the voltage changes 10 times every.
Unit 1 Lecture 4.
Serial Peripheral Interface SPI I2C (i-squared cee)
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
Embedded Communication Protocols Don Heer 10/18/10 1.
Serial Communication RS-232. In order to make two devices communicate, whether they are desktop computers, microcontrollers, or any other form of integrated.
Microcontroller basics Embedded systems for mortals.
Networked Embedded Systems Sachin Katti & Pengyu Zhang EE107 Spring 2016 Lecture 9 Serial Buses – SPI, I2C.
BIRLA VISHVAKARMA MAHAVIDYALAY SUBJECT: SPI PROTOCOL & MAX7221 DISPLAY INTERFACING SUBMITTED BY: KISHAN AVASTHI( ) MANSI CHANDEGARA( )
BASICS OF SERIAL COMMUNICATIONS BIRLA VISHWKARMA MAHAVIDYALAYA ELECTRONICS & TELECOMMUNICATION DEPARTMENT PRESENTING BY: ABHISHEK SINGH AMANDEEP.
میکرو کنترلرهای AVR Serial Interfaces, I2C and SPI
MICROCONTROLLER AND INTERFACING Presented by: Shefali Jethva ( ) Shivali Panchal ( ) Komal Soni ( ) Roll no. :- 14EC308.
1 Serial Peripheral Interface What is it? Basic SPI Capabilities Protocol Pros and Cons Uses Serial Peripheral Interface
©F.M. Rietti Communication Lines Fundamentals. ©F.M. Rietti LM-18 Computer Science SSI Embedded Systems I 2 Communication Lines Generally used to connect.
Lab 9 Multiprocessor, Buses, SPI, I2C. Multiprocessors Why multiprocessors? The structure of multiprocessors. Elements of multiprocessors: – Processing.
The HCS12 SCI Subsystem A HCS12 device may have one or two serial communication interface. These two SCI interfaces are referred to as SCI0 and SCI1. The.
Serial Communication Originally created by Anurag Dwidedi and Rudra Pratap Suman.
Serial Communication Buses: I2C and SPI
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
SERIAL PORT PROGRAMMING
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
Atmega32 Serial Programming Basics
I2C PROTOCOL SPECIFICATION
Communication Lines Fundamentals.
BJ Furman ME 106 Fundamentals of Mechatronics 15NOV2012
DIGITAL DATA COMMUNICATION TECHNIQUES
EEPROM Comparison – Parallel or Serial
DIGITAL DATA COMMUNICATION TECHNIQUES
Asynchronous Serial Communications
Serial Communication Interface: Using 8251
DIGITAL DATA COMMUNICATION TECHNIQUES
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
Serial Communication 19th Han Seung Uk.
Serial Communications
Presentation transcript:

Essentials of Communication This simple model requires many guarantees. Sender Receiver Communication Link Data

Guarantees in Communications The communication link exists. The communication link is safe and sound. The sender and receiver are the correct nodes. The sender is sending the correct data. The receiver is able to correctly interpret the incoming data.

Protocols in Communication In order to have robust communication, the guarantees needs to be realized. To do so, we need an elaborate and standardized mechanism. These standard rules that defines the parameters of communications and ensures these guarantees are called protocol.

Advantages of Protocols Standardized, so interoperability is ensured. Usually include error-detection and error-correction mechanisms. Available as implemented chips that can be directly used.

Types of Communication Protocols There are different ways of categorizing protocols First Categorization: Second Categorization: Serial Mode Transfer Parallel Mode Transfer Synchronous Mode Transfer Asynchronous Mode Transfer

Serial and Parallel Mode SENDER RECEIVER SERIAL MODE PARALLEL MODE

Serial vs Parallel Mode Parameter Reliability Speed Power Cost Complexity Range Serial Mode Parallel Mode ReliableUnreliable SlowFast LowHigh HighLow LongShort

Need of Synchronization SENDER T RECEIVER T/ Suppose Sender sends data with a Time Period of T What if Receiver doesn’t know the speed and assume it to be say T/2 The Data received will be

Synchronous Mode Sender sends a clock signal along with data at every rising / falling edge of the clock, the data value is read by the receiver. SENDER SENDER CLOCK RECEIVER

Asynchronous Mode There is no clock signal. The receiver and the sender communicate at a predetermined speed (bauds or bits per second). Baud Rate: Baud Rate is a measurement of transmission speed in asynchronous communication. The devices that allows communication must all agree on a single speed of information - 'bits per second'.

Synchronous vs Asynchronous Mode Parameter Reliability Cost Complexity Synchronous Asynchronous Reliable Error Prone Expensive Inexpensive Complicated Simple

Transmission Modes SENDERRECEIVER Simplex Only one way transmission takes place

Transmission Modes SENDERRECEIVER Half-Duplex Two way transmission takes place but only one end can communicate at a time

Transmission Modes SENDERRECEIVER Full-Duplex Two way transmission takes place and both end can communicate simultaneously

UART Universal Asynchronous Receiver Transmitter

Asynchronous Serial Communication With asynchronous communication, the transmitter and receiver do not share a common clock Transmitter Receiver + 1 byte-wide Data Data – 1 byte-wide Data The Receiver  Extracts the data using its own clock  Converts the serial data back to the parallel form after stripping off the start, stop and parity bits The Transmitter  Shifts the parallel data onto the serial line using its own clock  Also adds the start, stop and parity check bits Add: Start, Stop, Parity Bits Remove: Start, Stop, Parity Bits

Asynchronous Serial Communication Start bit—indicates the beginning of the data word Stop bit—indicates the end of the data word Parity bit—added for error detection (optional) Data bits—the actual data to be transmitted Baud rate—the bit rate of the serial port Throughput—actual data transmitted per sec (total bits transmitted— overhead) Example: baud = bits/sec If using 8-bit data, 1 start, 1 stop, and no parity bits, the effective throughput is: * 8 / 10 = bits/sec

Asynchronous Serial Communication Asynchronous transmission is easy to implement but less efficient as it requires an extra 2-3 control bits for every 8 data bits This method is usually used for low volume transmission

Synchronous Serial Communication In the synchronous mode, the transmitter and receiver share a common clock The transmitter typically provides the clock as a separate signal in addition to the serial data Transmitter Receiver Data Clock The Receiver  Extracts the data using the clock provided by the transmitter  Converts the serial data back to the parallel form The Transmitter  Shifts the data onto the serial line using its own clock  Provides the clock as a separate signal  No start, stop, or parity bits added to data 1 byte-wide Data

UART in Atmega328P

Arduino Serial Library int incomingByte = 0; // for incoming serial data void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps } void loop() { // send data only when you receive data: if (Serial.available() > 0) { // read the incoming byte: incomingByte = Serial.read(); // say what you got: Serial.print("I received: "); Serial.println(incomingByte, DEC); } }

SPI Serial Peripheral Interface

SPI SPI is an interface bus commonly used to send data between microcontrollers and small peripherals such as shift registers, sensors and SD cards. It uses separate clock and data lines, along with a select line to choose the device you wish to talk to. SPI was originally developed by Motorola (now Freescale) It works on serial mode of transfer. It is also synchronous and full duplex. It has the capability of communicate with many nodes.

SPI In SPI, the sender and receiver follows a master-slave relationship. There may be multiple nodes in the network. One node is master, the rest are slaves. The communication is always initiated by the master. The slaves can communicate only with the master. How do master selects the slave??

SPI Pins SCK is generated by Master and is used as the mode is synchronous. MOSI is Master Out Slave In: Data sent by Master to Slave. MISO is Master In Slave Out: Data sent by Slave to Master. S ̅ S ̅ is Slave Select: Slave communicates with Master only if this pin’s value is set as LOW. (Active Low)

SPI Schematics: Single Slave The SPI bus uses two data lines, a clock line, and a slave select line. An additional slave select line is added for each slave device, but the other three lines are shared on the bus.

SPI Schematics: Multiple Slaves

A - No data (SS is high, SCK is low) B - SS taken low to enable the slave (peripheral). At this point the slave should prepare to transfer data by setting the MOSI and the SCK lines as inputs, and the MISO line as an output. The slave can now prepare to notice clock pulses on the SCK line. C - First character arrives (the letter "F" or 0x46 or 0b ). For each of the 8 bits the SCK line is briefly brought high, and then low again. This tells the slave to read the data on the MOSI line. Also the slave can place data on the MISO line for the master to simultaneously read in. D - The letter "a" arrives E - The letter "b" arrives F - "No data" after "Fab" - however the SS is still enabled. G - SS taken high to indicate end of the sequence of data.

Notice how for each bit (starting with the most significant bit), the MOSI line is first changed to the correct state (0 or 1) and then the SCK line is pulsed to indicate that the data should be read. Sending the Character 'F' (0x46 or 0b ) (MSB First)

SPI in Atmega328P

Arduino SPI Library ( ) The Arduino development kit comes with an SPI library. To use it you just need to include it: #include To control the hardware you call SPI.begin() which configures the SPI pins (SCK, MOSI, SS) as outputs and MISO as input. It also sets SCK and MOSI low, and SS high. The function SPI.transfer() does the actual transferring of bytes. It is up to you to set SS low at an appropriate time. When finished call SPI.end() to turn the SPI hardware off.

I2C Inter-Integrated Circuit I-Squared-C

I2C (pronounced I-squared-C) created by Philips Semiconductors (now NXP) and commonly written as "I2C" stands for Inter- Integrated Circuit and allows communication of data between I2C devices over two wires. It sends information serially using one line for data (SDA – Serial DAta) and one for clock (SCL – Serial CLock). I2C Basics

The I2C protocol defines the concept of master and slave devices. A master device is the device that is in charge of the bus. This device controls the clock and generates the START and STOP signals. Slave devices listen to the commands sent by the Master and respond to them. Basic details: Transfer rate: 10 Kb/s (low speed) - 100Kb/s (high speed) SDA - Serial DAta line SCL - Serial CLock line 128 possible addresses (7 bits) 16 reserved addresses 112 devices max Devices have to share both 5V (Power) and GND (Ground) I2C Basics

Theory of Operation Regardless of how many slave units are attached to the I2C bus, there are only two signals connected to all of them. Consequently, there is an additional overhead because:  an addressing mechanism is required for the master device to communicate with a specific slave device.  an acknowledgement mechanism is required for such a communication.

Theory of Operation I2C has a master/slave protocol. The master initiates the communication. The sequence of events are: 1. The Master device issues a start condition. This condition informs all the slave devices to listen on the serial data line for instructions. (SDA goes from HIGH to LOW when SCL is HIGH) 2. The Master device sends the address of the target slave device and a read/write flag. (Flag is 1 for read and 0 for write) 3. The Slave device with the matching address responds with an acknowledgement signal. 4. Communication proceeds between the Master and the Slave on the data bus. Both the master and slave can receive or transmit data depending on whether the communication is a read or write. The transmitter sends 8-bits of data to the receiver which replies with a 1-bit acknowledgement. 5. When the communication is complete, the master issues a stop condition indicating that everything is done. (SDA goes from LOW to HIGH when SCL is HIGH)

Theory of Operation

TWI (Two Wire Interface) TWI stands for Two Wire Interface and it is identical to I²C. The name TWI was introduced by Atmel and other companies to avoid conflicts with trademark issues with Philips related to I²C.

TWI in Atmega328P I2C Requires Analog Pins 4 (SDA) and 5 (SCL) and two pull-up resistors. You can connect more than 100 Arduino's on the same 2 pins. It's simple, reliable and easy-to-use.

Arduino TWI Library ( )