Cookie
Electronic Team, Inc. uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.

Establishing Serial Communication in Embedded Development

Olga Weis Olga Weis

Contents

  1. Common Serial Communication Types
    1.1 UART (Universal Asynchronous Receiver-Transmitter)
    1.2 I2C (Inter-integrated Circuit)
    1.3 SPI (Serial Peripheral Interface)
    1.4 CAN (Controller Area Network)
  2. Serial Testing and Debugging Software
    2.1 Virtual Serial Port Driver
    2.2 Serial Port Monitor
    2.3 Hardware serial port splitters
    2.4 RS232 serial spy monitor cable
  3. Hardware or Software for serial embedded system development?

Due to its simplicity, serial connection is often used internally and externally in embedded technology. There are different types of serial communication devices in embedded systems, with different purposes and quirks. When developing these systems, it’s important to choose the right type. That’s why we’re going to explore and compare some common serial communication protocols, and also suggest some universal tools that will be useful regardless of your choice.

Common Serial Communication Types

UART (Universal Asynchronous Receiver-Transmitter)

UART is one of the simplest, earliest communication protocols in embedded systems. The connection can only be established between two devices. Each has a transmission and reception pin, and both channels are one-sided. The data is converted into a binary signal and sent in byte-long packets. The packets also contain start and end bits, and a bit for error detection.

UART is asynchronous - it doesn’t use any additional lines to send clock pulses, using start and end bits to synchronize instead. Many parameters, including baud rate (bits per second), must be the same on both devices. Baud rates have to be comparatively low to avoid desynchronization. Generally, choosing UART in embedded systems over newer protocols wouldn’t be a matter of technical improvement, but rather, cost and time saving when working on prototypes or adding debug capability.

In some cases, by using a UART-to-Ethernet converter, UART data can be transmitted over an Ethernet network, enabling communication between devices that are not directly connected.

Applications:

  • Debugging often doesn’t require the complexity and speed of other protocols, and UART provides a quick and dirty way to implement it.
  • Device connection to PCs through serial ports or serial-to-USB converters.

Pros: Easy to work with, potentially longer maximum connection range.
Cons: Low rate of data transfer, can only connect two devices.

I2C (Inter-integrated Circuit)

I2C allows multiple - potentially large amounts - of devices to be connected to the same bus. An I2C bus consists of two wires - a data line and a clock line, and each device connects to it with a data pin and a clock pin.

When a device on the bus is transmitting, all other devices receive the message, so a few bits need to be used up to specify an address. In addition, it blocks all other devices from sending messages, putting a hard limit on how fast data can be exchanged.

I2C is a major step up in complexity from UART, due to having to deal with concurrency, while also lacking the advancements that boost the speed of later communication protocols in embedded systems.

Applications:

  • Low-speed systems that exchange small amounts of data, like sensor readings.
  • Device identification in PCs, such as Serial Presence Detect on RAM modules and DDC for display devices.

Pros: The simplest way to connect multiple devices with full mutual access.
Cons: Slow, much more demanding than UART.

SPI (Serial Peripheral Interface)

As its name suggests, SPI is commonly used to connect multiple peripherals to a controller. Currently, this is a very common type of serial communication devices in embedded systems. The controller chooses which peripheral is currently listening, then exchanges data with it. Unlike I2C, selection is done via individual lines - so each new attached device needs its own CS line, but the clock line and data in/data out are shared between them all. There are also alternative “daisy chain” setups, where a sequence of peripherals feed data into each other and share the same CS line.

SPI is faster than UART due to having a clock line, and faster than I2C since it’s actually simpler, with no need to transmit the receiver address with every message or account for the possibility of multiple controllers.

Applications:

  • Short-range, high-speed systems, where there’s a need to connect SD cards, LCD displays, RTC modules, etc.

Pros: Faster than I2C and UART.
Cons: No support for multiple controllers on the same bus, individual pins needed for every peripheral.

CAN (Controller Area Network)

A CAN bus consists of two wires, but unlike I2C, neither of them is a clock line. Both carry the same data (just a binary signal from any device on the bus), and they are coiled around each other to minimize the effects of electrical interference. In general, CAN is adapted to higher ranges - while the previous buses could span several meters at best, a Controller Area Network bus can stretch on for about 40.

Similarly to I2C, connected devices - also known as CAN nodes - only transmit if no other device is currently transmitting, and the data frames (the packets) include an identifier to specify the destination.

This bus is intended for industrial applications, such as communication in automotive embedded systems. Predictably, the bandwidth is much lower than any aforementioned connection types, often by an order of magnitude.

Applications:

  • Automobile electronics, with CAN being the current standard
  • Other industrial applications, such as production lines

Pros: Long range, high reliability, simple implementation
Cons: Low bandwidth

How to choose the right one?

The best way to determine the right type of serial connection for your case is to simply look at how similar cases are being handled by other technicians. It’s likely that they have already accounted for the potential needs of their systems while choosing the protocol. If not, you will at least have a good starting point, and will get a better answer by addressing the flaws in their choice.

Serial Testing and Debugging Software


Developers of embedded systems need to be able to monitor the behavior of their systems. One important facet of that monitoring is serial port debugging. A serial interface may well be the only way that you can communicate with the embedded system. Electronic Team, Inc. delivers a comprehensive, full-featured serial port software package that will make working with your serial-based embedded systems much easier and more efficient.

Let’s take a look at some of the best embedded software and hardware development tools for those engineers working with serial ports and embedded systems.

Virtual Serial Port Driver and Virtual Serial Port Driver PRO

This useful application can create virtual COM ports with configurable baud rate and signal line connection. With it, you can easily pass serial output from one application to another.

vspd interface

Virtual Serial Port Driver PRO (VSPD) introduces even more features:

  • Creating “bundle connections” that collect input from multiple input ports and send it to multiple destination ports
  • Merge multiple inputs into a single OUT port
  • Split a single input port to make it accessible to multiple applications
  • An automatic Switcher that will automatically choose a free port for apps that can’t find one

It’s an absolute must if you’re writing serial connection software, or testing how your hardware interacts with existing software.

Serial Port Monitor


Serial Port Monitor (SPM) is a versatile suite of tools that not only allows you to store and view input from your serial devices in many different ways, but also to send data directly to it through the built-in terminal.

spm interface

It can:

  • Resend the same input to the device from an entire session with the Playback feature
  • Display data in various modes, including tables and terminal output
  • Keep track of multiple COM ports at the same time
  • Save all the info from your sessions to the clipboard or a text file

Hardware serial port splitters


Hardware serial port splitters

Physical devices that can perform some of the functions of the software tools discussed above are available for the embedded system developer. You can obtain cables that allow you to share the signal from a single serial port with two or more devices or applications.

Disadvantages: They offer less flexibility than the software alternative as they are limited in the number of connections that can be made available. Another constraint is the length of cable that can be used and the general task of cable management that can become unwieldy as the need to share signals grows.

RS232 serial spy monitor cable


RS232 serial spy monitor cable

Serial monitoring or sniffer cables can be obtained that work in either half or full-duplex mode. They work by providing another connector to an RS232 cable. A device attached to that third connection can monitor the communication traveling between the two ends of the RS232 cable. Depending on the type of device or application that is attached, you may be able to log the data for later use.

DCAClab is an online electric circuits simulator for STEM and technology education, it helps mechatronics teachers to explain circuits for their students in ease. Simulates and troubleshoot broken circuits in a rich simulation environment, provided with real looking components, realistic oscilloscope and multimeter with various functions to use.

Hardware or Software for serial embedded system development?


When choosing tools for serial embedded system development you need to consider ease of use and flexibility. Undoubtedly, the software applications designed specifically for working with serial devices are more powerful and offer you options as your testing environment changes.

Additional benefits of a software solution include eliminating the need to purchase expensive cables and the ability to monitor serial activity remotely. If you are serious about embedded system development you should take a close look at these software tools. They will make your development life much more pleasant and give you a step up on the competition.

small logo Serial Port Monitor
#1 at Serial Port Software
Serial Port Monitor
Log and analyze serial port activity
4.8 rank based on 345+ reviews
Get a download link for your desktop
Submit your email address to get a link for quick download on your desktop and get started!
or