i2c buses

35
BY: NAVEEN KUMAR DUBEY BUSES (Inter Integrated Circuit Bus) C I 2 2/13/2015 1 @naveen_elex

Upload: naveen-dubey

Post on 20-Jul-2015

170 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: I2c buses

BY:

NAVEEN KUMAR DUBEY

BUSES(Inter Integrated Circuit Bus)

CI 2

2/13/2015

1

@naveen_elex

Page 2: I2c buses

OUTLINES:-

I2C-Bus:Introduction

Key Features of I2C Buses

Development of I2C

I2C Bus Architecture

The I2C Bus Protocol

MSSP Module in I2C buses

Conclusion

References

2/13/2015

2

Page 3: I2c buses

I2C-Bus:INTRODUCTION

2/13/2015

3

Page 4: I2c buses

I2C-Bus:INTRODUCTION

The I2C bus was designed by Philips in the early '80s to allow easy communication between components which reside on the same circuit board.

Philips Semiconductors migrated to NXP in 2006.

The name I²C translates into "Inter IC". Sometimes the bus is called IIC .

2/13/2015

4

Page 5: I2c buses

INRODUCTION (Contd…)

The original communication speed was defined with a

maximum rate of 100 kbit per second.

There are some more speed options are available

Fast mode - Speed 400 Kilo bit per second.

High speed Mode – Speed 3.4 Mega Bit per second ( available since 1998)

Recently a “Fast plus mode (introduced in 2007 by NXP)” which speed lies in between above two modes.

2/13/2015

5

Page 6: I2c buses

Key Features of I2C Buses

Simplicity and flexibility are key characteristics that make this bus attractive to many applications.

Most significant features include:

Only two bus lines are required (SDA & SCL )

No strict baud rate requirements like for instance with RS232

Simple master/slave relationships exist between all components .

Each device connected to the bus is software-addressable by a unique address .

I2C is a true multi-master bus providing arbitration and collision detection .

2/13/2015

6

Page 7: I2c buses

Key Features (contd….)

As per recent development there are few more features

The Ultra Fast-mode is a uni-directional mode with data transfers of up to 5 Mbit/s.

Some intelligent control, usually with a single-chip microcontroller

On-chip filtering rejects spikes on the bus data line to preserve data integrity.

2/13/2015

7

Page 8: I2c buses

Generation wise development of I2C

Original 1982 - first release

v1.0 1992 - Version 1.0 (of the I2C-bus specification)

v2.0 1998 - This updated version of the I2C-bus

specification meets requirements like

higher bus speeds and lower supply voltages.

v2.1 2000 - Version 2.1 (of the I2C-bus specification )

2/13/2015

8

Page 9: I2c buses

Contd….

v.3 - (19th June 2007 introduced by NXP )

Fast mode plus introduced in this version.

v.4 - (13th Feb 2012 ) & V.5 - (19th October 2012)

These are user manual release .

2/13/2015

9

Page 10: I2c buses

I2C Architecture

2/13/2015

10

SCL

SDAMASTER

SLAVE1

SLAVE2

SLAVE

N

Page 11: I2c buses

I2C Architecture (contd..)

Master device is the one which initiates/ terminates data transfer and generates clock signals.

Slave is a device addressed by Master.

Both the master as well as slave can receive and transmit data .

In I2C communication, a master controller always generates clock (SCL) however data can be generated by both.

2/13/2015

11

Page 12: I2c buses

I2C Protocol (Data Communication

Process)

2/13/2015

12

Page 13: I2c buses

Protocol (contd..)

Address Formats of I2C

In I2C buses 7 bit as well as 10 bit addressing is possible.

Hence 128 or 1024 slave devices can be addressed .

In Case of 7 bit addressing one address byte is transmitted.

In case of 10 bit addressing two address bytes are transmitted over SDA line.

2/13/2015

13

Page 14: I2c buses

Protocol (contd..)

7 bit addressing

10 bit addressing

S 1MSB

2 3 4 5 6 7LSB

R/WR

2/13/2015

14

Page 15: I2c buses

Protocol (contd..)

Addressing & Device detection

Each device is addressed individually by software.

New function or address can be easily “imposed” on to an existing bus.

master

Slave-1 Slave-2 Slave-3

2/13/2015

15

Page 16: I2c buses

Protocol (contd..)

Communication

Communication must start with : START condition

Start bit always followed bye Slave address.

Slave address always followed by Read/Write bit

The device must always send ACKNOWLEDGE bit (either master or slave)

Communication must terminate with : STOP condition

2/13/2015

16

Page 17: I2c buses

Protocol (contd..)

2/13/2015

17

Page 18: I2c buses

Protocol (contd..)

Start & Stop Condition

Start Condition – A high to low transition on SDA when

SCL is high.

Stop Condition – A low to high transition on SDA when SCL is high.

2/13/2015

18

Page 19: I2c buses

Protocol (contd..)

Bit Transfer

During Data transfer SDA must be stable when SCL is high.

2/13/2015

19

Page 20: I2c buses

Protocol (contd..)

Data Transfer & Clock Stretching

Each byte has to followed by Acknowledge Bit.

Number of Byte transferred per transfer is unrestricted .

If slave can’t receive or transmit another complete byte of data, it can hold the clock line SCL LOW (clock stretching) to force the master in to wait state.

2/13/2015

20

Page 21: I2c buses

2/13/2015

21

Page 22: I2c buses

Protocol (contd..)

Acknowledge / Not Acknowledge

2/13/2015

22

Page 23: I2c buses

Scenario with NACK (not acknowledge ) Condition

A receiver with the address is not present on I2C bus

The receiver is performing real time task and can not process

information received from I2C bus.

A receiver is master and want to take control on SDA to generate

STOP command. The slave transmitter must release SDA after

reception of NACK ,so that master can generate STOP.

2/13/2015

23

Page 24: I2c buses

I2C Protocol Summary

2/13/2015

24

Page 25: I2c buses

MSSP Module in I2C buses

The Master Synchronous Serial Port (MSSP) module is a serial interface useful for communicating with other peripheral or microcontroller devices.

Developed by Microchip .

MSSP ModesThe MSSP module can operate in two modes: Serial Peripheral Interface (SPI)

- Full Master mode- Slave mode (with general address call)

Inter-Integrated Circuit (I2C)- Master mode- Multi-Master mode- Slave mode

2/13/2015

25

Page 26: I2c buses

Module Setup

To configure the MSSP module for Master I2C mode, there are key SFR registers which must be initialized.

Respective code examples are shown for each.

1. SSP Control Register1 (SSPCON1)

• I2C Mode Configuration

2. SSP Address Register (SSPADD)

• I2C Bit Rate

3. SSP Status Register (SSPSTAT)

• Slew Rate Control

• Input Pin Threshold Levels ( I2C)

4. Pin Direction Control (TRISC)

• SCL/SDA Direction

2/13/2015

26

Page 27: I2c buses

2/13/2015

27

I2C MODE CONFIGURATION

BIT RATE CALCULATION

Page 28: I2c buses

2/13/2015

28

I2C BIT RATE SETUP

SLEW RATE CONTROL

Page 29: I2c buses

2/13/2015

29

SCL/SDA PIN DIRECTION SETUP

ACKNOWLEDGE EVENT

Page 30: I2c buses

2/13/2015

30

NOT ACKNOWLEDGE EVENT

START EVENT COMPLETION CHECK

Page 31: I2c buses

2/13/2015

31

READ EVENT COMPLETION CHECK

Page 32: I2c buses

2/13/2015

32

WRITE EVENT COMPLETION CHECK

Page 33: I2c buses

Conclusion

2/13/2015

33

The I2C-bus has become a de facto world standard

that is now implemented in over 1000 different ICs

and licensed to more than 50 companies.

Many of today’s applications, however, require higher bus

speeds and lower supply voltages. The updated version of the

I2C-bus specification meets those requirements.

Page 34: I2c buses

References

http://www.i2c-bus.org/

http://www.nxp.com/documents/user_manual/UM10204.pdf

The I2C Bus Specification, version 2.1, January 2000

http://www.semiconductors.philips.com/buses/i2c

www.phxmicro.com/Animation/I2C_Tutorial.htm

http://ww1.microchip.com/downloads/en/appnotes

2/13/2015

34

Page 35: I2c buses

2/13/2015

35

THANK YOU