Technical Article

How to Choose Microcontroller Peripherals for Digital Signal Processing Applications

April 08, 2019 by Robert Keim

This article continues a discussion of microcontroller features and characteristics that are particularly important when you’re thinking in terms of DSP capabilities.

This article continues a discussion of microcontroller features and characteristics that are particularly important when you’re thinking in terms of DSP capabilities.

Microcontrollers can be a convenient and cost-effective means of incorporating digital signal processing into wearables, medical devices, audio equipment, and various other products and systems. However, microcontrollers are designed primarily for (not surprisingly) controlling things, so if we want an MCU to be an effective signal processor, we need to choose carefully.

The previous article focused on CPU characteristics, namely bit width, clock frequency, clock cycles per instruction, and floating-point capability. In this article, we’ll look at peripheral modules and features that make a microcontroller more suitable for DSP functionality.

 

Processor Support

Some hardware modules occupy a middle ground between the CPU and typical peripherals such as timers and comparators. A common example is the hardware multiplier.

 

Hardware Multiplication

A hardware multiplier is the sort of feature that could mean the difference between success and failure in a real-time DSP system. Important DSP applications such as digital filtering and spectral analysis require numerous multiplication operations, and these must be performed quickly enough to produce results in a reasonable amount of time (from the perspective of the user) or—and this is when things can really become challenging—at a rate that is equal to or faster than the rate at which data is arriving from the external system.

 

The triangles in this FIR filter structure represent multiplication operations.

 

Since a large proportion of microcontroller applications do not require advanced multiplication functionality, it usually does not make sense to incorporate a multiplier into the processor core, itself. The hardware multiplier, then, is a supplemental module that receives data from the CPU, performs highly efficient multiplication, and then makes the resulting data available to the CPU.

Hardware multipliers actually go beyond mere multiplication. DSP routines often require a process known as multiply-and-accumulate (MAC), which (as you may have guessed) involves repeatedly multiplying numbers and adding, or accumulating, the results of the multiplication operations. A hardware MAC module offers even more potential for improved DSP performance.

 

The hardware multiplier incorporated in the MAXQ615, a small and inexpensive microcontroller from Maxim, performs signed and unsigned 16-bit multiplication, 16-bit multiply-and-accumulate, and 16-bit multiply-and-subtract.

 

Direct Memory Access (DMA)

I first learned about DMA when I was working on a software-defined radio that had to rapidly perform a decoding algorithm on digitized baseband signals, and that experience permanently impressed upon me the value of DMA in time-sensitive digital signal processing.

A DMA unit is essentially a separate processor that has one job: to move data. This task is straightforward, so incorporating DMA functionality into your project does not seriously increase its complexity, and the system’s DSP power increases dramatically because the CPU can focus on crunching numbers instead of shuffling data between memory and peripherals. If your application requires computationally intensive real-time DSP, a DMA controller may be a particularly valuable addition to your MCU’s capabilities.

 

The DMA controller on a SAM4S microcontroller (from Atmel) allowed me to generate this sinusoid without constantly pestering the CPU to send the next data point to the DAC.

 

Communication

Digital signal processing requires not only a processor but also digital data to be processed. In most cases, this digital data will originate outside the microcontroller, and this means that data transfer is a critical link in the DSP chain.

 

Parallel Data Transfer

I like parallel interfaces because they’re simple, at least in theory, but they are less common than you might think. Transferring eight or even sixteen bits simultaneously seems much more efficient than sending one bit at a time, but serial interfaces are widely used even in high-speed systems. If parallel data transfer is an option in your system and you want to give it a try, look for a microcontroller with an “external memory interface” (EMI or EMIF), “external bus interface” (EBI), or something along those lines.

 

Serial Data Transfer

I2C is not a high-speed interface, and standard UART tends to be used for low or moderate data rates. Look for peripherals that advertise high maximum clock rates and that use an additional signal for synchronization between receiver and transmitter (this allows the data signal to be devoted entirely to actual data transfer).

I believe that “USART” is a fairly standard abbreviation for the sort of serial-communication module that I’m describing (the “S” stands for “synchronous”). Basically what I’m recommending here is a microcontroller equivalent to TI’s “multichannel buffered serial port”—the abbreviation McBSP (pronounced mic-BSP, as though the module is from Ireland) is lodged in my memory and will be perpetually associated in my mind with high-speed serial data transfer....

 

Error Checking

Applications that require robust error detection can benefit from a hardware CRC module.

 

This is a diagram of the hardware CRC module integrated into an EFM8 Laser Bee microcontroller from Silicon Labs. You feed it a sequence of bytes, and it uses a standard CRC polynomial to generate a 16-bit result.

 

Conclusion

I really do think that microcontrollers are preferable to digital signal processors in many low- and medium-intensity DSP applications, and I hope that this article will help you to identify microcontrollers that can reliably perform the DSP tasks that your projects require.

Previous articles in the Introduction to Microcontrollers series: