I2c Bus& Can Bus
I2c Bus& Can Bus
Serial Data (SDA) – Transfer of data takes place through this pin.
Serial Clock (SCL) – It carries the clock signal.
• Master mode
• Slave mode
Each data bit transferred on SDA line is synchronized by a high to the low pulse of each
clock on the SCL line.
According to I2C protocols, the data line can not change when the clock line is high, it
can change only when the clock line is low. The 2 lines are open drain, hence a pull-up
resistor is required so that the lines are high since the devices on the I2C bus are active
low. The data is transmitted in the form of packets which comprises 9 bits. The sequence
of these bits are –
3. Acknowledge – 1 bit
Start and Stop Conditions :
START and STOP can be generated by keeping the SCL line high and changing the
level of SDA. To generate START condition the SDA is changed from high to low
while keeping the SCL high. To generate STOP condition SDA goes from low to high
while keeping the SCL high, as shown in the figure below.
Read/Write Bit :
A high Read/Write bit indicates that the master is sending the data to the slave, whereas
a low Read/Write bit indicates that the master is receiving data from the slave.
ACK/NACK Bit :
After every data frame, follows an ACK/NACK bit. If the data frame is received
successfully then ACK bit is sent to the sender by the receiver.
Addressing :
The address frame is the first frame after the start bit. The address of the slave with which
the master wants to communicate is sent by the master to every slave connected with it.
The slave then compares its own address with this address and sends ACK.
START condition plus address packet plus one more data packet plus STOP
condition collectively form a complete Data transfer.
CAN Bus:
Controller Area Network (CAN Bus) is defined as a message-based protocol that was
designed to provide reliable communication between multiple Electronic Control Units
(ECUs). It is a serial networking technology. Through a CAN bus,
various microcontrollers and devices can have real-time communication without the
need for a hosting computer. It does not need any kind of addressing schemas because
the protocol itself has unique identifiers providing the data about the urgency and
significance of the transmitted message. CAN bus is considered a half-duplex, high
speed, and two wired networking system which holds great dominance over traditional
networking systems like RS232. When compared with consistency and functionality,
CAN buses are most effective and provide enhanced broadcasting between ECUs.
The CAN bus employs a multi-master bus pattern for the transmission of frames between
various nodes and it can be able to manage error handling scenarios. The core allows the
user to establish a reliable and economic connection between multiple ECUs. The CAN
protocol seems to be a memory-mapped I/O device for the host processors having the
access to CAN core in handling either the frames transmission or reception.
Data – Link layer – This layer is used for establishing data transmission between multiple
nodes. Even holds the responsibility for identifying and removing the errors that take
place at the physical layer. This layer again consists of two sub-layers which are of:
MAC – Medium Access Control – This layer describes how various devices present in the
network can receive accessibility to the medium. Here, data signaling, error
identification, message encapsulation and decapsulation take place.
LLC – Logical Link Control – This layer offers logic for the data-link layer because it
manages flow controlling, multiplexing, acceptance filtering, recovery handling, and
overload warnings.
Physical Layer – This layer is useful in raw information transmission. It outlines the
properties for the parameters like timing, information rate levels, voltage ratings, and
connector. This ISO 11898 has mainly three portions.
PCS – Physical Coding Sublayer – It observes that when the functional connection has
been established and this layer is defined in Fast Ethernet, 10 Gigabit Ethernet, and
gigabit Ethernet standards. It performs encoding and decoding of information,
scrambling and descrambling, and rate variance compensation.
PMA – Physical Medium Attachment – It executes the framing of data and is responsible
for transmitting and receiving high-speed information based on the structure of the
transceiver channel. It also performs octet synchronization.
MDI – Medium Dependent Interface – It defines the interface for the medium in the
network which is useful in carrying the transmission.
o SOF: SOF stands for the start of frame, which indicates that the new frame is
entered in a network. It is of 1 bit.
o Identifier: A standard data format defined under the CAN 2.0 A specification uses
an 11-bit message identifier for arbitration. Basically, this message identifier sets
the priority of the data frame.
o RTR: RTR stands for Remote Transmission Request, which defines the frame type,
whether it is a data frame or a remote frame. It is of 1-bit.
1. IDE: An IDE bit in a control field stands for identifier extension. A dominant
IDE bit defines the 11-bit standard identifier, whereas recessive IDE bit
defines the 29-bit extended identifier.
2. DLC: DLC stands for Data Length Code, which defines the data length in a
data field. It is of 4 bits.
o CRC field: The data frame also contains a cyclic redundancy check field of 15 bit,
which is used to detect the corruption if it occurs during the transmission time.
The sender will compute the CRC before sending the data frame, and the receiver
also computes the CRC and then compares the computed CRC with the CRC
received from the sender. If the CRC does not match, then the receiver will
generate the error.
o EOF: EOF stands for end of frame. It contains 7 consecutive recessive bits known
End of frame.