Digital signal processing (DSP) provides developers with the ability to clean-up and analyze complex signals in a flexible and cost-efficient manner all from software. When developers typically think about DSP, they often picture expensive, dedicated processors, but modern microcontrollers, such as the Arm Cortex-M processors, now include DSP extensions that allow DSP algorithms to be executed efficiently in a resource-constrained environment. In this article, we will explore several tips developers can follow to get started with DSP using the Arm Cortex-M processors.
Tip #1 – Understand the problem domain
Before diving into DSP, it’s useful for a developer to understand the problem domains where DSP can be applied. In general, DSP is applied to data signals that are streaming in real-time, such as in audio and speech processing, or for signals that are static, such as image processing. DSP is applied to a wide range of applications, such as sonar, radar, voice recognition, telecommunications and control systems, to name a few.
There are several very common applications for DSP in embedded systems. First, DSP can be used to convert legacy analog circuits into software, which has many benefits – read more in my recent blog: “5 Benefits to replacing analog components with DSP software”.
Next, DSP can be used to create digital filters, such as Infinite Impulse Response (IIR) and Finite Impulse Response (FIR) filters. These filters are used quite often in control systems, such as motor control systems to remove noise from sensor signals. Finally, developers can use DSP to convert signals in the time domain to the frequency domain using the Fast Fourier Transform (FFT), which allows them to analyze the frequency components of a signal.
Tip #2 – Explore the latest DSP technologies
A great way to understand the capabilities that DSP offers to designers today is to examine where and how DSP technologies are used. Let’s start by looking at some of the tools and then the cutting-edge applications.
First, there are high-level tools that allow developers to simulate, test and deploy DSP algorithms, such as MATLAB. MATLAB provides designers with a collection of DSP libraries that can be combined in an easy to use interface to test out how an algorithm will behave before ever deploying it onto a target device. The tool also allows developers to generate the low-level microcontroller code that executes on the target device. MATLAB capabilities are vast and can be applied to solve any number of DSP related problems.
Second, there are also tools, such as ASN Filter Designer, that allow developers to create digital filters easily. A developer can select the type of filter they want to create, such as an IIR or FIR and then drag around points on the filter diagram to get the filter response that they need. Once the filter response is achieved, designers can generate code that implements the filter in a number of different formats, including Cortex-M CMSIS-compatible code.
Beyond the tools, developers can examine application uses to gain insights into how DSP can be used. A truly unique solution that utilizes DSP is Chirp. Chirp uses audio tones to transmit credential information from a mobile device to an edge device to provision it. This eliminates all the extra steps necessary to configure an IoT edge node that would normally require holding a button for some period of time, converting it into an access point, connecting to it and then telling it what network it should connect to. Chirp innovatively uses DSP to convert the provisioning information into an audio stream, which are all processed through DSP algorithms and dramatically simplifies device setup.
These are just a few examples of tools and technologies that are available for DSP, but there are hundreds that could be explored by developers.
Tip #3 – Select a low-cost development board to experiment with
The best way to get started with DSP is to get your hands dirty. This can be done by selecting a development board with a Cortex-M4 processor that supports DSP extensions. There are many boards to choose from, but two of my favorites are the Cypress FM4 starter kit which is based on the S6E2CC series microcontroller and the ST Microelectronics STM32F4-Discovery board.
The FM4 starter kit works great with the examples from by Donald S. Reay and is also used with Arm’s University Program. The STM32F4-Discovery board also has a great application note that demonstrates the Arm CMSIS library that we will talk about in just a moment. The discovery board also comes with an LCD that allows transforms and signals to be displayed easily by the developer. The application note can be found here.
No matter which development board is selected, it’s important to get hands-on experience, and not just book knowledge, to become a proficient DSP developer.
Tip #4 – Arm CMSIS-DSP Library
One of the best resources that a developer can leverage when getting started with DSP is to use the Arm CMSIS-DSP library. The CMSIS-DSP library can be downloaded for free and contains over 60 different DSP related functions. These functions are designed to provide developers with the building blocks they need to develop fast and efficient DSP algorithms on a Cortex-M processor. The library contains ten different categories of functions that include:
- Basic math functions, such as Vector Dot Product, Vector Multiply, Vector Addition
- Fast math functions, such as Square Root, Sine and Cosine
- Complex math functions, such as Complex Dot Product, Complex-by-real Multiplication
- Filters, such as FIR, IIR, Biquad and Convolution
- Matrix functions, such as Matrix Multiplication, Complex Matrix Multiplication
- Transforms, such as Complex FFT functions
- Motor control functions, including Vector Clarke Transform, Vector Park Transform, PID Motor Control
- Statistical functions, including Root Mean Square (RMS), Standard deviation, Maximum and Power
- Support functions, e.g. conversion of datatypes from float to fixed point
- Interpolation functions.
Tip #5 – Get involved in a DSP community
When getting started with DSP, there are many online resources to choose from but one of the best resources available to developers are online communities. A community provides a developer with the opportunity to ask questions and have more experienced developers share their DSP knowledge. There are several good DSP communities on the web, but the best ones that I have encountered are Arm Community and DSPrelated. These communities are free and have some of the most knowledgeable DSP experts around on their forums, in addition to a plethora of previously asked questions and DSP resources.
DSP is critical for the next wave of embedded devices – yet is more achievable than ever
DSP has become an essential tool for embedded systems developers. The rapid growth of industries such as the IoT, autonomous vehicles (including drones) and artificial intelligence are driving an ever-growing need for sensors. To process the data from these sensors in a flexible and fast manner, they need to be processed digitally in software. There is increasingly no need to do this processing on an expensive DSP processor because it can very often be done on a microcontroller like the Arm Cortex-M, especially if it has the DSP extensions. Following the tips provided in this article will help you get up to speed quickly and efficiently in DSP.
To learn more about how to implement DSP algorithms such as IIR, FIR and FFT on the Arm Cortex-M processors, sign-up for the free webinar “Running DSP Algorithms on Arm Cortex-M Processors.”
Jacob’s Expert Tip of the Week
Learn more about how to run DSP codecs by attending my upcoming (and on-demand) webinar “Running DSP Algorithms on Arm(R) Cortex(R)-M Processors“.