FFT routines for the Netburner ?

Discussion to talk about software related topics only.
Post Reply
Thomasj
Posts: 3
Joined: Sun May 11, 2008 2:46 pm

FFT routines for the Netburner ?

Post by Thomasj »

Hi,
I have a couple of friends that are bee-keepers, and I used to have bees myself. I am designing a device that can analyse the spectral distribution of sound in the 'buzz' inside the hive. It seems like the frequency distribution can tell you when the bees are about to swarm (and you loose half the bees), so it is very interesting to know this for professional bee-kepers. The project is more of an excercise in digital signal processing than something to develop for a market, but it is very interesting topic to study (over-sampling, decimation, filtering etc). I have searched the Netburner examples for FFT code but have come up empty-handed. There exists FFT code for the Coldfire on the 'net, but it would make thing easier for me if someone could point me at some code already adapted to a netburner platform (I have serveral modules, so the actual module type is not so important).

Best Regards,
Thomas Johansson
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: FFT routines for the Netburner ?

Post by lgitlitz »

Freescale provides FFT functions for the eMAC peripheral in their DSP library. You can look at the documentation here:
http://www.freescale.com/files/32bit/do ... umentation
You can get the libraries here after you register:
http://www.freescale.com/webapp/sps/dow ... umentation

There is nothing I know of that is ready to use on a NetBurner platform but this should not be too hard to do. The biggest challenge, and possibly the only challenge, is converting an assembly file made for the Codewarrior assembler to the format used by the GNU assembler. The assembler files provided by freescale are of course for the Codewarrior tools. You can probably figure out the changes required to be GNU compatible by looking at the following file in the NNDK:
C:\Nburn\system\ucosmcfa.s

It will be some tedious formatting changes but nothing nearly as bad as writing your own FFT function for the eMAC peripheral. The eMAC with perform advanced multiply accumulate functions much faster then the standard ALU on the processor. You should also update your NNDK to the one we are releasing in the next few days. There were fixes added to eclipse to allow you to use the eMAC registers and functions properly.

This sounds like an interesting project, keep us updated. Sounds like it would make a great NetBurner wiki if you are interested.
User avatar
yevgenit
Posts: 84
Joined: Fri Apr 25, 2008 12:47 am
Contact:

Re: FFT routines for the Netburner ?

Post by yevgenit »

Possibly, standard acoustic octave and third-octave filters are more relevant than FFT for your application.

In case of the FFT performance isn't significant, you can use the classic FFT code from "The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D."
(free download at http://www.dspguide.com/ch12.htm). My porting of this Fortran/Basic code to GNU C float arithmetics (with some speed improvements) for mod5270 platform executes 1024-point FFT for ~350ms.

I am working now on FFT and digital dilters using eMAC on mod5270 platform. The results will be posted for a few weeks.

The links to two Freescale libraries:

1. DSPLIBUM : Digital Signal Processing Libraries Using the ColdFire eMAC and MAC (pdf)
http://www.freescale.com/files/32bit/do ... df?fsrch=1
"This document provides a library of macros designed to ensure efficient programming of the ColdFire processor using MAX..."

2. Freescale Name:
CFLMOPM : Library of Macros for Optimization Using eMAC and MAC Programmer's Manual (pdf)

Freescale short description:
This programmer's manual provides a detailed description of a set of macros used for optimizations.

Freescale link:
http://www.freescale.com/files/32bit/do ... df?fsrch=1

CFLMOPMSW : Software for the Library of Macros for Optimization Using eMAC and MAC Programmer's Manual (zip)
https://www.freescale.com/webapp/Downlo ... ll&fsrch=1
"Software for the CFLMOPM"

DSPLIBUMSW : "Digital Signal Processing Libraries Using the ColdFire eMAC and MAC User's Manual" Software (zip)
http://www.freescale.com/webapp/sps/dow ... ll&fsrch=1
"Accompanying software to the "Digital Signal Processing Libraries Using the ColdFire eMAC and MAC User's Manual"

________
lgitlitz wrote:Freescale provides FFT functions for the eMAC peripheral in their DSP library. You can look at the documentation here:
http://www.freescale.com/files/32bit/do ... umentation
You can get the libraries here after you register:
http://www.freescale.com/webapp/sps/dow ... umentation

There is nothing I know of that is ready to use on a NetBurner platform but this should not be too hard to do. The biggest challenge, and possibly the only challenge, is converting an assembly file made for the Codewarrior assembler to the format used by the GNU assembler. The assembler files provided by freescale are of course for the Codewarrior tools. You can probably figure out the changes required to be GNU compatible by looking at the following file in the NNDK:
C:\Nburn\system\ucosmcfa.s

It will be some tedious formatting changes but nothing nearly as bad as writing your own FFT function for the eMAC peripheral. The eMAC with perform advanced multiply accumulate functions much faster then the standard ALU on the processor. You should also update your NNDK to the one we are releasing in the next few days. There were fixes added to eclipse to allow you to use the eMAC registers and functions properly.

This sounds like an interesting project, keep us updated. Sounds like it would make a great NetBurner wiki if you are interested.
Yevgeni Tunik
Embedded/RealTime software engineer
https://www.linkedin.com/in/yevgenitunik/
________________________
res
Posts: 5
Joined: Mon May 09, 2011 5:12 am

Re: FFT routines for the Netburner ?

Post by res »

Hi there,

just in case somebody will land this thread seeking a FFT library for NetBurner (like me a few days before:).

I've been rather successful with a KISS FFT library:

http://sourceforge.net/projects/kissfft/

Moderate performance (read as rather good, but definitely not the best), extremely easy to use.

Rough performance indication (on mod5282):
~ 180ms 1024-points fft in floating point
~ 21ms 128-points, floating point

Not so bad, I guess.
EDIT: Useful when a deadline is beyond the corner ...

--res
Last edited by res on Mon May 23, 2011 9:03 am, edited 1 time in total.
User avatar
yevgenit
Posts: 84
Joined: Fri Apr 25, 2008 12:47 am
Contact:

Re: FFT routines for the Netburner ?

Post by yevgenit »

Just for comparison between floating and fractional arithmetics.

I implemented:
- Automatic conversion of Freescale FFT code from CodeWarrior to GNU assembler convention
- Manual conversion of (non-supported) MAC instructions to eMAC instructions
- Some debugging
- Adding feature of programmable quantity of FFT points
- Manual optimization for better using of eMAC 32-bit fractional arithmetic
- Assigning both input samples and twiddle factors to SRAM
Benchmark: 2048-point (time domain samples) FFT took 2 ms (not including windowing). The platform is mod5270 with Fsys=147.456 MHz.

Unfortunately, the company policy don't allow publishing the company owned code.
res wrote: Rough performance indication (on mod5282):
~ 180ms 1024-points fft in floating point
~ 21ms 128-points, floating point

Not so bad, I guess.
--res
Yevgeni Tunik
Embedded/RealTime software engineer
https://www.linkedin.com/in/yevgenitunik/
________________________
res
Posts: 5
Joined: Mon May 09, 2011 5:12 am

Re: FFT routines for the Netburner ?

Post by res »

Well, thanks, I must admit that's rather impressive :)

Actually, the KISSFFT also supports fractional arithmetics, but the results (without any tweaking) were even worse.
Benchmark: 2048-point (time domain samples) FFT took 2 ms (not including windowing). The platform is mod5270 with Fsys=147.456 MHz.
Post Reply