I2C SPI USB CAN eSPI Cable Testing View All Quick Start Guides User Manuals Software Downloads Knowledge Base Videos Case Studies App Notes White Papers Sales Support About Us
Products Blog Sales Support Contact Search
Comparing FPGA vs Microcontroller – Which is Best for Your Needs?
Jessica Hopkins

When developing embedded systems, various types of components are used to create a functioning system, including a combination of a computer processor, memory, and input/output peripheral devices. Each embedded system is different and ranges in complexity depending on its desired objective. One of the decisions engineers must make when developing an embedded system is what type of processor or processing system is used to execute computational tasks and manage various components within the system. Two options that are widely used include a microcontroller and an FPGA, or a field programmable gate array.

In this article, we’ll provide background on processors used in embedded systems, the differences between a microcontroller and an FPGA, and the advantages and disadvantages of each.

Processing Systems within an Embedded System

An embedded system is essentially a computer that is designed to control or perform certain functions either by itself or within a larger system. At its core, a processor is used to carry out computations and perform real-time operations.

Different processors or processing systems in embedded systems can include but are not limited to:

  • Microcontroller: which includes one or more CPUs (central processing units) along with memory and programmable input/output peripherals
  • Microprocessor: which is also known as a central processing unit that executes and manages the logical instructions
  • Digital signal processing (DSP): which is used to process digital signals such as image and video
  • Field-programmable gate arrays (FPGA): which is integrated circuit designed to be configured by a customer or a designer after manufacturing

Depending on the application at hand, certain ones may be more fitting. Microcontrollers and FPGAs are commonly compared, so we’ll provide insight into each of these and which ones are best for certain usages.

What is a Microcontroller?

A microcontroller is a small computer on an integrated circuit, or chip, that includes a CPU, memory, and peripheral input/output devices. Microcontrollers are programmed to perform a specific task and manage other components within the system, including memory, such as RAM or ROM, and input/output devices that can include LED displays, switches and various types of sensors. In order for the hardware components to function, embedded software is used to provide instructions for the system; microcontrollers are often programmed using higher-level languages such as JavaScript, Python, and C.

 

blue arduino board with microcontroller Image by Tiki Shabudin from Pixabay

What is an FPGA?

FPGAs are integrated circuits, or ICs, which are sets of circuits on a chip that are designed to be configured by a customer or a designer after manufacturing. FPGA architecture consists of thousands of configurable logic blocks (CLBs) which includes look-up tables (LUTs), flip-flops (FFs) and multiplexers (Muxes). The LUTs are the core of the FPGA that implements Boolean equations and is the primary element that handles logical function.

These CLBs are surrounded by a system of programmable interconnects (switches and wires) that offer connectivity between the CLBs, logic blocks, and input/output (I/O) blocks. The input/output blocks provide the user interface between the FPGA and external devices. All of these components together function as a comprehensive multi-core processor.

When using FPGAs, engineers will program the hardware of the device rather than writing software to run on a predefined processor. FPGAs are primarily programmed using hardware description languages (HDLs).

FPGA platform with Mac Computer FPGA Platform; Photo by Sourabh Belekar on Unsplash

Differences Between FPGA and Microcontroller

One of the main differences between a microcontroller and an FPGA is that an FPGA doesn’t have a fixed hardware structure, while a microcontroller does. While FPGAs include fixed logic cells, these, along with the interconnects, can be programmed in parallel by using HDL coding language. This means FPGAs are not predefined and can be altered based on the user’s applications.

Microprocessors on the other hand do have a fixed hardware structure, which means that all of its components, including the processor, memory, peripheral devices, and connections are predefined. By using software, designers can program the processor to perform desired tasks.

Choosing Between FPGA and Microcontroller

So when would one be best over the other? Generally, processors including microcontrollers are more suitable for routine control of particular circuits, such as using a switch to turn on and off a device. FPGAs are suitable for applications that are more customized and require higher processing power or speeds. For example, processing high-resolution video data would be best with a FPGA platform.

Embedded engineers often use microcontrollers in embedded devices as they are easier to program, easier to debug and design, and are often lower cost to implement. However, they lack on the flexibility front. Unlike FPGAs that can allow for reprogramming of hardware/firmware, microcontrollers only allow for reprogramming of firmware, which greatly limits its options for any modifications.

Another benefit of FPGAs is their parallel processing ability, or parallel execution of identical operations. Because of the hundreds or thousands of CLBs processing synchronously, applications including image processing or artificial intelligence are more feasible. Alternatively, microcontrollers perform sequential processing, meaning it reads and processes each line of the program one after the other, which is less powerful in comparison.

While both can be used as the sole processor, it is also possible to implement both a microcontroller and an FPGA within a design concurrently. For example, the microcontroller can be used to perform complex controls while the FPGA performs the functions and does the heavy lifting. By using these both together, developers can take advantage of the processors’ strengths and create robust designs capable of advanced operations.

Tools to Develop and Debug Embedded Systems

Microcontroller-based systems often use I2C and SPI protocols as a means for communication between devices. For embedded systems engineers, debugging and developing such systems wouldn’t be possible without the right tools. Certain tools, including host adapters and protocol analyzers, allow engineers to test systems and gain visibility into the bus.

Host Adapters

Host adapters in particular allow the engineer to emulate master and slave devices and prototype entire systems. By using the tool as a master, users can evaluate peripherals such as sensors and memory chips, and as a slave can test commands sent from MCUs.

Total Phase offers multiple host adapters that suit a variety of I2C and SPI testing and programming applications.

The Aardvark I2C/SPI Host Adapter is Total Phase’s general-purpose host adapter that can be used as an I2C or SPI master or slave device. As an I2C master and slave, it can support up to 800 kHz, as an SPI master it can support up to 8 MHz, and 4 MHz as an SPI slave.

The Cheetah SPI Host Adapter was designed as a high-speed programming device. It can quickly program SPI-based EEPROMs and Flash memory. As an SPI master, it can signal up to 40 MHz.

The Promira Serial Platform is Total Phase’s most advanced serial device. With its FPGA-based platform, users can select from a range of I2C and SPI applications, that provide varying levels of speeds and other functionalities to fit a variety of project requirements. As an I2C device, users can signal up to 3.4 MHz as a master or slave; as an SPI device, users can signal up to 80 MHz as a master and 20 MHz as a slave.

Protocol Analyzers

Protocol analyzers are useful tools to capture and monitor data on the bus, as well as uncover bus errors and their sources. Total Phase also offers protocol analyzers for a variety of different protocols, including I2C and SPI.

The Beagle I2C/SPI Protocol Analyzer allows users to non-intrusively monitor an I2C bus up to 4 MHz and an SPI bus up to 24 MHz.

If you’d like to find out more how our debugging and development tools can benefit your embedded systems designs, please email us at sales@totalphase.com.