I2C and CAN Protocol ppt 3x

Download Report

Transcript I2C and CAN Protocol ppt 3x

SERIAL BUS
COMMUNICATION PROTOCOLS
𝟐
𝐈 𝐂 & CAN
SERIAL BUS
COMMUNICATION PROTOCOLS
𝟐
𝐈 𝐂 Protocol
Introduction to I2C
ο‚– I2C is well known bus invented by PHILIPS.
ο‚– I2C stands for INTER-INTEGRATED CIRCUIT.
ο‚– These type of bus is famous in TV circuit board and then it
come to computer environment.
ο‚– It has speed of 100kbs but it can be extended to 450kbps.
ο‚– But only the problem is our processor has a capability of
I2C protocol bus inbuilt.
Technical Specifications
ο‚– The I2C Bus has two lines that carry its signals βˆ’
one line is for clock named as SCL and second is
for data named as SDL.
ο‚– By using I2C protocol the master can address 127
slaves at an instances.
ο‚– It has a processing element functionally as a bus
controller or a microcontroller with I2C bus
interface circuits.
Bit format of I2C
Brief introduction by video session
State Diagram of I2C Bus Master
Address
Idle
DATA
Read
DATA
Write
Get
DATA
Send
DATA
SERIAL BUS
COMMUNICATION PROTOCOLS
CAN Protocol
Serial Communication Distributed
Control Area Network (CAN) Bus
ο‚– Distributed Control Area Network
ο‚– Example - a network of embedded systems in
automobile
ο‚– It has a speed of 1 Mbps as a data rate
ο‚– It uses Multi-master bus.
ο‚– CAN Module are required
CANBUS and the OSI Model
ο‚– CAN is a closed network
ο‚– – no need for security, sessions or logins.
ο‚– - no user interface requirements.
ο‚– Physical and Data Link layers in silicon.
OSI:-> Open Systems Interconnection
10
CANBUS Physical Layer



Physical medium – two wires terminated at both ends by resistors.
Differential signal - better noise immunity.
Benefits:
 Reduced weight, Reduced cost
 Fewer wires = Increased reliability
Conventional multi-wire looms
CAN bus network
vs.
http://canbuskit.com/what.php
11
Message Oriented Transmission Protocol
ο‚– Each node – receiver & transmitter
ο‚– A sender of information transmits to all devices on the bus
ο‚– All nodes read message, then decide if it is relevant to them
ο‚– All nodes verify reception was error-free
ο‚– All nodes acknowledge reception
CAN bus
© 2005 Microchip Technology Incorporated. All Rights Reserved.
12
Message Format
ο‚– Each message has an ID, Data and overhead.
ο‚– Data –8 bytes max
ο‚– Overhead – start, end, CRC, ACK
13
Bus Arbitration
ο‚– Arbitration – needed when multiple nodes try to transmit at the same time
ο‚– Only one transmitter is allowed to transmit at a time.
ο‚– A node waits for bus to become idle
ο‚– Nodes with more important messages continue transmitting
CAN bus
© 2005 Microchip Technology Incorporated. All Rights Reserved.
14
Bus Arbitration
ο‚– Message importance is encoded in message ID.
Lower value = More important
ο‚– As a node transmits each bit, it verifies that it sees the same bit
value on the bus that it transmitted.
ο‚– A β€œ0” on the bus wins over a β€œ1” on the bus.
ο‚– Losing node stops transmitting, winner continues.
15
CAN protocol
There is a CAN controller between the CAN line and
the host node.
ο‚– CAN controller ─BIU (Bus Interface Unit) consisting
of a buffer and driver
ο‚– Method for arbitration─ CSMA/AMP (Carrier Sense
Multiple Access with Arbitration on Message
Priority basis)
Each Distributed Node Uses:
ο‚– Twisted Pair Connection up to 40 m – for bidirectional data.
ο‚– Line, which pulls to Logic 1 through a resistor
between the line and + 4.5V to +12V. :
ο‚– Line Idle state Logic 1 (Recessive state)
ο‚– Detects Input Presence at the CAN line pulled
down to dominant (active) state logic 0 (ground ~
0V) by a sender to the CAN line
Physical Layer
ο‚– It has two states
1. Dominant State(Logic 0)
2. Recessive State(Logic 1)
Data Link Layer
Bit Format of CAN Bus
START
1 BIT
12 BITS
ARBITRATION
FIELD
6 BITS
CONTROL
FIELD
0 TO 64 BITS 16 BITS 2 BITS
DATA
FIELD
CRC
FIELD
7 BITS
ACK
END
FIELD FRAME
There are 5-fields in CAN data Frame Format and START & STOP Bits
1.
Arbitration field
2.
Control Field [Specifies the number of bytes of data to follow (0-8)]
3.
Data Field
4.
CRC Field [cyclic redundancy check code]
5.
Acknowledge Field
Protocol defined First field in frame bits
ο‚– First field of 12 bits ─ β€œArbitration field”.
ο‚– 11-bit destination address and RTR bit (Remote
Transmission Request)
ο‚– Destination device address specified in an 11-bit subfield and whether the data byte being sent is a data for
the device or a request to the device in 1-bit sub-field.
ο‚– Maximum 211 devices can connect a CAN controller in
case of 11-bit address field standard
Arbitration Field
ο‚– Identifies(11 bits) the device to which data is being
sent or request is being made.
ο‚– When RTR bit is at '1', it means this packet is for
the device at destination address. If this bit is at '0'
(dominant state) it means, this packet is a request
for the data from the device.
Control Field (6 bits)
ο‚– Second field of 6 bits- control field.
ο‚– The first bit is for the identifier’s extension.
ο‚– The second bit is always '1'.
ο‚– The last 4 bits specify code for data length
Data Field (up-to 8 bytes data)
ο‚– Third field of 0 to 64 bits
ο‚– Its length depends on the data length code in the
control field.
CRC Field
ο‚– Fourth field (third if data field has no bit present)
of 16 bits─ CRC (Cyclic Redundancy Check) bits.
ο‚– The receiver node uses it to detect the errors, if
any, during the transmission
ACK Field
ο‚– Fifth field of 2 bits─ First bit 'ACK slot'
ο‚– ACK = '1 BIT' and receiver sends back '0' in this slot when
the receiver detects an error in the reception.
ο‚– Sender after sensing '0' in the ACK slot, generally
retransmits the data frame.
ο‚– Second bit 'ACK delimiter' bit. It signals the end of ACK
field.
ο‚– If the transmitting node does not receive any
acknowledgement of data frame within a specified time
slot, it should retransmit.
EOF Field
ο‚– Sixth field of 7-bits
ο‚– end- of- the frame specification and has seven '0's
Summary
ο‚– CAN bus – Controller Area Network bus
ο‚– Primarily used for building ECU (Engine control
unit) networks in automotive applications.
ο‚– Two wires
ο‚– OSI - Physical and Data link layers
ο‚– Differential signal - noise immunity
ο‚– 1Mbit/s, 120’
ο‚– Messages contain up to 8 bytes of data
27
Self Study
ο‚– USB Protocol…………………..!!!