In my professional career, I have often been asked the question: what is an FPGA? FPGAs are not as well-known as devices like microcontrollers, which is why they are not widely used. However, this presents a great opportunity for FPGA developers. Although FPGAs are not commonly used in industry or computing, I am confident they are the best choice in many cases. We just need to help those fields realize that, indeed, what they are looking for is an FPGA.

So, starting from the beginning, what is a microcontroller? Is it the same as a microprocessor? A microcontroller is a device that reads instructions from memory and executes them. To execute these instructions, the microcontroller processes them through a series of steps, often referred to as a pipeline. In this pipeline, instructions are fetched, decoded, and executed in stages, allowing multiple instructions to be processed simultaneously at different stages. This process takes some time, but it ensures that the instructions are executed efficiently. The number of steps in the pipeline changes according the architecture of the processor, and could be from 5 for a RISC microcontroller, to around 20 y powerful processors. So, what is the difference between a microcontroller and a microprocessor? the memory. A microcontroller features volatile and non-volatile memory to execute the instructions, however, microprocessors usually do not include memories more than small cache. That is the reason why we need the SSD and the RAM memory in our computers, and we don’t need them to use an ARM Cortex-M7.

At this point, where microcontrollers are useful? Well, the answer to this question is very simple, in almost all fields. The reason that makes them so useful is that, besides the processing unit, manufacturers add tons of peripherals to their microcontrollers like SPI, I2C, ADC, I2S, PWM … making them fit in many different projects. However, it is not perfect. Microcontrollers, as well as microprocessors, have their limitations. The most evident one is that they can only execute one instruction at the same time, and although you can mitigate this by increasing the speed of the clock, or adding several processing units, most of the resources of the microcontroller are shared, which is a bottle-neck in some cases. Also, we have to consider that we cannot customize the microcontroller. Would be great to choose the processing unit, and then select the exact peripherals we need for our application, but this is not possible. Manufacturers like STMicroelectronics offer us a huge amount of microcontrollers with different configurations of power and peripherals, so many times you have to make your application fit into the most suitable microcontroller. Usually, we are going to use microcontrollers with peripherals that we barely will use in our applications, but you paid for them, so it is a kind of wasting money.

At this point, do you need to read some sensors through an I2C bus? Use a microcontroller. Do you need to control a Buck converter? Use a microcontroller, Do you need to process the signal of a microphone? yes, you must use a microcontroller. however, do you need to read 40 SPI channels at the same time? FPGA, Do you need to control a Buck converter with a PWM resolution of ns? FPGA, Do you need process the signal of a microphone at the same time that you are controlling a display? no you don’t have to use two microcontroller, use an FPGA, but, why?

Well, let’s start explaining what is an FPGA is a very imple way. an FPGA is a configurable matrix of digital elements. These digital elements could be “simple” logic blocks (~95% of the total blocks) or something more specific like MACC blocks, RAM memory and even in some cases ADC or Gigabit Transceivers. Logic blocks can be configured to perform any digital operation, either using one of them or several. Even they can be configured to work as one or several microcontroller (but try not to do this…). With the MACC blocks we are able of perform Multiply-Accumulation operations to, for example, implement filters. RAM blocks are useful to store some data within the FPGA, having them accesible in just one clock cycle.

FPGA matrix

All of the elements of the FPGA can be either configured or inter-connected. The connection of one block to others is made in the interconnection matrix, allowing the user to create different circuits in the same device (yes, we can create circuits that run at the same time). This is one of the points that makes FPGA so special, the parallelization. Regarding the number of blocks available to configure, it depends of the device used, We can use a small FPGA with around 5k logic elements, or we can use a huge FPGA with 100k elements.

Does it mean that I need to configure one by one the 100k blocks of the FPGA? No, in the same way, that you are not writing the binary file to your microcontrollers. We just need to write a code that describes what we want, and the synthesizer will translate it into a digital circuit.

To summarize, FPGAs are a less-known tool for developers, and they do not fit in any project, but microcontrollers do not either. If your project involves any of these topics

  • Different execution flows in the same device.
  • Custom communication protocols.
  • Control execution below nanoseconds.
  • Mix high-speed with low-speed management.
  • Platform managers.
  • High-speed interfaces.
  • Recursive computations.
  • Hardware accelerators.
  • Real-time cryptography.
  • Radio-frequency.

You should consider migrating to an FPGA. Also, if you can not find a microcontroller that fits exactly what you need, an FPGA might fit all your requirements. In any case, if you have doubts, do not hesitate to contact me, either in English or Spanish, and I can help you make your decision.