I2C and CAN Protocol
I2C and CAN Protocol
I2C and CAN Protocol
& CAN
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.
Idle
DATA Read
Get DATA
DATA Write
Send DATA
CAN Protocol
10
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
11
CAN bus
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
CAN bus
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)
Physical Layer
It has two states
1. Dominant State(Logic 0) 2. Recessive State(Logic 1)
12 BITS
ARBITRATION FIELD
6 BITS
CONTROL FIELD
7 BITS
There are 5-fields in CAN data Frame Format and START & STOP Bits 1. 2. Arbitration field Control Field [Specifies the number of bytes of data to follow (0-8)]
3.
4. 5.
Data Field
CRC Field [cyclic redundancy check code] Acknowledge 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.
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..!!!