cancel
Showing results for 
Search instead for 
Did you mean: 

Fast DTMF Decode

picguy2
Associate II
Posted on November 20, 2010 at 00:16

Fast DTMF Decode

5 REPLIES 5
Posted on May 17, 2011 at 14:15

''Clicking on 'Code Of Conduct' causes wheels to spin and returns me to back to the forum page.''

 

I get a pop-up window with the terms in:

https://my.st.com/public/STe2ecommunities/mcu/_layouts/ST/MYSTForum/CodeOfConduct.aspx

The actual

'Code Of Conduct' link is a Javascript - maybe you have that disabled?

One of the prohibited items is,

''*** Advertising or any form of commercial solicitation''

But maybe it would be a good idea if there were a place for posting such ''product anouncements''...

janvi2
Associate II
Posted on May 17, 2011 at 14:15

My stm32 application decodes DTMF by hardware. The combination of any general purpose timer with a DMA channel writes a table with the detected puls length and/(or frequency. All you need in software is a simple compare in the interrupt service routine generated by DMA. Can be set up for falling and rising edges. Code can be easily implemented by using the free stm32 CMSIS library.

After replacing the CMSIS library with direct register acces, the same timer is able to switch between Rx and Tx. This way, picguy should better offer his code in the 8 bit pic forum for old fashioned uC without extensive Timer - DMA capabilities.

Posted on May 17, 2011 at 14:15

http://en.wikipedia.org/wiki/Goertzel_algorithm

John F.
Senior
Posted on May 17, 2011 at 14:15

Have a look at the Goertzel algorithm.

picguy2
Associate II
Posted on May 17, 2011 at 14:15

I use the Goertzel algorithm.  My trick is that I precondition ADC inputs such that integer math works rather than the obvious floating point implementation.  FWIW, more points makes a narrower filter at the various target frequencies.  At 8KHz sample rate using 100 points (12.5 milliseconds of digitized analog samples) works well.  My crappy $12.95 Fry’s handset often failed on the 2580 column using 200 points.  In retrospect, (overlapping) 25 milliseconds of samples is overlong for good decodes anyway.

I also run the second harmonics of the standard DTMF tones.  This is done to reject otherwise good decodes.  The elimination of these frequencies would save ~40% of the calculation time.

Note for Janvi-

You wrote that your stm32 application decodes DTMF by hardware.  It appears that you are using a timer and DMA channel and ultimately using a table of pulse lengths.  Would you be so kind as to point me to a description of your technique?  Are you looking at zero crossings detected via an stm32 analog port or external hardware?

I’m confused about your reuse of the timer.  It makes it sound as if DTMF decode and its inverse (tone generation) are somehow coupled in some way other than the specific frequencies involved.  My tone generation uses assembly code for a fast sin(x) where x is an unsigned integer where 0 to FFFFFFF = 0 to 2pi.  That sin(x) is only good to 12 bits but it’s more than good enough for tone generation.

Email is in original post if you wish to use it.