Interface buses

Максим Исаев
Reading time: 8 min

Data bus interface

Through the data bus, an exchange takes place between the master and various electronic devices, according to certain signals supplied by the master to the slaves. Data is transmitted according to a special protocol developed by the manufacturer. The bus has start and stop bits. The bits are intended for the microcontroller to understand what needs to be done on a rising or falling pulse, transmitting or receiving. We study in more detail the principle of operation and the logic of the operation of buses in the course on electronics and circuitry.

I2C bus

I2C (Inter Integrated Circuit) is a simple bidirectional data exchange bus. It has two wires. Developed by Philips in the 80s. Widely used in integrated circuits. The bus is designed as a simple signal bus.

The wires have the following names:

  • SDA (Serial Data) – data bus
  • SCL – (Serial Clock) – clock bus
Структурная схема шины I2C
Structural diagram of the I2C bus

Devices connected to the bus are attached to each of the wires. The main one is the MASTER (master unit). It generates clock signals, the beginning and end of the transfer on the data bus. Thus, impulses come from it, and data can pass in both directions.

Data can be generated by both MASTER and other “slave” devices:

  • meters
  • ADC
  • LCD
  • memory
  • electronic sensors
  • others.

All listed devices are connected to the bus in parallel. On one electronic board, there can be a large number of slave devices. The bus standard has an address. 7 bits are allocated, that is, two to the seventh power, and means the number of devices of the order of 100.

Frequencies on the bus f = 100 – 10 kbps. Therefore, it is low speed. The total capacitance on the bus must not exceed 400 pF (which is the sum of all devices connected to it). The bus power can be:

  • 3.3V
  • 5.0V

The signal lines are pulled up to the power supply through resistors, the resistance of which is from 5 to 10 kOhm. This is important because it changes the parasitic capacitance, which in turn affects the number of SLAVEs and the speed of information transfer. The length of the bus can reach several meters.

Data transfer algorithm:

  1. Data may change when a 0 (logic level) is present on the SCL bus. If a 1 (logic level) is present on the SCL, the data cannot change. In this case, there are two situations when a transition occurs on the SCL bus:
    1. from 1 to 0
    2. from 0 to 1

This means that the MASTER wants to exchange information with the “slave” devices and issues the “ATTENTION” command. During the transition:

  • from 1 to 0 – starting situation
  • from 0 to 1 – stop situation

It is important to remember that the SCL signal can only be generated by the MASTER. The entire transmission is transmitted in bytes. Bytes are transmitted bit by bit, starting with the most significant bit. In response to each received byte, the receiver exposes either an acknowledgment or a refusal.

Advantages of the I2C bus:

  • simplicity of design
  • Possibility to connect slave SLAVE without turning off the power supply

Disadvantages of the I2C bus:

  • capacity limit
Организация передачи и приема данных по шине I2C
Organization of data transmission and reception via the I2C bus

SPI (Serial Peripheral Interface) is a four-wire interface used in circuits with microcontrollers. Provides synchronous duplex data exchange. SPI works on the principle of a shift register. Registers are in different devices. One of them is MASTER. It can be a microcontroller with a clock generator that has a specific program.

SPI bus

Another device could be:

  • memory
  • temperature sensor
  • Printer
  • others

The INPUT and OUTPUT signals are used to exchange information between the master and devices. The name of the tires was formed from the abbreviated words for devices and signals:

  • MISO – Master Input Slave Output
  • MOSI – Master Output Slave Input

The main signal on this bus is SLK (CLOCK).

When the microcontroller works with several devices, additional signals will be needed to select the appropriate device with which to exchange. In this case, a sample signal – SS (Slave Select) is required. If there are N devices, then the number of outputs from MASTER increases. In this case, the signals coming from MASTER are paralleled. 

In this case, when SS is received on one output, data is transferred only from the necessary device selected by the master for exchange. In order for the devices not to interfere with each other’s work during the exchange, strobe occurs, which is carried out by the SS signal for each device.

Схема SPI шины
Schematic of the SPI bus

Advantages of the SPI bus:

  • ease of implementation
  • full duplex – data transfer from master to device and vice versa in one clock cycle
  • low requirements for clock stability, since data transfer starts on the rising edge of SCLK
Организация передачи и приема данных по шине I2C
SPI bus

Disadvantages of the SPI bus – lack of control. For example, an open MISO or MOSI bus is superimposed using software tools.

USB bus

The USB bus (Universal Serial Bus) is the most common way to connect external devices to the motherboard of a TV, laptop and other devices. This bus was developed in 1996, and has been widely used since 2000, with the advent of the first Flash.

At the moment, the bus has three standards that differ in data transfer speed:

  • USB 1 approx. 12 Mbps
  • USB 2 approximately 450 Mbps
  • USB 3 approximately 5 Gbps

The USB bus is asymmetric and works like a MASTER-SLAVE. The bus drivers are different. One of them is Downstream – controls the behavior of the data bus from the device.

The device bus consists of four conductors, which are signal wires wrapped in a protective earth. Wires come with standard color marking: red, white, green, black. The supply voltage – 5V – is transmitted through the red and black wires. And it is designed for a current of 100 mA for one device. Up to 5 external devices can be connected to one device, respectively up to 500 mA.

The device connection diagram is as follows:

Схема подключения
Wiring diagram

Differential signal transmission is carried out on the white and green wires. The transmission is controlled by encoder control transmitters, according to the appropriate signals.

The second driver is Upstream. Located on the side of the receiver, controlled by the encoder for data transmission, similar to Downstream.

The bus connectors look like this:

Схема подключения USB портов
USB port connection diagram

CAN bus

The CAN bus is designed for automotive applications. This one consists of two wires in the form of a twisted pair, closed with 120 ohm resistors. Since the wave impedance of the bus is 120 ohms. In this regard, there are no reflective signals on it, which is a great advantage in terms of noise immunity.

Any number of transceivers can be connected to the bus. from which signals are generated. If no signals are coming to the bus, the voltage on both wires is 2.5V. When a signal is received, a voltage difference is formed, and on one of the wires (high level), the voltage rises to 3.5V. And on the second wire (low level), the voltage drops to 1.5V.

Thus, a voltage of 2.0V is formed between the wires, which is recorded by all devices as an incoming signal. If there is 2.0V between the wires, then there is a signal. If there is no such difference, then there is no signal. Therefore, if there is a signal, then the level is active. This means that there is a logical 0 at the input of the transceiver. And if there is a logical unit at the input of the transceiver, this means there is no signal. Zero is formed if there is a signal on the high-level wire.

An important property of the line is noise immunity, since it is made in the form of a twisted pair, and if there is pickup from the operation of devices, then they come in phase. And these pickups do not change the difference. Since the receiver responds to the difference, the pickup on the bus wires is the same, and the pickup voltage difference will be zero. What does not affect the useful signal.

CAN bus can be up to 1000 meters long. The limitation is the data transfer rate:

  • up to 40 meters – 1 Mbps
  • up to 1000 meters – 10 kbps

Currently, there are various CAN bus transceivers. Controllers with this bus are also available.


  • Buses are needed to transfer information between the microprocessor and peripheral devices. The huge difference in tires allows electronic devices to work depending on the performance of a specific task.
  • It is important to understand the principle of operation and organization of signal transmission over these buses, which is necessary for the exchange of information between devices.
  • You can learn how to connect devices to buses after completing the training in soldering microcircuits.
Rate the material
1 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 5


0 Комментарий
Inline Feedbacks
View all comments