Implementing an audio filter on a Cypress Semiconductor FM4-176-S6E2CC-ETH Pioneer Kit 

Project Decription

I’ve used digital signal processing at various times in my professional carrer. Primarily in test and measurement. Amateur radio is a perfect place to continue my education and experience. I’ve needed a good, dynamic, user friendly audio filter so I can better hear communications while I work HF. This is  due to my hearing loss as I age. A friend loaned me an active filter with mixed results; the ability filter was limited. I’ve looked around for a reasonably priced digital filter “appliance” that I can tune dynamically with software, stored configurations, and design new filters dynamically. By dynamic, I mean  GUI interface where I can design, store, and recall on demand via a GUI. I’ve developed software in the past on the Windows platform where I can dynamically drag a curve using the mouse and learned how difficult it can be to design a quality interface. In the Amateur radio tradition, and the reason I became a Amateur Radio Operator in the first place, is to learn, design, develop, and apply my skills to advance the state of the art.  So, the goal of this project is to design a digital filter platform I can upload, store, and recall, specific filter profiles on demand, The GUI is still a dream, but as I refine (relearn) my digital signal processing skills, and becoming proficient in digital signal processing, this project is my stretch goal for now. The first steps are to select a platform to implement the filter on, and software tools to implement my ideas.

The Cypress Semiconductor FM4-S6E2CC Platform

I stumbled upon the Cypress FM4-176-S6E2CC-ETH Pioneer Kit  in a rather round about way. I am continually re-educating myself on subject areas I have not used in a while, and happened to be reading, Signals and Systems For Dummies by Dr. Mark Wickert . I decided to visit Dr. Wicker’s web site and am I glad I did. I found a treasure trove of on-line learning opportunities on Dr. Wickert’s web site. Dr. Wicket is teaches communications classes at the University of Colorado – Boulder. As part of Dr. Wikert’s ECE 4655/5655 Real-Time Signal Processing Course the Cypress FM4-176-S6E2CC-ETH Pioneer Kit is used in several of the laboratory assignments. By watching much of Dr. Wickert’s recorded class lectures, reading through the course notes and lab-assignments, and other on-line information, I was able to learn enough to get started with this development kit. There are other references and resources that Dr. Wickert mentions that helped my learning that I will mention as I go. Dr. Wickert’s on-line material provides just enough information to get going and does not “spill the beans” (for those that simply want the answers to their homework). So, I am a bit guilty of “spilling some beans” here as I am applying what I’ve learn from Dr. Wickert’s on-line material. But, I hope to add just enough information to help others out to learn as I did. I really appreciate and admire Dr. Wickert. I wish I could attend his courses.

Digital Filter Design Tools

There are several choices you can use to design digital filters. Some advanced developers write their own tools. Using this approach, you can optimize filter designs to any level you need and have total control over the design process. There are “software packages” for languages such as FORTRAN, C/C++,  Python, and others that you can find that offer digital filter design. Describing the various choices in this category could take many, many pages to do the subject justice, I will offer one example here, and leave the rest to you to Google if you would like more information. The book, “Think DSP”, by Allen B, Downey, O’Reilly Press, ISBN 97801-491-9385-4 is an example of a book that will help you understand some of the background of digital signal process and some filtering. It is based on Python. Using this approach (“roll your own”), I think you will find that you will end up learning a great deal about digital filtering, but will also have to invest plenty of time understanding the nuances of the software design process and sources of error than need to be considered.

A second choice is to used open source or paid software packages specially design for digital signal processing such as GNU Octave,  Scilab, or MATLAB. There are others, but these are three very popular software products. GNU Octave and Scilab are free, can be installed on Windows, Linux, and (I think) MAC, although I have no experience with MAC and cannot attest to installation on the MAC platform.  MATLAB is a paid for software product that has been around for many years. I am a fan of all three. I started with Scilab, used Scilab and Octave for a period, and finally settled with MATLAB for generic use. My choice and progression through these software products was driven by affordability, features, and  efficiency. Clearly, “free” is the best choice as far as cost is concerned. Both Scilab and Octave offered an excellent alternative to the high entry price of MATLAB commercial product which could cost upwards to $20,000 USB for MATLAB and many of the toolboxes you would like or need to use. You can, of course, write your own toolbox, and some do, but there again, time is a factor. I finally settled on MATLAB because Mathworks, the company that develops MATLAB, now offers a reasonable “home use” license for MATLAB. I found that having a commercially available package with support, best fit my situation.

Wikipedia describes MATLAB as, “A multi-paradigm numerical computing environment” using a “proprietary programming language”. You can make a similar conclusion about Scilab and Octave. The point is that all three software packages have a learning curve to use the basic features, and second learning curve to master digital signal processing. All three (Scilab, Octave, and MATLAB) are great choices to learn digitial signal processing as is the “roll your own” approach. For this project, though, I chose to use another software product called ASN Filter Designer that I describe below.

ASN Filter Designer

I discovered ASN filter deisigner by way of a Rick Lyons blog post on another great web site, The title of the blog post is “An Astounding Digital Filter Design Application”. Before I describe what Rick wrote about in his blog, let me mention that Rick is a personal hero of mine, and a friend. Rick is the author an excellent book called, Understanding Digital Signal Processing. I met Rick in a class he was teaching at Signetics in the 1980’s. Before the class, I read the entire first edition of Rick’s book and noted errors (every book has errors) as I went. I spoke with Rick during the breaks (so as not to embarrass him in from of the class) to give him feedback. Many authors appreciate constructive feedback I have found, and Rick is no exception. Rick is one of the most gracious and giving soles you will ever meet and his blogs and book reflect this in his writing style. The book is an excellent introduction to digital signal processing.

But, I digress. So, Rick wrote, in his blog entry, “An Astounding Digital Filter Design Application”, about a new software product called ASN Filter Designer that Rick summaries as:

“The ASN Filter Designer appears to be the Swiss Army Knife of filter design software packages.”.

I contacted Advanced Solutions Nederland, the company that produces the ASN Filter Designer, and purchased a copy. Instead of describe ASN Filter Designer in detail here, I will refer you to the manufacture’s web site, ASN Filter Designer, where a demonstration version as well as tutorials (also search YouTube for additional tutorials) are found.

The reason for my decision to use ASN Filter Designer was driven by speed of development and features. I used MATLAB for some projects, write my own software for others. In this case, It was enough to develop the embedded code for the MCU of choice, but my complex math skills, and digital signal processing skills are dated and I am in the process of re-learning skills. ASN Filter Designer not only offers a fantastic visual presentation allowing you to fine-tune your filters in the real and imaginary planes. The ease of use was perfect for this project, and, I can refer others in the Amateur Radio community that may not have the background, expertise, or budget to use the approaches described above. Granted, you do need to have an understanding of what a digital filter is, what kind of filter you need, and how to implement the filter. That’s, in part, is why I am writing here what I did. Your mileage may vary. Finally, there is a great demonstration of the ASN Filter Designer on ARM/Keil’s website that uses ASN Filter Designer to generate CMSIS-DSP code.

Fixed Verses Floating Point Notation

Some processors, such as the Analog device ADSP-21XX, or the Microchip DSPIC series of digital signal processors used fixed point math. Fixed point processors can use integer and faction notation to represent numbers. In the first case, integer notation, the processor can represent values using unsigned integer notation where a stored number can take on a value from 0 to 2**n where n is the number of bits in the processor word or,  signed integer notation where integers can take on values from -2**(n) to 2**(n-1) where n, again is the number of bits in the processor word. Unsigned fraction notation  and signed fractional notation are notations used in floating point processors. signed fractional notation processors using ANSI/IEEE Std. 754-1985 can represent numbers from +/-3.4×10^38 (largest) and +/-1.2×10^-38 (smallest). A key difference between fixed and floating point representation is that, in fixed point representation, the levels of numeric representation are spread uniformly between 0 and 1. Floating point, is not only has a larger dynamic range than fixed point, but the levels of numeric representation are unequally spread and has large gaps between large numbers, and small gaps between small numbers. Finally, fixed point processor require additional consideration (software) to manage numeric scaling, overflow, and mathematical operations that are not an issue with floating point processors. The cost of development of floating point also tends to be lower than fixed point processors.

You can read more about fixed verses floating point notation at The Scientist and Engineer’s Guide to Digital Signal Processing by Steven W. Smith, PH.D., chapter 28: Digital Signal Processors.

The Embedded Compiler of Choice

…to be continued…