Introduction
I’ve discovered something amazing - we are stronger together. And so are electronics! How do you heighten the quality of communication between two parts that hardly understand each other? Worry no more for we will explore some of the answers. It’s all about interfacing!
Understanding interfacing techniques, including communication protocols, data transfer methods, and device drivers, is essential for electronics makers to connect their devices to other systems. Without interfacing no electronics could talk to each other and that’s just so very sad, so we better start learning how to connect them!
Data transfer methods
Transmission modes is a term of 3 methods in which modules can either transmit data, receive data or both at the same time. The 3 types are simplex, half-duplex and full-duplex.
Simplex
Simplex is described as 2 modules - the transmitter and receiver, see Figure 1. One module is the sender and the other module is the receiver. They cannot change roles and it is thus only a one-way communication.
Figure 1: Illustrates the concept of the simplex transfer method. As indicated by the direction of the arrow, the data travels only from the sender to the receiver module.
The transmitter module can use the full capacity of the communication medium, for example, radio signals and/or cables, to transmit data. Simplex is seen between a computer and a keyboard or between a radio controller and a remote-controlled toy plane.
Half-duplex
Half-duplex is when 2 modules can switch between the Transmitter and Receiver roles, see Figure 2. For half-duplex both modules can transmit and receive data. They can switch roles. However, it is important to note that each module cannot have both roles at the same time.
Figure 2: Illustrates the concept of the half-duplex transfer method. As indicated by the direction of the arrows, data can be transmitted and received by both modules. But one module can only hold one role at the time.
At half-duplex you can again, as with simplex, use the full capacity of the communication medium. Half-duplex is for example seen in the data transfer in walkie talkies.
Full-duplex
Full-duplex is where 2 modules can have both roles at the same time - both modules can transmit and receive data at the same time, see Figure 3.
There is a limitation of full-duplex in terms of transmission medium capacity. As we learned earlier both half-duplex and simplex can use the full capacity of the communication medium, whereas for full-duplex this highway of data must be shared between each module or the modules must each have their own transmission medium.
Figure 3: Illustrates the concept of the full-duplex transfer method. As indicated by the direction of the arrows, data can be transmitted and received by both modules at the same time.
Full duplex is for example used in the communication between phones and in the microcontroller Arduino UNO.
Serial and parallel communication
Serial
The data that travels between the transmitter and the receiver modules can be separated into serial and parallel communication. In other words data may be transmitted either serially or in pairs. Serial data is when the bits are transmitted via a connection one by one per a certain clock cycle, see Figure 4.
Figure 4: Illustrates serial communication between two modules. Here we notice that the values for the data that is transmitted enter the receiver module one by one.
The advantage of serial communication is that it is cheaper and simpler than parallel communication. Serial communication is also typically used over longer distances than parallel communication
Parallel
Parallel transmission consists of several cables, one cable for each bit you want to transfer per clock cycle, see Figure 5.
Figure 5: illustrates the concept of parallel communication. Each cable represents a bit that is transferred per clock cycle.
Parallel communication is often used at short distances. The advantage of parallel communication is that it is faster compared to serial communication as more information is transmitted and received per clock cycle.
Communication protocols
A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any kind of variation of a physical quantity. The protocol defines the rules, syntax, semantics and synchronization of communication and possible error recovery methods.
Inter and Intra system protocols
In order to gain an understanding of inter and intra system protocols, it must be established what a protocol itself is. A protocol is a set of rules that two or more modules follow to understand what they communicate to each other. An abstraction could be the communication between two people who speak Danish and a 3rd person who speaks Indian. If the Danes can't speak Indian and the Indian can speak Danish, the communication between the two parts just emerges as a random composition of letters or weird noises. To communicate with each other they need a translator.
Inter system protocols and intra system protocols, are distinguished if two modules communicate within a system, such as a printed circuit board, or whether it is a module that communicates with another module outside the system. Intra system protocols are protocols which communicate internally within a system. This would in our abstraction be when the Danish speaking and Indian speaking people can communicate without outside assistance and understand each others languages. The inter system are then protocols that communicate beyond a system.
The method in which the data is transferred, whether it is inter or intra, is determined more specifically by which communication protocol that is in use. Some of these communication protocols could be, SPI, I2C and UART to name a few.
SPI
SPI uses the "MasterSlave" principle. SPI, Serial Peripheral Interface, has synchronous transmission. SPI transmits serially and has no built-in error check. The communication between master and slave (you can kinda think of it as the transmitter and receiver modules), is full duplex - for each clock cycle there is transmitted one bit from both devices.
The protocol requires 4 connections, namely MISO (Master Input Slave Out) MOSI (Master Out Slave Input), SS/CS (Slave select/chip select) SCLK(Clock).
It works so that one module is master and the other modules are slaves. The master administers the other modules and determines the speed of communication.
I2C
I2C, IIC "I squared C" or "Inter-Integrated-Circuit", is a bus protocol, which transmits data serially and synchronously. I2C can have multiple master's and slave's in a system. The protocol requires 2 connections SDA (Serial DAta) and SCL (Serial CLock). SCL is a control bus with the clock signal which in turn, determines the speed of data transmission.
I2C sends data in packages and uses start and stop conditions to ensure the data is transmitted and received correctly, see figure 6.
Figure 6: The data, or the message, contains a starting bit, which will be followed by the address specific to the slave with whom the master will communicate. From there is a read/write bit, which tells the slave whether the master will read or write to it. ACK/NACK is an acknowledge/not-acknowlegde bit, that is sent from the recipient of a message, either a slave or master, to tell that the package has been received correctly. In this figure we see 2x 8 bits that are being transmitted after the first ACK/NACK. These data packages are then acknowledge or not-acknowlegde before the stop condition of the package.
UART
The UART protocol is a circuit of 2 devices in which 1 can take a parallel signal, convert from parallel to serial and transmit this to another device, which converts the signal back to parallel. UART transmits serially and asynchronously. It doesn't require a clock cycle. The circuit can have a maximum of 1 master and 1 slave.
UART data packets are constructed as illustrated on figure 7.
Device drivers
So now we know a little more about how data can be transmitted and received in electronics. But where exactly do we transmit to and where do we receive the data that has been transmitted? For that we use device drivers. So what are device drivers?
A device driver is a computer program that allows a computer's operating system to communicate with various kinds of hardware that connects many different modules to each other. The idea of a driver is that the hardware manufacturer can make just one type of hardware, but make it work on different operating systems. We can now imagine that such a device driver must take into consideration a lot of different factors, for it to be used in different forms of communication between electronics and be as effective as possible!