Digital signal processing can add valuable functionality to a wide variety of products and applications. Even designs that are constrained by cost, form factor, or schedule can easily incorporate the benefits of DSP, because nowadays engineers have access to an abundance of library code, example projects, and high-performance processors that are both inexpensive and relatively user-friendly.
A true digital signal processor—such as a part from the C5000 family from Texas Instruments or the SHARC family from Analog Devices—can be an intimidating device. I’ve worked primarily with DSPs from Texas Instruments, and overall the experience was productive and satisfying. However, in that case I didn’t have to design the circuit board, and I did not enjoy the process of attempting to debug strange system crashes and understand the details of the operating system.
There is no doubt that certain computationally intensive DSP tasks will require a true digital signal processor or even an FPGA. It is also true, though, that in numerous applications a properly chosen microcontroller would suffice. This article discusses the characteristics and capabilities that you need to focus on when you want to ensure that your MCU will have plenty of DSP power.
8-Bit, 16-Bit, or 32-Bit?
This issue is less straightforward than you might think. In general, 16-bit and 32-bit devices will be more appropriate for DSP applications. Digital signal processing involves mathematical procedures that will often lead to large numbers, and you want a processor that can directly manipulate these large numbers.
However, 8-bit processing is not inherently bad, and if you know that you will be dealing with a limited range of digital values, an 8-bit microcontroller might be a good choice.
Furthermore, engineers often don’t have the time or inclination to study a processor’s low-level details, and consequently it can be difficult to establish a clear connection between the specified bit width and the actual computational efficiency. For example, does a “32-bit microcontroller” have 32-bit registers? A 32-bit ALU? A 32-bit address bus? A 32-bit communication interface? What exactly does “32-bit” mean? These details could influence your decision, especially if you expect to be dealing primarily with small numbers that don’t need all those extra bits.
This modernized 8-bit architecture was developed by Silicon Labs (diagram taken from this document). They warn against the assumption that a 16-bit or 32-bit device will consistently outperform an 8-bit device.
A microcontroller’s maximum clock frequency is certainly a good indicator of its merits as a digital signal processor. However, it’s essential to understand the difference between clock cycles per second and instructions per second. The processor accomplishes DSP tasks by executing instructions, and consequently its performance is influenced by both the clock frequency and the number of clock cycles required to execute instructions.
Unfortunately, this issue quickly becomes rather complicated. The number of clock cycles required for an instruction varies from one instruction to the next, and the average number of clock cycles per instruction can be reduced by using a pipelined architecture. Then, you have to consider the amount of “functionality per instruction”—i.e., maybe Microcontroller A needs only one instruction to do something that would require multiple instructions on Microcontroller B.
This diagram conveys the concept of a pipelined processor. See this article for more information. Colin M.L. Burnett [CC-BY-SA-3.0].
Here is my abbreviated recommendation: If you’re comparing devices from the same family, opt for the higher clock frequency. If you’re comparing devices with major architectural differences, try to find a reliable specification that indicates either the rate of instruction execution (expressed as MIPS, millions of instructions per second) or the average number of clock cycles per instruction.
Fixed-Point vs. Floating Point
The term “floating-point” refers to a numerical representation in which the radix point can “float” because the number consists of an integer portion (the mantissa) and an exponent. The alternative (“fixed-point”) corresponds to the way in which we typically handle and perceive the data in a normal microcontroller. A careful comparison between floating-point arithmetic and fixed-point arithmetic is by no means a simple task, but there seems to be a consensus that floating-point processing can be superior in mathematically intensive applications.
I think it is safe to say that all microcontrollers are fixed-point devices, because in my opinion if it is truly a floating-point processor, it is no longer a microcontroller. However, if you are really determined to maximize your mathematical performance while staying within the microcontroller domain, you should consider a device that includes a floating-point coprocessor.
The LPC3180FEL320 from NXP, a 16/32-bit Arm-based microcontroller, has a floating-point coprocessor, and it can achieve up to 220 MIPS. STMicroelectronics also has STM32 microcontrollers that incorporate a floating-point unit (FPU).
I used some floating-point math in my circular-touch-sensor project. In most cases, a separate FPU is unnecessary—compilers are good at implementing floating-point variables in typical microcontrollers.
In this article, we explored CPU characteristics that make a microcontroller more or less suitable for DSP applications. I think that in most situations it makes sense to focus on bit width and MIPS—you shouldn’t need to worry much about floating-point versus fixed-point unless you plan to do some serious number-crunching with your MCU. We’ll continue this topic in the next article, which will discuss DSP-related peripheral features.
Intro to Microcontrollers Series
This article is part of a larger series. You can find the rest of the articles below:
- What Is a Microcontroller? An Introduction to the Central Component in Countless Electronic Devices
- How to Choose the Right Microcontroller for Your Application
- How to Read a Microcontroller Datasheet: Introduction and First Steps
- How to Read a Microcontroller Datasheet: Exploring the Hardware