Getting started with I2C

Revision as of 15:06, 19 October 2022 by Registered User

This article explains what is the I2C and how to use it through examples


Target description
Following this tutorial, you will:

  • Get familiar with the STM32L476RG Nucleo board,
  • Learn how to program and use a I2C

Hardware
The hardware requirements to start the application are the following:

  • 2 boards STM32L476RG [1] board


1. I2C

I²C (Inter-Integrated Circuit) is a two-wire serial communication system used between integrated circuits which was originally created by Philips Semiconductors back in 1982.
The I2C is a multi-master, multi-slave, synchronous, bidirectional, half-duplex serial communication bus.

1.1. I2C Overview

  • SDA (Serial Data) is the line where master and slave send or receive the information (sequence of bit).
  • SCL (Serial Clock) is the line dedicated to the clock to synchronize the data flow.

i2c buq.png
SDA and SCL lines need to be pulled up with resistors. The value of these resistors depends on the bus length (the bus capacitance) and the transmission speed. The common value is 4.7kO. In any case, there are many guides to size them and we refer their reading to the more attentive reader.

1.2. I2C Modes

Standard-Mode (Sm), with a bit rate up to 100 kbit/s
Fast-Mode (Fm), with a bit rate up to 400 kbit/s
Fast-Mode Plus (Fm+), with a bit rate up to 1 Mbit/s

1.3. I2C Frame

2. Create the project in STM32CubeMX


[[category:Getting_started_with_STM32_system_peripherals | 15]]

No categories assignedEdit