# Unable to read Outputs from DTMF (CM8870) when connected with Atmega8A

#### indersethi96

Joined Oct 12, 2018
5
The DTMF seems to work fine and gives output 4.72V but when I Connect Atmega8A input pins to the Cm8870 the output voltage drops to 0.32V
That is considered by the Atmega8a as 0.

What Can I Do to receive the HIGH and LOW to the microcontroller properly?

Any help would be greatly appreciated.

#### Attachments

• 347.2 KB Views: 8

#### JohnInTX

Joined Jun 26, 2012
4,114
Without a schematic or code listing it's hard to say but are you sure the Atmega pins are actually configured as inputs? Your voltage reading suggests that they are outputting a logic 0.

EDIT: AVCC does not seem to be connected on your PCB. According to 5.1.8 in the ATmega datasheet, it should be connected to Vcc.
Presumably you are using the internal oscillator on the ATmega.
Is the processor running?

FWIW here are the datasheets:

#### Attachments

• 3 MB Views: 2
• 73.6 KB Views: 3
Last edited:

#### indersethi96

Joined Oct 12, 2018
5
Without a schematic or code listing it's hard to say but are you sure the Atmega pins are actually configured as inputs? Your voltage reading suggests that they are outputting a logic 0.

EDIT: AVCC does not seem to be connected on your PCB. According to 5.1.8 in the ATmega datasheet, it should be connected to Vcc.
Presumably, you are using the internal oscillator on the ATmega.
Is the processor running?

FWIW here are the datasheets:

Schematic is attached
Codes are :

C:
#include <avr/io.h>
#define F_CPU 1000000UL
#include <util/delay.h>

int main(void)
{
DDRB = 0x78;
DDRC =(1<<PINC0);
DDRD = 0xff;
PORTD = 0x00;

/* Replace with your application code */
while (1)  {

PORTC = 0x01;
if(PINB == 0b00000010){
PORTD = 0b10000000;
_delay_ms(400);
continue;
}
else{
PORTD = 0x00;
_delay_ms(400);
continue;
}

}
}
Mod edit: code tags

I found AVCC is the different supply for ADC pins That's why it's not connected, however, I Tried it with the connection of 5v on AVCC and everything was same as described nothing solved. Atmega8A is running on 1MHz (default). I have tested blink and some other programs they were working fine, I guess no problem with the IC itself.

Last edited by a moderator:

#### JohnInTX

Joined Jun 26, 2012
4,114
In your code DDRB = 01111000 (78h) Your DTMF data comes in on PORTB bits 4-3-2-1 i.e. xxxiiiix (where i is an input bit). You appear to have entered the data of the DDRB setting backwards. It should be xxx0000x where x is the unused bits. Note that a '0' makes the port an input.

Also, you probably want to connect the StD output (pin 16 of the DTMF) to an input on the AVR and poll it to indicate DTMF tone present/absent. Otherwise, you will be unable detect successive DTMF tones of the same value.

Last edited:

#### indersethi96

Joined Oct 12, 2018
5
In your code DDRB = 01111000 (78h) Your DTMF data comes in on PORTB bits 4-3-2-1 i.e. xxxiiiix (where i is an input bit). You appear to have entered the data of the DDRB setting backwards. It should be xxx0000x where x is the unused bits. Note that a '0' makes the port an input.

Also, you probably want to connect the StD output (pin 16 of the DTMF) to an input on the AVR and poll it to indicate DTMF tone present/absent. Otherwise, you will be unable to detect successive DTMF tones of the same value.
Sorry about that wrong pins configuration of the input pins. I understand that and was using the same as you stated, during just random tries I changed it and pasted it here. It was DDRB = 0xE1 initially and that doesn't work too. Also, I tried in Binary to Avoid mistake DDRB = 0b11100001 but that doesn't work either.

I was searching over the web and found someone also encounters the same problem just different Microcontroller

#### indersethi96

Joined Oct 12, 2018
5
In your code DDRB = 01111000 (78h) Your DTMF data comes in on PORTB bits 4-3-2-1 i.e. xxxiiiix (where i is an input bit). You appear to have entered the data of the DDRB setting backwards. It should be xxx0000x where x is the unused bits. Note that a '0' makes the port an input.

Also, you probably want to connect the StD output (pin 16 of the DTMF) to an input on the AVR and poll it to indicate DTMF tone present/absent. Otherwise, you will be unable detect successive DTMF tones of the same value.
Still problem is not solved... Anyone can help me?

#### JohnInTX

Joined Jun 26, 2012
4,114
Hmmm..
Next thing I'd do is figure out whether it was the DTMF chip or uC causing problems. Disconnect the data lines from the uC.
The DTMF chip is rated to source and output high of 4.6V at .4ma. Dividing 4.6V by .0004A gives 11500 ohms. Connect a resistor close to that value to each data pin out of the DTMF chip (Atmel disconnected) and verify that the high voltage is about 4.6V or so. That will indicate that the DTMF chip is driving OK.
If that works, verify the uC inputs. Run the program and connect the inputs through a higher valued resistor (33K or so) to Vcc then ground and be sure that the voltage at the IO pin follows to make sure that this lower source current will bias the port input high and low.
One of these tests should fail and identify where you need to look further.
Recheck your circuit to be sure that nothing else is connected to those IO pins.
Maybe the DTMF chip is bad/counterfeit?

Be sure TOE (pin 10) is a solid logic '1' to enable the DTMF outputs.
In your code, be sure to consider any alternate functions for the input pins that may be overriding basic IO and turn them off as necessary.
Post your current schematic and code.

Good luck!

#### indersethi96

Joined Oct 12, 2018
5
Hmmm..
Next thing I'd do is figure out whether it was the DTMF chip or uC causing problems. Disconnect the data lines from the uC.
The DTMF chip is rated to source and output high of 4.6V at .4ma. Dividing 4.6V by .0004A gives 11500 ohms. Connect a resistor close to that value to each data pin out of the DTMF chip (Atmel disconnected) and verify that the high voltage is about 4.6V or so. That will indicate that the DTMF chip is driving OK.
If that works, verify the uC inputs. Run the program and connect the inputs through a higher valued resistor (33K or so) to Vcc then ground and be sure that the voltage at the IO pin follows to make sure that this lower source current will bias the port input high and low.
One of these tests should fail and identify where you need to look further.
Recheck your circuit to be sure that nothing else is connected to those IO pins.
Maybe the DTMF chip is bad/counterfeit?

Be sure TOE (pin 10) is a solid logic '1' to enable the DTMF outputs.
In your code, be sure to consider any alternate functions for the input pins that may be overriding basic IO and turn them off as necessary.
Post your current schematic and code.

Good luck!

After connecting 10k resistor on DTMF outputs the voltage on outputs pin is 4.96V (when the key tone is pressed). Seems like DTMF is working fine.
Imm I'm using AVR DUDE to flash the Atmega-8A but ... there is no option for Atmega8A instead I'm using Atmega8 is that can be a problem? I tried to find a programmer to flash AtMega8A but none of them have an option for Atmega8A.

During testing, I found when DTMF outputs connected to Atmega8A, two pins become full high (5V) the rest two PB1 and PB2 don't go more than 0.38V (HIGH logic is given to these pins). During LOW logic all works fine and become 0V

SCHEMATIC

CODE:

#include <avr/io.h>
#define F_CPU 1000000UL
#include <util/delay.h>

int main(void)
{
DDRB=0x00;
DDRC =(1<<PINC0);
DDRD = 0xff;
PORTD = 0x00;

/* Replace with your application code */
while (1) {

PORTC = 0x01;
if(PINB == 0b00010000){
PORTD = 0b10000000;
_delay_ms(400);
continue;
}
else{
PORTD = 0x00;
_delay_ms(400);
continue;
}

}
}

The above codes work but only if ATMEGA8A is pressed hard to the PCB and it's like blinking or it is going into else statement... relay sounds Tik Tok Tik Tok (DTMF output doesn't change ) ... I guess the problem with the AtMega8A itself.

I m also doing further test to figure out but you're suggestions are always welcome ...