I2C and CAN Protocol
-
Upload
amarnath-m-damodaran -
Category
Documents
-
view
227 -
download
2
Transcript of I2C and CAN Protocol
-
7/29/2019 I2C and CAN Protocol
1/28
SERIAL BUSCOMMUNICATION
PROTOCOLS
& CAN
-
7/29/2019 I2C and CAN Protocol
2/28
SERIAL BUSCOMMUNICATION
PROTOCOLS
Protocol
-
7/29/2019 I2C and CAN Protocol
3/28
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 itcome 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 ofI2C protocol bus inbuilt.
-
7/29/2019 I2C and CAN Protocol
4/28
Technical Specifications
The I2C Bus has two lines that carry its signals one line is for clock named as SCL and second isfor data named as SDL.
By using I2C protocol the master can address 127slaves at an instances.
It has a processing element functionally as a buscontroller or a microcontroller with I2C businterface circuits.
-
7/29/2019 I2C and CAN Protocol
5/28
Bit format of I2C
-
7/29/2019 I2C and CAN Protocol
6/28
Brief introduction by video session
-
7/29/2019 I2C and CAN Protocol
7/28
State Diagram of I2C BusMaster
Idle
Address
DATAWrite
DATARead
Get
DATA
Send
DATA
-
7/29/2019 I2C and CAN Protocol
8/28
SERIAL BUSCOMMUNICATION
PROTOCOLSCAN Protocol
-
7/29/2019 I2C and CAN Protocol
9/28
DistributedControl Area Network (CAN)Bus Distributed Control Area Network
Example - a network of embedded systems inautomobile
It has a speed of 1 Mbps as a data rate
It uses Multi-master bus.
CAN Module are required
-
7/29/2019 I2C and CAN Protocol
10/28
CAN is a closed network
no need for security, sessions or logins.
- no user interface requirements.
Physical and Data Link layers in silicon.
CANBUS and the OSI Model
10OSI:-> Open Systems Interconnection
-
7/29/2019 I2C and CAN Protocol
11/28
CANBUS Physical Layer
11
Conventional multi-wire looms CAN bus network
Physical medium two wires terminated at both ends by resistors.
Differential signal - better noise immunity.
Benefits: Reduced weight, Reduced cost
Fewer wires = Increased reliability
vs.
http://canbuskit.com/what.php
-
7/29/2019 I2C and CAN Protocol
12/28
Message Oriented Transmission Protocol
12
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.
-
7/29/2019 I2C and CAN Protocol
13/28
Message Format
13
Each message has an ID, Data and overhead.
Data8 bytes max Overhead start, end, CRC, ACK
-
7/29/2019 I2C and CAN Protocol
14/28
Bus Arbitration
14
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.
-
7/29/2019 I2C and CAN Protocol
15/28
Bus Arbitration
15
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.
-
7/29/2019 I2C and CAN Protocol
16/28
CAN protocol
There is a CAN controller between the CAN line andthe host node.
CAN controllerBIU (Bus Interface Unit) consisting
of a buffer and driver
Method for arbitrationCSMA/AMP (Carrier SenseMultiple Access with Arbitration on MessagePriority basis)
-
7/29/2019 I2C and CAN Protocol
17/28
Each Distributed Node Uses:
Twisted Pair Connection up to 40 m for bi-directional 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 pulleddown to dominant (active) state logic 0 (ground ~0V) by a sender to the CAN line
-
7/29/2019 I2C and CAN Protocol
18/28
It has two states
1. Dominant State(Logic 0)
2. Recessive State(Logic 1)
Physical Layer
-
7/29/2019 I2C and CAN Protocol
19/28
Data Link Layer
Bit Format of CAN Bus
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
START
ARBITRATION
FIELD
CONTROL
FIELD
DATA
FIELD
ACK
FIELD
END
FRAME
1 BIT 12 BITS 6 BITS 0 TO 64 BITS
CRC
FIELD
16 BITS 2 BITS 7 BITS
-
7/29/2019 I2C and CAN Protocol
20/28
Protocol defined First field inframe bits
First field of 12 bitsArbitrationfield.
11-bit destination address and RTR bit (RemoteTransmission Request)
Destination device address specified in an 11-bit sub-field and whether the data byte being sent is a data forthe device or a request to the device in 1-bit sub-field.
Maximum 211 devices can connect a CAN controller incase of 11-bit address field standard
-
7/29/2019 I2C and CAN Protocol
21/28
Arbitration Field
Identifies(11 bits) the device to which data is beingsent 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 requestfor the data from the device.
-
7/29/2019 I2C and CAN Protocol
22/28
Second field of 6 bits- control field.
The first bit is for the identifiers extension.
The second bit is always '1'.
The last 4 bits specify code for data length
Control Field (6 bits)
-
7/29/2019 I2C and CAN Protocol
23/28
Third field of 0 to 64 bits
Its length depends on the data length code in thecontrol field.
Data Field (up-to 8 bytes data)
-
7/29/2019 I2C and CAN Protocol
24/28
Fourth field (third if data field has no bit present)of 16 bitsCRC (Cyclic Redundancy Check) bits.
The receiver node uses it to detect the errors, if
any, during the transmission
CRC Field
-
7/29/2019 I2C and CAN Protocol
25/28
Fifth field of 2 bitsFirst bit 'ACK slot'
ACK = '1 BIT' and receiver sends back '0' in this slot whenthe receiver detects an error in the reception.
Sender after sensing '0' in the ACK slot, generallyretransmits the data frame.
Second bit 'ACK delimiter' bit. It signals the end of ACKfield.
If the transmitting node does not receive anyacknowledgement of data frame within a specified timeslot, it should retransmit.
ACK Field
-
7/29/2019 I2C and CAN Protocol
26/28
Sixth field of 7-bits
end- of- the frame specification and has seven '0's
EOF Field
S
-
7/29/2019 I2C and CAN Protocol
27/28
CAN busController 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
Summary
27
http://en.wikipedia.org/wiki/Engine_control_unithttp://en.wikipedia.org/wiki/Engine_control_unithttp://en.wikipedia.org/wiki/Engine_control_unithttp://en.wikipedia.org/wiki/Engine_control_unithttp://en.wikipedia.org/wiki/Engine_control_unit -
7/29/2019 I2C and CAN Protocol
28/28
Self Study
USB Protocol..!!!