I2C

From XinaBox Wiki!
Jump to: navigation, search

I2C is short for Inter-IC, a type of bus designed by Philips Semiconductors in the early 1980s, which is used to connect integrated circuits (ICs). I2C is a serial protocol for two-wire interfaces to connect low-speed devices like microcontrollers, EEPROMs, A/D and D/A converters, I/O interfaces and other similar peripherals in embedded systems. I2C is a multi-master bus, which means that multiple chips can be connected to the same bus and each one can act as a master by initiating a data transfer. I2C is used in many devices, especially video devices such as computer monitors, televisions and VCRs.

Other terms:

  • SMBus: This is a more refined definition of I2C protocol configuration. The I2C bus and the SMBus are both popular 2-wire buses that are essentially compatible with each other. Normally devices, both masters and slaves, are freely interchangeable between both buses. Both buses feature addressable slaves (although specific address allocations can vary between the two buses). (see maxim integrated for further explanation).
  • TWI: this is another I2C protocol that was developed by I2C.org. TWI stands for Two Wire Interface and this bus is identical to I2C. The name TWI was introduced by Atmel and other companies to avoid conflicts with trademark issues related to I22C. A description of the capabilities of TWI interfaces can be found in the data sheets of corresponding devices.
  • USI:  USI is the name of the peripheral block. Universal Serial Interface.

The Inter-integrated Circuit (I2C) Protocol is a protocol intended to allow multiple “slave” digital integrated circuits (“chips”) to communicate with one or more “master” chips. I2C only requires  it two signal wires to exchange information. A synchronous serial interface always pairs its data line(s) with a clock signal, so all devices on a synchronous serial bus share a common clock. This makes for a more straightforward, often faster, serial transfer, but it also requires at least one extra wire between communicating devices. Examples of synchronous interfaces include SPI and I2C. I2C can support a multi-master system, allowing more than one master to communicate with all devices on the bus (although the master devices can’t talk to each other over the bus and must take turns using the bus lines). Each I2C bus consists of two signals: SCL and SDA. SCL is the clock signal, and SDA is the data signal. The clock signal is always generated by the current bus master. In order to know where the signal must travel each slave device must have an address. This way the master controller can communicate with any slave device but the ‘slaves’ cannot communicate with the ‘master’. After the address frame has been sent, data can begin to be transmitted.

[p><img src="//cdn.shopify.com/s/files/1/1734/1465/files/Screen_Shot_2017-02-05_at_10.20.52_PM_large.png?v=1486326081" alt="" /></p]

The signalling must adhere to a certain protocol for the devices on the bus to recognize it as valid I2C communications:

  • Address selection: For ☒CHIPs that use the same components (such as ADC etc.), they have different addresses and it is used to ensure that the same address is not repeated in a set. ADC stands for Analogue Digital Donvertor.
  • Devices using common component such as ADC with different addresses: common components such as adc come with more then one address, which can be found on the data sheet. This allows the system to be configured to use a different address to ensure that the same address is not used in the same system. The address can be changed using a switch or solder pad provided on the ☒CHIP. 
  • Solder pads for alternative: As mentioned in the configuration pages, a solder pad can act like a switch and can be used to change the I2C address on the ☒CHIP. [Link to configuration pages]
  • Pins used on core modules: if you want to communicate with the module, such as in arduino, you need to specify which pins are running SDL and which are running SCL. In order to write a programme to the core modules, the SDL can only communicate with SDL (and the same with SCL) and hence the correct pins need to be connected to each other. 
    • The sensor ☒CHIPs cannot be programmed but they need to have the right pins connected to ensure that they can communicate. (In this case the sensor would be the 'slave')
  • Bus speed:A bus is a system which allows many devices to communicate to each other over a single set of wires.  While it may be called a bus, USB is not a true bus at the hardware level, as connecting multiple devices requires a hub.  A bus such as I2C allows new devices to be added simply by attaching their SDA and SCL connections to the existing line.  Busses (I2C, USB, PCI, etc) all use an addressing system, in which each device has a unique address.  An address in this case is simply a binary number, and all messages to that device must be sent with that address.
  • ☒BUS: One the ☒CHIPS, the ☒BUS connector has 10 pins (5 on either side). Of these 10 pins, 4 pins are used for power and 6 pins are used for data transfer.
    • 4 power pins for:
      • A ground pin GND (0 V)
      • Provides 3.3 V
      • V source is a battery or power source (which can be used to supply raw power)
      • V in is a battery input pin which has not been used but one possibility would be to use it for solar power etc.
    • 6 data pins for:
      • 2 pins used for I2C: one is for SDA and one is for SCL
      • 2 pins used for serial (aka UART): one is for TX and one is for RX
      • 2 pins used for programming: one pin is for programming other core modules and one pins is a reset pin. </li>
  • Multimaster: I2C can support a multi-master system, allowing more than one master to communicate with all devices on the bus (although the master devices can’t talk to each other over the bus and must take turns using the bus lines).