The Goertzel Algorithm on the MSP430

 


August 8, 2014

I'm working on a radio project replacing the microprocessor in the likes of a Motorola Maratrac. The Radius and Maxtrac are also produced with the same basic design. I'm doing the first test on a Radius. Most of the control is pretty straight forward. But what about Private Line decoding without adding a special chip?  The Goertzel Algorithm to the rescue. This is efficient enough that summing can be done inside an interrupt. For more information, see:

The Goertzel algorithm on Wikipedia

And Google will come up with an article written by Kevin Banks, great stuff, but there is an error in the example code! Somewhere a long the line it was decided to cast the intermediate, k, to an int. Well in most application k will be very small as an int and a lot of precision is lost. So as not to create errors of 10 to 15%, it should have been typed a double. And if that is done the addition of .5 for rounding needs to be removed.

k= size_of_sample_window * target_frequency / sample_rate;

In my application the math will be done with integers so a floating point library does not need to be pulled in. I would say that floating point on the MSP430 should be avoided at all cost. I had done one project with a large amount of trig calculation. Scaled for ints and use a lookup and interpolate method for sine. The results where very good, so it can be done.

First is to generate the parameters for each of the PL slots of interest and test the parameters for soundness. This is done in Microsoft's Visual Studio.

Link to Visual Studio solution

August 9, 2014

More work, I've created a second project in the solution. Refining the first project generating a header for the MSP430. The integer testing is looking good. I have decided to use a factor according to frequency to scale the power across the band. It is much simpler, and will use less memory, than calculating the power after sampling. If you don't want to work with the VS solution, here are the salient files for implementation on the MSP430 or any other microprocessor:

PrivateLine.h
PrivateLine.cpp

It may be a little time before I accually implament this on the MSP430. I have more to work out on a radio project that it is intended for.

The Radius Project



Thanks, Dan.

Copyright © 1996 - 2014, Highlands Electronics All Rights Reserved.
Page created: 8 aug 14   rev:
8 aug 14

http://www.lakeweb.net/MSP430/Goertzel_Algorithm.html