An Implementation of I2C Slave Interface using Verilog HDL

Similar documents
The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

NB3H5150 I2C Programming Guide. I2C/SMBus Custom Configuration Application Note

Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

USB2.0 <=> I2C V4.4. Konverter Kabel und Box mit Galvanischetrennung

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

UM I 2 C-bus specification and user manual. Document information

Design and Verification of Nine port Network Router

Integration of Arduino as a slave system to LonWorks based System using I2C Interface

Serial port interface for microcontroller embedded into integrated power meter

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Definitions and Documents

Raspberry Pi. Hans- Petter Halvorsen, M.Sc.

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

8051 MICROCONTROLLER COURSE

Arbitration and Switching Between Bus Masters

SPI I2C LIN Ethernet. u Today: Wired embedded networks. u Next lecture: CAN bus u Then: wireless embedded network

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

HDMM01 V1.0. Dual-axis Magnetic Sensor Module With I 2 C Interface FEATURES. Signal Path X

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol

Serial Communications

The I 2 C-bus and how to use it (including specifications)

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

FPGA INTEGRATION MANUAL SATURN-SIL 2 MODULES. Dictionary Code. Edition 01. Revision 00. Number of pages 18

The Programming Interface

Table 1: Address Table

I 2 C Master Mode Overview and Use of the PICmicro MSSP I 2 C Interface with a 24xx01x EEPROM

DS1307ZN. 64 x 8 Serial Real-Time Clock

Surveillance System Using Wireless Sensor Networks

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

Eliminate Risk of Contention and Data Corruption in RS-485 Communications

THE I 2 C-BUS SPECIFICATION VERSION 2.1 JANUARY document order number:

Allows the user to protect against inadvertent write operations. Device select and address bytes are Acknowledged Data Bytes are not Acknowledged

Computer Systems Structure Input/Output

Microcontrollers in Practice

Design and Implementation of Vending Machine using Verilog HDL

DS1621 Digital Thermometer and Thermostat

FPGA Implementation of an Advanced Traffic Light Controller using Verilog HDL

Implementing SPI Communication Between MSP430 G2452 and LTC ADC

Implementing MOD bus and CAN bus Protocol Conversion Interface

DS Wire Digital Thermometer and Thermostat

Android based Secured Vehicle Key Finder System

Display Message on Notice Board using GSM

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Design and Functional Verification of A SPI Master Slave Core Using System Verilog

International Journal of Advancements in Research & Technology, Volume 2, Issue3, March ISSN

I2C PRESSURE MONITORING THROUGH USB PROTOCOL.

Serial Communications

MPR121 Serial Communication

Software User Guide UG-461

DESIGN OF 6 DOF ROBOTIC ARM CONTROLLED OVER THE INTERNET

Design and Implementation of an On-Chip timing based Permutation Network for Multiprocessor system on Chip

Design of a Wireless Medical Monitoring System * Chavabathina Lavanya 1 G.Manikumar 2

Bus Data Acquisition and Remote Monitoring System Using Gsm & Can

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

Lizy Kurian John Electrical and Computer Engineering Department, The University of Texas as Austin

Pre-tested System-on-Chip Design. Accelerates PLD Development

AN601 I2C 2.8 Communication Protocol. SM130 SM130 - Mini APPLICATION NOTE

DS1621 Digital Thermometer and Thermostat

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Bi-directional level shifter for I²C-bus and other systems.

Chapter 13. PIC Family Microcontroller

USING I2C WITH PICAXE

Design And Implementation Of Bank Locker Security System Based On Fingerprint Sensing Circuit And RFID Reader

Microtronics technologies Mobile:

Palaparthi.Jagadeesh Chand. Associate Professor in ECE Department, Nimra Institute of Science & Technology, Vijayawada, A.P.

Embedded Systems Design Course Applying the mbed microcontroller

Design of Wireless Home automation and security system using PIC Microcontroller

VDIP1. Vinculum VNC1L Module. Datasheet

DATA LOGGER AND REMOTE MONITORING SYSTEM FOR MULTIPLE PARAMETER MEASUREMENT APPLICATIONS. G.S. Nhivekar, R.R.Mudholker

How To Fix A 3 Bit Error In Data From A Data Point To A Bit Code (Data Point) With A Power Source (Data Source) And A Power Cell (Power Source)

CHAPTER 11: Flip Flops

LIN (Local Interconnect Network):

Security & Chip Card ICs SLE 44R35S / Mifare

Wireless Sensor Network Based Low Power Embedded System Design For Automated Irrigation System Using MSP430

Pen Drive to Pen Drive and Mobile Data Transfer Using ARM

Solutions for Increasing the Number of PC Parallel Port Control and Selecting Lines

DECT Module UM-9802 Datasheet

Serial Communications / Protocol in AirTest Products

Using Xbee in Serial Communication

Location-Aware and Safer Cards: Enhancing RFID Security and Privacy

Chapter 2 Logic Gates and Introduction to Computer Architecture

Welcome to the Introduction to Controller Area Network web seminar My name is William Stuart, and I am a Applications Engineer for the Automotive

Intelligent Home Automation and Security System

Using Altera MAX Series as Microcontroller I/O Expanders

- 35mA Standby, mA Speaking pre-defined phrases with up to 1925 total characters.

Embedded Systems on ARM Cortex-M3 (4weeks/45hrs)

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Intelligent Fleet Management System Using Active RFID

EMBEDDED GSM MONITOR AND CONTROL USING ANDROID APPLICATION

Switch Fabric Implementation Using Shared Memory

EVAL-UFDC-1/UFDC-1M-16

Road Vehicles - Diagnostic Systems

2.0 Command and Data Handling Subsystem

Designing VM2 Application Boards

Transcription:

International OPEN ACCESS Journal Of Modern Engineering Research (IJMER) An Implementation of I2C Slave Interface using Verilog HDL Deepa Kaith 1, Dr. Janankkumar B. Patel 2, Mr. Neeraj Gupta 3 1(Student, M. Tech. Electronics and Communication, Amity University Haryana, India) 2(Professor, Electronics and Communication, Amity University Haryana, India) 3(Assistant Professor, Electronics and Communication, Amity University Haryana, India) 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-toanalog 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. II. I2C PROTOCOL I2C provides chip-to-chip communication using only two lines in the interface so ICs can communicate with fewer pins. The two wires in the I2C bus carry 7 bit address, R/W control bit, and data bit. The data (SDA) wire carries the data, while the Clock (SCL) wire synchronizes the sender and receiver during the transfer. Devices that use the I2C bus can perform the same function with few pins as their larger parallel interface equivalents. The I2C bus has three modes of operation: standard mode (0 to 100 kbps), fast mode (0 to 400 kbps) and high-speed mode (0 to 3.4 Mbps) [1][10]. IJMER ISSN: 2249 6645 www.ijmer.com Vol. 5 Iss.3 Mar. 2015 55

Fig.1: I2C bus configuration using masters and slaves 2.1 I2C Protocol: The I2C bus physically consists of two bidirectional active lines- serial Data line, serial Clock line and a ground connection. Each device connected to the bus has its own unique address and can act either as a receiver or a transmitter, depending on the required functionality [8]. Master will issue an 'Attention' signal to all of the connected devices known as START. Then the Master sends the ADDRESS of the device it wants to communicate with and a Read or a Write bit. All devices compare it with their own address and the one whose address is matched will produce a response signal as an Acknowledgement. If it doesn't match, they simply wait until the bus is released. On receiving acknowledgement, master can start transmitting or receiving DATA. The transferred data is 8 bits long followed by an acknowledgement bit which is repeated till whole transmission takes place. When all is done, the Master will issue the STOP condition. Fig.2: I2C Communication Frame Format 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.2 I2C Bus Terminology Transmitter: The device which sends the data or message to the receiver by the bus. Receiver: The device which receives the data or message from the bus. Master: It is the device which generates clock signals, initiates a transfer i.e. start condition and terminates a transfer i.e. stop condition. It may also act as a transmitter or a receiver. Slave: It is the device addressed by a master. Also it may act as a transmitter or a receiver. Multi master: More than one master can attempt to control the bus at the same time without demeaning the data. Arbitration: It is done to ensure that only one master controls the bus if more than one master simultaneously tries to do so and thus avoid corruption of the data. Synchronization: It is a procedure used to synchronize the clock signals of two or more devices. 2.3 General Characteristics 2.3.1 Write operation: It is done when the R/W bit is 0. Fig.3: Write operation frame format IJMER ISSN: 2249 6645 www.ijmer.com Vol. 5 Iss.3 Mar. 2015 56

2.3.2 Read operation: It is done when the R/W bit is 1. An Implementation of I2C Slave Interface using Verilog HDL Fig.4: Read operation frame format 2.3.3 START and STOP conditions: All communication begins from a START (S) and can be terminated by a STOP (P) signal. While SCL being High, a high to Low transition on the SDA line depicts a START condition and a low to High transition on the SDA line depicts a STOP condition [1] Fig.5: Start and Stop Condition 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. Fig.6: Acknowledgements in I2C protocol 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. Fig.7: Timings of data validation 2.3.6 Transmitting a byte to a slave device After start condition, a byte transmitted will identify the slave on the bus and will select the mode of operation. If the R/W bit in the address was set to 0, transmission of byte is done. IJMER ISSN: 2249 6645 www.ijmer.com Vol. 5 Iss.3 Mar. 2015 57

2.3.7 Receiving a byte from a slave device Once the slave has been addressed and the slave has acknowledged this, a byte can be received from the slave if the R/W bit in the address was set to 1(READ). III. Operation Algorithm 1. Master generates a START signal and all the slave devices listen to the bus. 2. Master sends a slave device ADDRESS + R/W bit. 3. Slave sends an ACKNOWLEDGE bit to the master if address is matched. 4. R/W bit is checked and the direction of data transfer is decided. 5. Slave sends 8-bit DATA to the master when R/W bit is 1 and receives 8-bit DATA from the master when R/W bit is 0. 6. An ACKNOWLEDGE signal is send after receiving the each 8-bit DATA by the receiver unit. 7. The DATA is repeatedly send or receive if there is no STOP signal. 8. The Master sends a STOP signal if data transmission is done. IV. Functional Description Of I2c Slave The I2C slave module designed here supports the major features of I2C specification. It responds to the commands issued by an I2C master. The I2C slave acknowledges the successful receive of address or data by pulling down the sda line during the ACK stage. This provides the handshaking mechanism to the connecting devices. When a slave cannot process the information fast enough it informs the master using few techniques. The first is slave simply does not respond during the ACK stage which causes the master to issue a stop command and restart transmission. The second is slave can use a clock stretching technique by pulling down the scl line as long as it needs. This helps in timing synchronization. The master will wait until the scl is released and continue to complete the previous transmission. 4.1 Input/ Output Connections: The various input and output connections for the I2C component are below. sda in/out: This is the I2C data signal. It is a bi-directional data signal used to transmit or receive all bus data. scl in/out: This is the master generated I2C clock signal. The slave although never generates the clock signal, but it may hold it low until it is ready to NAK or ACK the latest data or address. 4.2 Functional diagram of I2C Slave: I2C module provides interface to I2C bus and the peripheral devices that are connected to the bus. SCL and SDA here are bidirectional lines. The functional diagram is shown in the figure below Fig.8: I2C Slave functional diagram V. Simulation And Result The result obtained after simulation using ModelSim is shown below. Here, after matching the address of slave, read or write operation with the desired slave is performed accordingly. IJMER ISSN: 2249 6645 www.ijmer.com Vol. 5 Iss.3 Mar. 2015 58

Fig.9: Output waveforms showing read operation Fig.10: Output waveforms showing repeated write operation The Resistor-transistor logic diagram viewed from XILINX 14.1 is shown in figure below Fig.11. Technology tree schematic of the I2C Slave IJMER ISSN: 2249 6645 www.ijmer.com Vol. 5 Iss.3 Mar. 2015 59

VI. Conclusion And Scope The ideal I2C bus has high performance, low cost, flexibility, easy upgradability. I2C bus controller is designed in verilog and simulated in ModelSIM. The working of I2C is software addressing based which can attach large number of devices by using only two lines SDA and SCL and pull up resistors. Any low speed peripheral devices can be interfaced using I2C bus protocol as master. It provides the efficient data transfer and synchronization by using acknowledgement and clock stretching. This can be implemented as a unit in a network that contains multiple masters and slaves to coordinate the entire system by clock synchronization techniques. 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 IJMER ISSN: 2249 6645 www.ijmer.com Vol. 5 Iss.3 Mar. 2015 60