Table of Contents:
- What Is a Microcontroller?
- What Is a Field Programmable Grid Array?
- How They’re Similar
- How They’re Different
- Should I Use a Microcontroller or an FPGA in My Printed Circuit Board (PCB)?
A field-programmable gate or grid array (FPGA) and a microcontroller are similar, but not the same. They are both essentially “small computers” or integrated circuits embedded in other devices and products. The main difference is in the title. Users can program the hardware of FPGAs after manufacture, making them “field-programmable,” while microcontrollers are only customizable on a more superficial level. Additionally, FPGAs can handle parallel inputs while microcontrollers read one line of code at a time.
Because they allow for a greater level of personalization, FPGAs are both more expensive and more difficult to program. In contrast, microcontrollers are cost-effective but much less customizable. Learn more about the similarities and differences between microcontrollers and FPGAs. One is not necessarily better than the other — when deciding which to use, consider multiple factors.
What Is a Microcontroller?
A microcontroller (MCU) is basically a small computer. It has all the same elements as other computers, including a central processing unit (CPU), some random-access memory (RAM) and input and output devices. Unlike a desktop computer, which can run thousands of different programs, a microcontroller is a special-purpose device that performs one program.
It’s made to do one thing repeatedly, automatically or at user request. It’s embedded in some other device, whether a consumer, manufacturer, medical or other type of product. It runs on low energy — its power consumption is measurable in milliamps. As a result, microcontrollers tend to be affordable. The device in which it’s embedded can vary greatly in cost, however.
You find programmable microcontrollers all around you in your everyday life. Here are a few of the consumer devices in which a microcontroller is embedded:
- Keyboards
- Monitors
- Printers
- Copiers
- Fax machines
- Telephones
- Television remote controls
- Microwaves
- Washers and dryers
- Lawn sprinklers
- Children’s toys
In addition to consumer items, microcontrollers are also embedded within the following devices:
- Traffic lights
- Car engine control systems
- Power tools
- Implantable medical devices
These are only a few examples — microcontrollers are embedded within all kinds of devices we rely on in modern society. Each microcontroller has a specific, repetitive purpose. It can operate automatically using a feedback control system, as you would find with traffic lights. Or, it can operate at user input signals, like flipping a switch or pressing a button. This latter concept is true for your microwave, laundry machine and television remote control.
What Is a Field Programmable Grid Array?
A field-programmable gate or grid array is a little more complicated than a microcontroller. Most of the time, a chip comes pre-programmed. As the user, you can change software, but not hardware. This brings us to the defining element of an FPGA — you, the user, can configure its hardware after purchase.
Engineers find this especially useful for prototyping their own application-specific integrated circuits. In fact, Intel uses a form of FPGA to streamline their own prototyping process. FPGA machines are also useful because the devices in which FPGAs are embedded can be altered without needing all-new hardware.
Per the example given by “FPGAs for Dummies,” regulations might change to demand that vehicle rear-view cameras operate faster. If these cameras run on FPGAs, manufacturers can make this change without installing expensive, all-new hardware. They can simply reprogram the FPGA in each car’s rear-view camera. Cars that are already on the road can be altered rather than rendered obsolete.
How Does It Work?
FPGAs have an “array” of integrated hardware circuits — these arrays are groups of programmable logic blocks. During manufacturing, an FPGA has not been configured to have any particular function. Instead, the user can configure it and later reconfigure it however they choose.
The user does this using a hardware description language (HDL). An FPGA has logic blocks, like AND and XOR, which the user can piece together with interconnects. Modern FPGAs have many logic gates and RAM blocks, so they can accommodate complex computations. Some FPGAs also have analog-to-digital converters or digital-to-analog converters, similar to field-programmable analog arrays (FPAAs).
How They’re Similar
Both FPGAs and microcontrollers have the same basic purpose — they are both built in a way that allows a manufacturer or end-user to determine their function. They both perform specific applications and are embedded within other devices, whether a traffic light or laundry machine. This versatility is why you can find them all around you. Everything we do is easier thanks to these little integrated circuits.
To an untrained eye, they look roughly the same. Both are flat, square, tiny chips surrounded by programmable pins. They’re both essentially miniature computers, programmed for a distinct purpose. For this reason, neither an FPGA nor a microcontroller can serve as a personal or desktop computer. Instead, they follow commands to perform one function at varying levels of complexity.
Basic Components
These devices have several fundamental similarities. In fact, they’re comprised of the same basic components. An FPGA and a microcontroller are both integrated circuits that operate using computer logic and binary.
An integrated circuit is a set of electronic circuits on one flat chip, which consists of semiconductor material — often silicon. It can perform calculations and store data. Integrated circuits use either digital or analog technology — as mentioned above, some FPGAs can convert between the two. Digital technology utilizes binary logic, while analog technology determines a linear function of an input to calculate an output.
This basic concept, input determining output, describes how all computers work. Digital technology incorporates a two-valued logic system, or binary — one or zero, on or off, yes or no. It’s important to understand the basics of computer logic when programming either a microcontroller or an FPGA.
Customization
Additionally, both FPGAs and microcontrollers are programmable after production to some extent — meaning either a manufacturer or end-user can design their function and embed them as needed. This is why these devices have so many applications in a broad array of industries.
The extent to which you can customize an FPGA sets it apart, which is why these are most useful for complicated, highly technical applications. On the other hand, a microcontroller is better for simpler applications.
FPGA or Microcontroller?
The main difference between an FPGA and a microcontroller is the level of customization and complexity. They also vary in price and ease of use.
While FPGAs have their advantages, microcontrollers cost less and are easier to use. Most hobbyists or beginners would benefit from purchasing microcontrollers, while engineering companies and manufacturers may prefer FPGAs.
Microcontrollers
The defining characteristics of microcontrollers include:
- They’re easy to use: Anyone with a basic understanding of coding can program a microcontroller. You can program a microcontroller using an assembly language like Javascript or Python, which you can teach yourself through online courses.
- They’re affordable: Because they’re simpler to mass-produce, the upfront cost is less for a microcontroller than for an FPGA.
- They’re not always ideal for complex applications: The dedicated processor of a microcontroller handles all inputs and outputs. As a result, bottlenecks can occur as processes have to wait for others to resolve. Because they do not allow for parallel functions, microcontrollers are better for simpler purposes.
- They’re ideal for simple applications: Think about your laundry machine. After you put in your clothes, you customize two or three settings, and then you press start. Similarly, your computer mouse only needs to know how to interpret a few inputs — scroll up, scroll down, left click and right click. For simple, unchanging applications like these, a microcontroller is ideal.
FPGAs
Some defining characteristics of FPGAs include:
- They require more skill to use: You’ll need more than a basic understanding of coding language to program an FPGA. In addition to knowledge of a coding language, you’ll need to be able to track mass amounts of variables. You’ll also need to understand a hardware description language. Designing and redesigning hardware is not a task for beginners.
- They allow for more parallelism: An FPGA has thousands of logic blocks, all of which you can program. You can create processes independent of one another, decreasing instances of bottlenecking as with microcontrollers.
- They allow for a higher level of customization: Simply put, if you know what you’re doing, you can do a lot more with an FPGA than a microcontroller. If you want to program something complicated, you’ll need more customizability than a microcontroller provides.
- They tend to cost more: One drawback of FPGAs is that they tend to be more expensive than microcontrollers. Despite higher upfront costs, they can save money for industries that may need to make retroactive changes — think of the rear-view camera example.
- They’re ideal for more complex applications: Because FPGAs allow for parallel processes, you can implement more inputs with an FPGA than with a microcontroller, without running into a bottlenecking issue. This makes them ideal for more complex operations.
- They allow for later alteration: One of the biggest benefits of an FPGA is that the hardware itself can be changed after its initial programming. For this reason, you can change a device’s function without completely replacing its hardware. This is more cost-effective in the long run, especially for mass-producing industries.
Should I Use a Microcontroller or an FPGA in My Printed Circuit Board (PCB)?
A printed circuit board brings a schematic drawing to life. The more conductive layers the board has, the more connections you can make. A four-layer board will have four conductive layers, with insulating layers between. Assembling a PCB requires a decent bit of technical knowledge, so read up on the jargon if you’re assembling one for the first time. You may opt to rely on a professional PCB production service or PCB supplier.
Whether you use a microcontroller or an FPGA in your PCB should depend on several factors, including:
- The necessary level of complexity.
- Your level of expertise.
- Your budget, especially if you need to buy in bulk.
- Retroactive alterations you may need to make.
The Necessary Level of Complexity
FPGAs can execute multiple lines of code at once, allowing for independent, parallel processes. For highly advanced applications, this capability is a necessity. An FPGA can handle more complicated inputs and can perform simultaneous operations. The drawback is that FPGAs require perfect timing and accuracy to function properly. A tiny mistake can render the whole system useless.
In contrast, microcontrollers only read one line of code at a time, processing commands in sequence. Though this can lead to a bottlenecking issue, it has its advantages. Because they’re less complicated, microcontrollers are easier to program and reprogram using a trial-and-error method. For simple applications, an FPGA may be more complicated than necessary, and it may make programming harder than it needs to be.
If a mistake is made in the programming of an FPGA, repairs are much more complex. This brings us to our next point, which is that your choice between an FPGA vs. a microcontroller will need to depend on your level of expertise.
Your Level of Expertise
In simple terms, an FPGA is not the right choice for a beginner. Hardware description languages take more time and experience to learn than assembly languages. A greater level of customization means more skill is required. If you have a lot of experience with computer engineering, an FPGA will afford you an attractive level of customizability.
Your Budget
Keep in mind that FPGAs do tend to be more expensive in their initial cost than microcontrollers. If you’re looking to program something simple, like an auto-dimming light or a temperature sensor, a relatively cost-effective microcontroller might be the better option.
Though their initial cost is greater, FPGAs can reduce expenses later — especially in mass-produced objects that may need to be altered after original assembly.
Your Need for Retroactive Alteration
For any number of reasons, you may find you need to alter the hardware of your application. In that case, you’ll be glad to have an FPGA. This is part of why so many industries prefer FPGAs. When laws, standards, regulations or needs change, it’s much less expensive and time-consuming to alter existing FPGAs rather than implement all-new hardware systems.
Learn More by Contacting Millennium Circuits
Both FPGAs and microcontrollers are valuable for a wide variety of purposes. Their versatility lends them to thousands of applications, some of which we use every single day. Understanding the similarities and differences between them will help you determine which is the best option for your purposes.
While they consist of the same basic components, they’re different in their level of customization, complexity, price and required level of expertise. Choosing one over the other should depend on multiple factors. Each solution has unique benefits and potential drawbacks.
Whether you’re designing a do-it-yourself project, creating a prototype for a new product or looking to streamline a technical process, one of these integrated circuits is bound to be useful. If you have any questions about FPGA or microcontroller technology used on bare PCBs, contact the experts at Millennium Circuits Limited for more information.