Motivation
Two of the most popularly used protocols in embedded design systems are the SPI and I2C communication protocols. However, a lot of embedded systems only support a singular communication protocol, which creates a problem when an embedded system with a different communication protocol wishes to communicate with a device. We aim to create a bidirectional SPI to I2C converter which allows SPI devices to communicate with other devices utilizing its I2C bus. Since it is not possible to directly connect SPI with I2C peripherals, our converter will act as an interface to allow data transfer from one device to another at high speeds.
Features of bidirectional I2C to SPI Converter |
Key Attributes |
Data Transfer |
· Medium Data transfer rates depending on implementation · Transfer rate dependent on SPI-Master and I2C Master clock rate · SPI and I2C word length to be user–defined · Unlimited number of words can be transferred
|
Addressing |
· 256 slave devices can be connected to the SPI master core. · 128 slave devices can be connected to the I2C master core. |
Synchronization |
Baud rate will be user-programmable where CLK /2048 ≤ SCLK/SDA ≤ CLK
|
Low Power Consumption |
The power consumption state will be turned off when no data transfer is needed, and all internal activity will be turned off.
|
Chip |
Single-chip will be utilized for implementation.
|
Implementation |
Synchronous design based on positive edge clock detection.
|
Interface |
The handshake mechanism will be used to start or stop data transfer based on clock synchronization.
|
Data Integrity |
The data rate is customizable based on which convertor (SPI to I2C or I2C to SPI) is being utilized to ensure there is no data loss. |
I2C stands for Inter-Integrated Circuit, originally designed by Philips semiconductors in 1982 [1]. It can be described as a bus interface connection protocol that is included in devices for the purpose of serial communication. It’s a widely used protocol for short-distance communication. The I2C protocol is a two-wire serial interface, also known as a bidirectional wire interface. I2C communication requires two wires or pads: SDA and SCL. SDA is the serial data line and SCL is the serial clock line. The SDA is a bidirectional line that is used to share data between the master and slave. The SCL line carries the clock signal. The master generates and controls the SCL line. The master can be used to communicate with multiple slaves [2].
SPI stands for Serial Peripheral Interfaces, originally designed by Motorola in 1979 [3]. SPI is a synchronous serial communication interface that is used for short-distance communication. SPI operates at Full Duplex, which means that it has two different lines for input and output. As a result, data can be received and transmitted at the same time. SPI supports a single master multi-slave configuration. SPI is also known as a four-wired interface, including SCLK, MOSI, MISO, and SS. SPI operates in Master-Slave architecture in which the device initializing the clock (SCLK) becomes the master. MOSI (Master out Slave in) is the data line carrying data from master to slave. MISO (Master in Slave out) is the data line carrying data from slave to master. SS (Slave Select) is the signal from the master to select the slave, this line is active low and is turned high to disconnect the slave from the SPI bus [4].
Our proposed solution is to make a bi-directional I2C-SPI converter for on-chip communication. A protocol converter is capable of converting the standard communication (e.g I2C) of one device in order to make it suitable for communication (e.g SPI) with another device. It has the ability to transmit data between two different communication standards. For our proposal, we make two converter: I2C to SPI and SPI to I2C These two will work together as bi-directional I2C-SPI converters as shown in Figure 1.
Figure 1: I2C to SPI Bi-Directional Converter
When the chip enable is zero the proposed architecture is SPI to I2C converter. The converter will have one SPI master and an I2C slave. The input to the converter will be the MISO, MOSI, SS, and SCLK from the SPI master controller. The converter will convert these signals to be suitable for I2C communication. The output from the controller will be SDA and SCL and they will be fed to the I2C slave [5].
Figure 2: SPI to I2C converter
When the chip enable is one the proposed architecture is I2C to SPI converter. The input to the converter will be the SDA and SCL from the I2C master controller. The converter will convert these signals to be suitable for SPI communication. The output from the converter will be SCLK, MOSI, MISO, and SS_N, which will be fed to the SPI Slave controller [6].
Figure 3: I2C to SPI converter
[1] Y. Duan, “I2C data transfer program design and communication protocol improvement,” Lecture Notes on Wireless Networks and Communications, vol. 1, no. 1, pp. 1–16, 2018, doi: 10.23977/lnwnc.2018.11001.
[2] F. Leens, “An introduction to I2C and SPI protocols,” IEEE Instrumentation & Measurement Magazine, vol. 12, no. 1, pp. 8–13, Feb. 2009, doi: 10.1109/mim.2009.4762946.
[3] Shaik. Fazil. Ahmed and Y. Murali, “Implementation Of I2c Multi Task And Multi Slave Bus Controller Using Verilog,” International Journal Of Engineering And Computer Science, Aug. 2015, doi: 10.18535/ijecs/v4i8.61.
[4] X. C. Tian, J. Li, Y. B. Fan, X. N. Yu, and J. Liu, “Design and Implementation of SPI Communication Based-On FPGA,” Advanced Materials Research, vol. 291–294, pp. 2658–2661, Jul. 2011, doi: 10.4028/www.scientific.net/amr.291-294.2658.
[5] B. Jayaramudu, “Implementing Communication Bridge between I2C and AHB,” International Journal for Research in Applied Science and Engineering Technology, vol. 6, no. 5, pp. 2254–2259, May 2018, doi: 10.22214/ijraset.2018.5367.
[6] T. M. L. del Río, L. N. Oliva Moreno, and A. G. Juárez Gracia, “Implementation of the communication protocols SPI and I2C using a FPGA by the HDL-Verilog language,” Research in Computing Science, vol. 75, no. 1, pp. 31–41, Dec. 2014, doi: 10.13053/rcs-75-1-3.
Team Lead:
Hareem Rashid (i180895@nu.edu.pk) (FAST-NUCES)
TEAM MEMBERS:
Engr. Ali Sabir (FAST-NUCES)
Syeda Zoha Haider (FAST-NUCES)
Rohail Ahmed (FAST-NUCES)
M Usman Kiani (FAST-NUCES)
Muhammad Bilal (FAST-NUCES)
Muhammad Awais Butt (FAST-NUCES)
Dr. Hassan Saif (FAST-NUCES)
In an embedded system, multiple communication protocols are used in order to transfer data, such as UART, SPI, USB, I2C, etc. For data transfer with a certain communication protocol, the system is required to have at least one controller block for that communication protocol. Due to this, the complexity of the system and the cost of manufacturing hardware increased. It is possible for an embedded system that only supports SPI communication to communicate with peripherals with I2C standard, and vice versa. In order to do make the communication possible, a bi-directional I2C to SPI converter is needed. The focus of our proposal is to design a bi-directional I2C-SPI converter for on-chip communication. The purpose of the controller will be to transform the data and commands from one device to another. It will be a bidirectional converter, which means that the converter will be able to do I2C to SPI conversion as well as SPI to I2C. Our proposed design will be able to operate at a high data transfer rate for SPI, up to almost 1 Mbits/s, and for I2C 400 kbits/s.
Final
i2c