An Implementation of I2C Slave Interface Using Verilog HDL: Journal
An Implementation of I2C Slave Interface Using Verilog HDL: Journal
ABSTRACT: The focus of this paper is on implementation of Inter Integrated Circuit (I2C) protocol
following slave module for no data loss. In this paper, the principle and the operation of I2C bus protocol
will be introduced. It follows the I2C specification to provide device addressing, read/write operation and
an acknowledgement. The programmable nature of device provide users with the flexibility of configuring
the I2C slave device to any legal slave address to avoid the slave address collision on an I2C bus with
multiple slave devices. This paper demonstrates how I2C Master controller transmits and receives data to
and from the Slave with proper synchronization.
The module is designed in Verilog and simulated in ModelSim. The design is also synthesized in Xilinx
XST 14.1. This module acts as a slave for the microprocessor which can be customized for no data loss.
Keywords: Inter Integrated circuit, serial data, serial clock, slave, verilog
I. INTRODUCTION
The serial communication bus requires fewer IC connection pins, less wiring and the less number of
traces on printed circuit boards. Many embedded system peripherals like analog-to-digital and digital-to-
analog convertors, LCDs, and temperature sensors supports serial interface. Serial interface allow processors to
communicate without the need for shared memory and the problems these can create. There are Serial
communication protocols like UART, CAN, USB, SPI, RS-232, RS-422, RS-485 for interfacing high speed
and low speed peripherals. These require more pin connections and signals to connect devices [8]. To
overcome this problem, the I2C protocol was introduced by Phillips which requires only two I/O lines for
communication [1]. USB, SPI and UARTS all are one type to point type protocol. USB uses multiplexers to
communicate with other device. Among these only I2C and CAN protocol uses software addressing and I2C is
very efficient, easy to maintain and simple to design [9].
I2C is a simple multi-master, low-bandwidth, short-distance protocol [6]. It was developed by Philips
Semiconductors in the early 1980s. I2C was created to reduce the manufacturing cost of the electronic products
as it provides minimum trace on board. Many semiconductor vendors support I2C-compatible devices in
embedded systems including EEPROM, temperature current sensors, microcontrollers and real time clocks.
The I2C allows 7-bit or 10 bit addressing using only two bi-directional lines: serial clock (SCL) and
serial data (SDA). The pull-up resistors are only added for each of the lines. Each of the connected devices can
act as a master or a slave device. The clock line can be drived by master device only. The transmission of 8-bit
of data and 7-bit of address with a control bit is done serially using the interface. The device that initiates the
transmission on the bus is usually known as the master, while all the other devices on bus are known as slave.
In this design there is a single slave which takes the command from the master, takes the bus control and
performs the read and write operation accordingly. For synchronization purpose, the clocking stretching is
done by the slave module which helps the slow peripherals to communicate with the fast devices.
2.3.4 Transfer Data Byte format: every data byte must be 8 bit long to be put on the SDA line on the
negative level. Each byte is followed by an Acknowledge bit which is done by pulling down the sda line.
2.3.5 Data Validity: The data on the SDA line are valid for the high period of clock pulse. It is shown in the
figure below.
The Resistor-transistor logic diagram viewed from XILINX 14.1 is shown in figure below
REFERENCES
[1] Philips Semiconductor, “I2C-bus specification and user manual”, version 2.1 January 2000.
[2] J.M. Irazabel & S. Blozis, Philips Semiconductors, “I2CManual, Application Note, ref. AN10216-0” March 24,
2003.
[3] Richard Herveille, “I2C Master Core Specification” Open Cores,2003
[4] Xilinx “Spartan-3A/3AN FPGA Starter Kit Board User Guide”,version 1.1,2008.
[5] F.Leens, “An Introduction to I2C and SPI Protocols”, IEEE Instrumentation & Measurement Magazine, pp. 8-13,
February 2009.
[6] Shoaib. Shah Sobhan, Sudipta. Das and Iqbalur. Rahman “Implementation of I2C using System Verilog and FPGA”
International Conference on Advancements in Electronics and Power Engineering (ICAEPE'2011), Bangkok, Dec
2011.
[7] J. J Patel, Prof B. H. Soni “Design and implementation of I2C bus controller using Verilog” Journal of Information
Knowledge and Research in Electronics and Communication Engineering ISSN: 0975– 6779, Volume–02, Issue-02,
pp 520-522 Nov. 2012.
[8] Bollam Eswari, N.Ponmagal, K.Preethi, S.G.Sreejeesh “Implementation of I2C Master Bus Controller on FPGA”
International conference on Communication and Signal Processing, - IEEE- 978-1-4673-4866-9/13, April 3-5, 2013.
[9] Jayant Mankar, Chaitali Darode , Komal Trivedi “Review of I2C protocol” International Journal of Research in
Advent Technology, E-ISSN: 2321–9637 Volume 2, Issue 1, January 2014.
[10] Tatiana Leal-del Río, Gustavo Juarez-Gracia, L. Noé Oliva-Moreno “Implementation of the communication
protocols SPI and I2C using a FPGA by the HDL-Verilog language” Research in Computing Science 75 pp. 31–41;
July, 2014