Forums

Implementing simple DTMF decoder on Blackfin BF533 DSP

Started by Mike November 18, 2010
Hello all,

As a term project I would like to implement a simple DTMF decoder on a
Blackfin BF533 EZ-KIT development board. I have the necessary matlab
files to generate the tones and I have created 8 FIR bandpass filters,
one for each DTMF frequency +/- 20Hz. I made these in Matlab using
fdatool and output to a 16 bit signed integer.

I took Analog Device's Talkthrough example program and I apply these
filters every SPORT0 ISR. The output for each filter goes into its own
variable. From there, I assume that I could take the highest two
bandpass filter outputs, look up the related DTMF value and I would
have my project done.

However it doesn't appear to be working that way. I've been doing as
much research as possible (surprisingly minimal information for this
specific topic) and have heard mention of "Goertzel's Algorithm", etc.
I believe that kind of solution is above the scope of my course.

I have used my filter algorithm to successfully implement a high/low
pass FIR filter so I don't believe the problem to be there. I have a
code along the lines of

if(output_bp_697 > all the other output variables)
    dtmf_row = 1;

When I throw a breakpoint on dtmf_row = 1 it trips randomly. My
debugging process is to call the Matlab function to generate the
tones, then hit Debug > Run. It is successfully passing the tones
through to my output speakers.

Is my approach correct? Does anyone have any hints?

Much appreciated,
Mike
On Nov 18, 11:32&#2013266080;pm, Mike <mikesorre...@gmail.com> wrote:
> Hello all, > > As a term project I would like to implement a simple DTMF decoder on a > Blackfin BF533 EZ-KIT development board. I have the necessary matlab > files to generate the tones and I have created 8 FIR bandpass filters, > one for each DTMF frequency +/- 20Hz. I made these in Matlab using > fdatool and output to a 16 bit signed integer. > > I took Analog Device's Talkthrough example program and I apply these > filters every SPORT0 ISR. The output for each filter goes into its own > variable. From there, I assume that I could take the highest two > bandpass filter outputs, look up the related DTMF value and I would > have my project done. > > However it doesn't appear to be working that way. I've been doing as > much research as possible (surprisingly minimal information for this > specific topic) and have heard mention of "Goertzel's Algorithm", etc. > I believe that kind of solution is above the scope of my course. > > I have used my filter algorithm to successfully implement a high/low > pass FIR filter so I don't believe the problem to be there. I have a > code along the lines of > > if(output_bp_697 > all the other output variables) > &#2013266080; &#2013266080; dtmf_row = 1; > > When I throw a breakpoint on dtmf_row = 1 it trips randomly. My > debugging process is to call the Matlab function to generate the > tones, then hit Debug > Run. It is successfully passing the tones > through to my output speakers. > > Is my approach correct? Does anyone have any hints? > > Much appreciated, > Mike
How are you "metering" the output of your firs? I would have thought you should be squaring or rectifying the outputs and then running through simple first order filters or other averaging process to smooth out any transients.
On Nov 18, 6:40&#2013266080;pm, davew <david.wo...@gmail.com> wrote:
> On Nov 18, 11:32&#2013266080;pm, Mike <mikesorre...@gmail.com> wrote: > > > > > > > > > Hello all, > > > As a term project I would like to implement a simple DTMF decoder on a > > Blackfin BF533 EZ-KIT development board. I have the necessary matlab > > files to generate the tones and I have created 8 FIR bandpass filters, > > one for each DTMF frequency +/- 20Hz. I made these in Matlab using > > fdatool and output to a 16 bit signed integer. > > > I took Analog Device's Talkthrough example program and I apply these > > filters every SPORT0 ISR. The output for each filter goes into its own > > variable. From there, I assume that I could take the highest two > > bandpass filter outputs, look up the related DTMF value and I would > > have my project done. > > > However it doesn't appear to be working that way. I've been doing as > > much research as possible (surprisingly minimal information for this > > specific topic) and have heard mention of "Goertzel's Algorithm", etc. > > I believe that kind of solution is above the scope of my course. > > > I have used my filter algorithm to successfully implement a high/low > > pass FIR filter so I don't believe the problem to be there. I have a > > code along the lines of > > > if(output_bp_697 > all the other output variables) > > &#2013266080; &#2013266080; dtmf_row = 1; > > > When I throw a breakpoint on dtmf_row = 1 it trips randomly. My > > debugging process is to call the Matlab function to generate the > > tones, then hit Debug > Run. It is successfully passing the tones > > through to my output speakers. > > > Is my approach correct? Does anyone have any hints? > > > Much appreciated, > > Mike > > How are you "metering" the output of your firs? &#2013266080;I would have thought > you should be squaring or rectifying the outputs and then running > through simple first order filters or other averaging process to > smooth out any transients.
I think you are asking how I score the filter outputs. For a simple test I did if( (output_697 > output_770) && (output_697 > output_852) && ... ) local_variable = 1; With output_697 being the bandpass filter for the 697Hz tone, indicating the first row in the DTMF table, and other output_XXXs representing the 3 other tones for the 3 other DTMF lookup table rows. I then sent DTMF signals from rows other than the 697Hz row, with a breakpoint in that if() statement. Because these tones weren't comprised of the 697Hz I thought that the bandpass output would be lower than the bandpass output from the appropriate row, thus never entering that if() statement. However, the breakpoint inside the if() was still triggered. I tried using VisualDSP++'s debug plotting function but couldn't reliably plot frequency vs. time. Thanks, Mike
On Nov 18, 6:32&#2013266080;pm, Mike <mikesorre...@gmail.com> wrote:
> Hello all, > > As a term project I would like to implement a simple DTMF decoder on a > Blackfin BF533 EZ-KIT development board. I have the necessary matlab > files to generate the tones and I have created 8 FIR bandpass filters, > one for each DTMF frequency +/- 20Hz. I made these in Matlab using > fdatool and output to a 16 bit signed integer. > > I took Analog Device's Talkthrough example program and I apply these > filters every SPORT0 ISR. The output for each filter goes into its own > variable. From there, I assume that I could take the highest two > bandpass filter outputs, look up the related DTMF value and I would > have my project done. > > However it doesn't appear to be working that way. I've been doing as > much research as possible (surprisingly minimal information for this > specific topic) and have heard mention of "Goertzel's Algorithm", etc. > I believe that kind of solution is above the scope of my course. > > I have used my filter algorithm to successfully implement a high/low > pass FIR filter so I don't believe the problem to be there. I have a > code along the lines of > > if(output_bp_697 > all the other output variables) > &#2013266080; &#2013266080; dtmf_row = 1; > > When I throw a breakpoint on dtmf_row = 1 it trips randomly. My > debugging process is to call the Matlab function to generate the > tones, then hit Debug > Run. It is successfully passing the tones > through to my output speakers. > > Is my approach correct? Does anyone have any hints? > > Much appreciated, > Mike
I've found http://www.analog.com/en/embedded-processing-dsp/blackfin/bf_dtmfm_01/processors/product.html DTMF decoder software module, however it takes input in the form of a pcm file. From what I've gathered its some kind of raw audio format. I can't find much information regarding Blackfin and PCM beyond that. -Mike
On 11/18/2010 06:49 PM, Mike wrote:
> On Nov 18, 6:40 pm, davew<david.wo...@gmail.com> wrote: >> On Nov 18, 11:32 pm, Mike<mikesorre...@gmail.com> wrote: >> >> >> >> >> >> >> >>> Hello all, >> >>> As a term project I would like to implement a simple DTMF decoder on a >>> Blackfin BF533 EZ-KIT development board. I have the necessary matlab >>> files to generate the tones and I have created 8 FIR bandpass filters, >>> one for each DTMF frequency +/- 20Hz. I made these in Matlab using >>> fdatool and output to a 16 bit signed integer. >> >>> I took Analog Device's Talkthrough example program and I apply these >>> filters every SPORT0 ISR. The output for each filter goes into its own >>> variable. From there, I assume that I could take the highest two >>> bandpass filter outputs, look up the related DTMF value and I would >>> have my project done. >> >>> However it doesn't appear to be working that way. I've been doing as >>> much research as possible (surprisingly minimal information for this >>> specific topic) and have heard mention of "Goertzel's Algorithm", etc. >>> I believe that kind of solution is above the scope of my course. >> >>> I have used my filter algorithm to successfully implement a high/low >>> pass FIR filter so I don't believe the problem to be there. I have a >>> code along the lines of >> >>> if(output_bp_697> all the other output variables) >>> dtmf_row = 1; >> >>> When I throw a breakpoint on dtmf_row = 1 it trips randomly. My >>> debugging process is to call the Matlab function to generate the >>> tones, then hit Debug> Run. It is successfully passing the tones >>> through to my output speakers. >> >>> Is my approach correct? Does anyone have any hints? >> >>> Much appreciated, >>> Mike >> >> How are you "metering" the output of your firs? I would have thought >> you should be squaring or rectifying the outputs and then running >> through simple first order filters or other averaging process to >> smooth out any transients. > > I think you are asking how I score the filter outputs. For a simple > test I did > > if( (output_697> output_770)&& (output_697> output_852)&& ... ) > local_variable = 1; > > With output_697 being the bandpass filter for the 697Hz tone, > indicating the first row in the DTMF table, and other output_XXXs > representing the 3 other tones for the 3 other DTMF lookup table rows. > > I then sent DTMF signals from rows other than the 697Hz row, with a > breakpoint in that if() statement. Because these tones weren't > comprised of the 697Hz I thought that the bandpass output would be > lower than the bandpass output from the appropriate row, thus never > entering that if() statement. However, the breakpoint inside the if() > was still triggered. > > I tried using VisualDSP++'s debug plotting function but couldn't > reliably plot frequency vs. time.
No, he's asking if you're aware that the output of a bandpass filter is a sinusoid, and therefore has an amplitude that goes from some maximum, through zero, to the opposite polarity, and back. So you need to do something to figure out what the strength of the sine wave is, not the instantaneous output. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On Nov 19, 12:36&#2013266080;am, Tim Wescott <t...@seemywebsite.com> wrote:
> On 11/18/2010 06:49 PM, Mike wrote: > > > > > > > > > > > On Nov 18, 6:40 pm, davew<david.wo...@gmail.com> &#2013266080;wrote: > >> On Nov 18, 11:32 pm, Mike<mikesorre...@gmail.com> &#2013266080;wrote: > > >>> Hello all, > > >>> As a term project I would like to implement a simple DTMF decoder on a > >>> Blackfin BF533 EZ-KIT development board. I have the necessary matlab > >>> files to generate the tones and I have created 8 FIR bandpass filters, > >>> one for each DTMF frequency +/- 20Hz. I made these in Matlab using > >>> fdatool and output to a 16 bit signed integer. > > >>> I took Analog Device's Talkthrough example program and I apply these > >>> filters every SPORT0 ISR. The output for each filter goes into its own > >>> variable. From there, I assume that I could take the highest two > >>> bandpass filter outputs, look up the related DTMF value and I would > >>> have my project done. > > >>> However it doesn't appear to be working that way. I've been doing as > >>> much research as possible (surprisingly minimal information for this > >>> specific topic) and have heard mention of "Goertzel's Algorithm", etc. > >>> I believe that kind of solution is above the scope of my course. > > >>> I have used my filter algorithm to successfully implement a high/low > >>> pass FIR filter so I don't believe the problem to be there. I have a > >>> code along the lines of > > >>> if(output_bp_697> &#2013266080;all the other output variables) > >>> &#2013266080; &#2013266080; &#2013266080;dtmf_row = 1; > > >>> When I throw a breakpoint on dtmf_row = 1 it trips randomly. My > >>> debugging process is to call the Matlab function to generate the > >>> tones, then hit Debug> &#2013266080;Run. It is successfully passing the tones > >>> through to my output speakers. > > >>> Is my approach correct? Does anyone have any hints? > > >>> Much appreciated, > >>> Mike > > >> How are you "metering" the output of your firs? &#2013266080;I would have thought > >> you should be squaring or rectifying the outputs and then running > >> through simple first order filters or other averaging process to > >> smooth out any transients. > > > I think you are asking how I score the filter outputs. For a simple > > test I did > > > if( (output_697> &#2013266080;output_770)&& &#2013266080;(output_697> &#2013266080;output_852)&& &#2013266080;... ) > > &#2013266080; &#2013266080; &#2013266080;local_variable = 1; > > > With output_697 being the bandpass filter for the 697Hz tone, > > indicating the first row in the DTMF table, and other output_XXXs > > representing the 3 other tones for the 3 other DTMF lookup table rows. > > > I then sent DTMF signals from rows other than the 697Hz row, with a > > breakpoint in that if() statement. Because these tones weren't > > comprised of the 697Hz I thought that the bandpass output would be > > lower than the bandpass output from the appropriate row, thus never > > entering that if() statement. However, the breakpoint inside the if() > > was still triggered. > > > I tried using VisualDSP++'s debug plotting function but couldn't > > reliably plot frequency vs. time. > > No, he's asking if you're aware that the output of a bandpass filter is > a sinusoid, and therefore has an amplitude that goes from some maximum, > through zero, to the opposite polarity, and back. &#2013266080;So you need to do > something to figure out what the strength of the sine wave is, not the > instantaneous output. > > -- > > Tim Wescott > Wescott Design Serviceshttp://www.wescottdesign.com > > Do you need to implement control loops in software? > "Applied Control Theory for Embedded Systems" was written for you. > See details athttp://www.wescottdesign.com/actfes/actfes.html
Ah! Yeah I was having some issues understanding what the output was actually representing. Am I correct in thinking that I can compare the maximum values of the filter outputs to score my output as I described above? I guess I should do this over a short period of time as well. Thanks, will try this in the lab today. -Mike