Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Start condition

    • The bus is pulled low and then set back high. This is done to alert the devices that a transaction is beginning.

  • Address Frame

    • 7 (or 10, depending on your IC’s) address bits are sent to the bus

      • 7 bits means that there are only 127 possible addresses and thus address conflicts are possible. The methods to resolve them are as follows:

        • Some IC’s offer the ability to change their address by setting an external pin high or low

        • Multiplex the SDA and SCL lines between the conflicting peripherals by either using the internal MCU mux or an I2C mux

        • Use an I2C address translator

        • Power down a conflicting device when wanting to talk to another one

        • Change IC’s (alternate part numbers from the same manufacturer could work)

    • Read/Write bit

      • Indicates where the controller wants to send or receive data

  • ACK bit

    • Confirms that the IC has acknowledged the address frame and will listen/respond

  • Data frame(s)

    • Contains the 8-bit data frames to transmit the data as desired.

    • No limit on the number of data frames

  • Stop condition

    • Similar to start condition

Note that while a peripheral is not supposed to generate a clock signal, if more processing time is required by a peripheral it may pull the clock signal low. It is the controller’s responsibility to recognize this situation and set an appropriate timeout. This is referred to as clock stretching.

...

Hardware specifics

Unlike SPI which is a push-pull protocol, I2C is an open-drain protocol. This means that instead of the pins being explicitly driven high or low, the bus is permanently pulled high by pull-up (https://learn.sparkfun.com/tutorials/pull-up-resistors/all ) resistors and devices can pull the bus low to transmit information.

...