I2C Protocol

Introduction to the I2C Protocol

The I2C (Inter-Integrated Circuit) protocol is one of the most used communication protocols in embedded systems. It allows communication between multiple devices using only two lines:

Each device connected to the I2C bus has a unique address. Communication always happens between a Master device (controller) and one or more Slaves (peripherals).

Basic Operation:

  1. The Master starts communication by sending a START signal.

  2. The Master sends the Slave address + read/write bit.

  3. The Slave acknowledges the address by sending an ACK (acknowledge).

  4. The Master transmits or receives the data.

  5. The communication ends with a STOP signal.

 

Creating the Project in ChipInventor

In this tutorial, we will create a project that uses the I2C protocol to read data from an ADC (Analog-to-Digital Converter).

Initial Steps:

 

Understanding the Project Blocks

The main blocks used in this project are:

Block

Function

startAll

Generates the initial signal for the system to start operating.

i2c

Controls the I2C communication, performing read and write operations.

adc

Controls the communication steps with the ADC via I2C.

adcController

Controls the data reading flow and stores the results.

 

Assembling the Blocks in ChipInventor

Below are the connections that must be made between the blocks:

Block: startAll
Block: i2c
Block: adc
Block: adcController

 

 

Project Simulation

  1. Access the Simulate tab.

  2. Click Advanced Simulation.

  3. Click Menu → Run Iverilog.

  4. Check for errors.

  5. If necessary, correct the blocks and connections.

 

FPGA Synthesis and Programming

  1. Access the Synthesis tab.

  2. Click Start Synthesis.

  3. If all items turn green, connect your FPGA to the PC.

  4. Select the correct port.

  5. Click Flashing to program the project.

 

Hardware Validation

With the system programmed, perform the tests:

  1. View the values read from the ADC.

  2. Validate if the I2C protocol is working correctly by observing the received data.

 

Wrapping Up

Congratulations! You have developed a complete I2C communication project using the ChipInventor platform.

Now that you understand the I2C protocol, you can expand this knowledge and implement communication with other sensors and devices.