RSS Feed Email Facebook Twitter Stumbleupon Google Bookmark

Embedded Digital Filtering

By Kendall Castor-Perry

Digital FiltersThe increasing availability of affordable microcontrollers with analog-to-digital front ends continues to change how embedded systems are being designed. Often termed 'mixed-signal microcontrollers', these devices consolidate both control and digital signal processing functionality onto a single device. Such programmable "system on chip" technology not only simplifies application architectures, it accelerates development by eliminating the need to communicate between chips, and by enabling engineers to write application code within a single development environment.

One of the primary advantages of mixed-signal microcontrollers is that they can do much more than simply convert external analog signals to the digital domain. Data acquisition is not an end in itself but rather is a first step before extracting the meaning behind acquired data, and deciding what to do with it. Many embedded developers are turning to newer mixed-signal microcontrollers because they make it possible to cost-effectively implement complex digital filtering in a wide range of new applications. More advanced filtering allows engineers to offer more capabilities - including higher precision, better efficiency and lower power consumption - with which to differentiate their products.

Bringing digital signal processing and control functionality onto the same device, however, does not come without its own challenges. When an application requires extensive signal processing, it can become a challenge for the firmware engineer to perform such processing in real-time when it is run on the same processor as all of the other housekeeping tasks the processor needs to support, including managing a screen, keyboard, storage, and so on. Additionally, the architecture must be flexible enough to support changing application specs, as well as be able to scale functionality to meet different market requirements.

Balancing Hardware and Software Resources

Flexibility in an embedded architecture is important. Many embedded applications do not have the volumes to encourage silicon manufacturers to spin application-specific microcontrollers. Even for high volume applications, application-specific chips appear on the market only after the functions they provide have become commoditized. In many cases, if developers want to implement advanced digital filtering, they have to rely upon controllers that are either general-purpose in nature or that are optimized for other applications. In addition, as with many embedded project developments, they go through frequent changes in scope, ambition, and architecture. Keeping up with the impact this has on a monolithic coding project on a single core is challenging, especially with today's decentralized, multi-contributor design teams.

Some newer mixed-signal controllers provide the necessary flexibility through programmable or configurable logic,implemented as integrated coprocessors or hardware blocks that can be programmed to execute independently, in parallel to the main CPU. These devices can implement compute-intensive algorithms with a high degree of efficiency, and at minimal cost. In addition, the decoupling of signal processing from the main CPU allows the reuse of IP through an ecosystem of blocks that can be shared across a design community to reduce development time and lower application cost. This level of flexibility also allows developers to support entirely new applications with their own custom IP blocks in a cost-effective manner.

Being able to embed signal processing into functional components at the block level ensures that the project's management can be 'forked' at the component design level. By adjusting the programmable hardware resources available to a particular function, developers can scale digital filtering algorithms independently of CPU software resources. This methodology ensures that signal processing load variations, which change as algorithms are modified during the design process, have no impact on other highly timing-critical tasks such as communications management.

Embedding digital filtering

This article illustrates some recent system designs employing a recently-introduced mixed-signal microcontroller with an embedded filter coprocessor. Many filtering topologies can be coded effectively onto this structure. Combining programmable hardware and data path blocks enables developers to marry the efficiencies of hardware with software in an optimal balance for their specific application. Data and coefficients are stored in dedicated local memories and are shared between programmable hardware and software resources via a system bus. Both sets of resources have access to sources and sinks of digital data.

Tools are available for quickly configuring these systems-on-chip using a drag-and-drop interface, such as the PSoC Creator Integrated Development Environment from Cypress Semiconductor, which supports the newly-introduced PSoC3 and PsoC5 architectures. Developers have the option of using or modifying a wide range of existing library elements, or creating new blocks such as custom filters. These elements are then converted into the necessary hardware and software components as dictated by the programmable system-on-chip architecture in use.

Multi-channel filtering

The number of channels that can be filtered concurrently is dependent upon the microcontroller's architecture. In a software implementation, the available processing resources must be time-sliced, creating a complex array of independent threads that must be serviced consistently to meet real-time constraints. Using interrupts to handle non-real-time tasks,such as refreshing a screen or polling a keyboard, can complicate handling of real-time interrupts significantly.

In programmable hardware architecture, hardware resources can be allocated to each channel. These resources execute in parallel with each other and with the CPU, thus eliminating many of the issues relating to managing real-time interrupts. Consider a consumer audio application utilizing a stereo ten-band graphic equalizer whose filter coefficients are calculated by the CPU on the fly. A stereo audio codec is interfaced to the microcontroller over a standard I2S port clocked from an embedded frequency synthesis system that can produce all standard audio master clock frequencies from a single local crystal. If required, this synthesis system can also be synchronized to the framing patterns of common digital interface formats such as USB. All this is implemented in programmable hardware.

At a 44.1 kHz sample rate, this equalizer uses only a fraction of the available resource and filtering power. The response fitting and coefficient calculation routines can take update information dynamically from local controls directly managed by the microcontroller and also from control protocols arriving over an (embedded) interface from a mobile device used as a signal source and control unit.

This recently-implemented system still has enough resources left to implement a multi-band crossover filter bank. The outputs can be delivered to external DACs or digital amplifiers through multiple I2S interfaces. The super-precise control of frequency response obtained eases the acoustic design of 'difficult' loudspeaker enclosure designs,such as the driver subsystems designed for in-vehicle and public address applications. It also allows consistent high quality results from compact multiway acoustic designs in docking units, micro-stereos and flat-panel TVs. High channel-count distributed sound reinforcement and messaging systems benefit from the simplified frequency response tuning, all achieved on the same processor that is managing the user interface, communications and power supply.

Summing up

Introducing a powerful digital filtering engine into embedded applications extends the value developers can deliver to their customers, and it reduces system cost, complexity, and time-to-market. By making use of mixed-signal microcontrollers with programmable hardware signal processing resources, such as the PSoC3 device in these examples,it becomes possible to address the evolving requirements for complex signal filtering as they change during the design process. With them,developers can cost-effectively introduce a wide range of capabilities to enhance their products, from adding 'stereo enhancement' functions, to decimation filters for digital microphones, and even advanced control algorithms for industrial sensor conditioning and medical applications.

About The Author
Kendall Castor-Perry: Know More... Article Source:

blog comments powered by Disqus