Digital Filter Potpourri
BR
Posts: 92
Anybody out there doing DSP on the Prop? Or any kind of digital filtering?
I've been playing around with various digital filters on the prop for a some time now, both as a means to teach myself about DSP and also as a means to learn Spin/PASM. I know what some of you are probably saying...if you want to do DSP, why use a Prop...buy a DSP. Well, although the prop is no DSP, it is capable of some pretty decent signal processing. This humble moving average filter is capable of just under 1M samples/sec in a single cog. Also, the Prop's ease of use and accessibility make it a great platform for learning DSP (an Andy Lindsay lab on this topic would be neat). Finally, there are tons of applications where a little mild digital filtering is useful, especially if it can be done without any extra hardware. If that's not reason enough, how about "I felt like it"?
Looking to the future, it appears that the PropII is going to have something like 20X the DSP capability of the prop 1 (figure 8X the MIPS/cog, plus a MUL instruction, plus CORDIC, plus a bigger bag-o-tricks in the counters). Come to think of it, didn't Chip say the Prop II would have a MAC instruction? If so, make that 25X.
With the above in mind, it seems to me that it would be nice to fill out the Prop's repertoire a bit in the digital filtering and DSP department. So I thought I'd start a thread to see if I could find out what's already out there and what's being worked on relative to DSP and digital filtering on the prop. And maybe pick the brains of a few of gurus out there.
Actually, I'm a bit surprised that there aren't more DSP-related objects in obex or more DSP related threads in the forum. There are a lot of "building block" elements that have come along over time, particularly lately. A few recent ones I can think of:
Just for good measure, here's a link to my favorite DSP reference: www.dspguide.com
In my DSP meanderings, I've implemented a variety of IIR and FIR digital filters on the prop and have attached a few of these for folks to peruse. The "recurse_demo" attachment is an IIR implemented in spin using integer math. The "filters_demo" contains several filters, most of them of FIR. The demos are set up so one can easily try out the various filters. A variety of example filter kernels are provided. Any comments/suggestions welcome.
Post Edited (BR) : 6/26/2010 9:49:23 PM GMT
I've been playing around with various digital filters on the prop for a some time now, both as a means to teach myself about DSP and also as a means to learn Spin/PASM. I know what some of you are probably saying...if you want to do DSP, why use a Prop...buy a DSP. Well, although the prop is no DSP, it is capable of some pretty decent signal processing. This humble moving average filter is capable of just under 1M samples/sec in a single cog. Also, the Prop's ease of use and accessibility make it a great platform for learning DSP (an Andy Lindsay lab on this topic would be neat). Finally, there are tons of applications where a little mild digital filtering is useful, especially if it can be done without any extra hardware. If that's not reason enough, how about "I felt like it"?
Looking to the future, it appears that the PropII is going to have something like 20X the DSP capability of the prop 1 (figure 8X the MIPS/cog, plus a MUL instruction, plus CORDIC, plus a bigger bag-o-tricks in the counters). Come to think of it, didn't Chip say the Prop II would have a MAC instruction? If so, make that 25X.
With the above in mind, it seems to me that it would be nice to fill out the Prop's repertoire a bit in the digital filtering and DSP department. So I thought I'd start a thread to see if I could find out what's already out there and what's being worked on relative to DSP and digital filtering on the prop. And maybe pick the brains of a few of gurus out there.
Actually, I'm a bit surprised that there aren't more DSP-related objects in obex or more DSP related threads in the forum. There are a lot of "building block" elements that have come along over time, particularly lately. A few recent ones I can think of:
- Ale's FFT has been around a while. Here's a demo of it.
- The Fast Hartley Transform might be able to do even faster FFT's than Ale's if implemented in PASM.
- See also Nick's Fast Heartley Transform, version 3
- Lonesock's fast block transfer algorithm should be quite handy for moving FFT data in/out of a cog.
- Follow-up thread to above block transfer thread
- I was recently reminded of Phil's speech recognition thread, which does have some DSP tidbits in it. Phil's also got a link there to a applet that will kick out IIR filter coefficients.
- The Lonesock Pseudo-Walsh thread (can't find it at the moment) Added link, thanks Bob.
- The Jay Kickliter FFT thread (can't find that one, either...argh!) Added link, thanks Bob.
- Beau's audio spectrum analyzer
- reimay's FFT demo
- Phil's Bell 202 modem object Now where's that thread? here it is thanks again, Bob.
- Ahle2's SIDcog C64 sound chip emulator
- SRLM's bevy of quick 'n dirty filters
- Robitics' follow on to SRLM
- Prof Braino's Fourier For Dummies page
- Heater's Fast Fourier Transform
- Phil's Hilbert Transform Thread
- Phil's FIR2PASM: Automatic FIR Filter Code Generator
- Andrey's Fast Heartley Transform
- Istvan's Fast & Accurate FFT
- GCC demo of IIR filter
- Propeller signal generator
- Audio Spectrum Analyzer.
- Andrey's constant-Q spectrum analyzer
- Lots of others I'm missing? Perhaps fossilized in the rock strata of threads past? Chime in if you know where a gem is buried...
Just for good measure, here's a link to my favorite DSP reference: www.dspguide.com
In my DSP meanderings, I've implemented a variety of IIR and FIR digital filters on the prop and have attached a few of these for folks to peruse. The "recurse_demo" attachment is an IIR implemented in spin using integer math. The "filters_demo" contains several filters, most of them of FIR. The demos are set up so one can easily try out the various filters. A variety of example filter kernels are provided. Any comments/suggestions welcome.
Post Edited (BR) : 6/26/2010 9:49:23 PM GMT
Comments
Thanks! I've been interested in DSP on a Prob after playing with dsPics for a few years.
Re: The Lonesock Pseudo-Walsh thread (can't find it at the moment)
Try This : SPeechIN: (WiP) using the Poor Man's DCT - need Testers!
http://forums.parallax.com/showthread.php?p=848739
Re:The Jay Kickliter FFT thread (can't find that one, either...argh!)
Try This:
http://forums.parallax.com/showthread.php?p=845652
Re: Just for good measure, here's a link to my favorite DSP reference: www.dspguide.com
It's great and it's FREE
Other Books I use are:
Mikroe - Free Online Book: “Digital Filter Design” - www.mikroe.com/en/books/digital-filter-design/ch1/
Understanding Digital Signal Processing - Richard G. Lyons.
DSP Filters - Electronics Cookbook Series
Digital Signal Processing and the Microcontroller - Motorola University
Nick
@AnyoneInterested: I took a shot at implementing the 4-element recursive IIR filter in PASM with integer math. Demo attached (filter_rc4_asm). I estimate that it can handle between 40K and 180K samples/sec in 1 cog @ 80 MHz, depending on the complexity of the particular filter chosen. So its got decent bandwidth. But performance is so-so...I suspect a big part of that is that I haven't been particularly thorough in the fixed point math implementation. I've been hoping someone would put together a nice PASM fixed point math library that I can leech off of... <cricket> <cricket> anybody?
To console myself, I decided to give float math a shot; this kind of filter works best with float math anyway. And it's high time I learned to use floatmath on the prop. Demo attached (filter_rc6). Filter numerical performance is pretty good. Speed not as good...the attached demo yields about 4.8K samples/sec for a 6-pole low pass filter and 12.4K samples/sec for the simpler 2-pole low pass filter. The implementation isn't particularly elegant, so it should be possible to squeeze a bit more performance out of this (20% maybe?).
http://forums.parallax.com/showthread.php?p=789451
Skipping all of the actual PSG emulation, my filter code could process at least 4 channels at 44100 Hz sample rate using just a single cog.
The 567 is hard to find and also expensive....the prop should be able to detect a pure tone hidden in a bit of noise.
Removing that chip would save 3 dollars a board.
The 567 was a qwik n dirty answer and I was too short on free time to work out a better solution.
The Goertzel object embedded in my above-cited speech recognition program will do what you want. If you're doing DTMF recognition, there's a demo for that that uses the Goertzel object here:
http://forums.parallax.com/showthread.php?p=876627
-Phil
DTMF has 2 tones, I wonder how many different tones could be sorted out and tracked at once
using several cores of a prop? I can think of some really cool communications monitoring projects
if several frequencies could be handled. Not simply multi freq protocols but if the tones were being picked
up by a radio receiver you could set the bandwidth wide and decode lots of signals off to either side.
There are lots of strange comm protocols out there and a prop based project that could decode most of
them and display the output on a vga monitor would be a fun thing. My original prop project
was for watching a data stream looking for patterns so an alarm could sound and the data would
be logged to eeprom.
I'm off to look at that thread...
OBC has a list of thread indexes so OBC could you add this one to it. I maintain a couple of indexes (links in my signature).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
The Goertzel object can easily handle eight center frequencies at once, which is required for decoding DTMF.
-Phil