Atmega 1284P Port Voltage drops

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everyone,

i have a simple LED circuit connected to the Atmega 1284P. I have the LED on PC0 to ground. When i set PC0 to high, it supplies 5V (the same as Vcc) without a load (the LED). With the LED connected, the voltage drops to 1.5V. According to the datasheet, a port can handle 40mA of current.

Would it be better to directly connect the LED (of course with a resistor) to 5V (Vcc) and then to PC0 an let it light when PC0 is low?

Is the voltage drop in the described circuit normal?

Sorry for that easy question, but i have searched several forums an tutorials.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Du you have a resistor between LED and port pin??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you use a resistor in series with the LED on your first setup, (Micro's pin to resistor, to LED to Gnd)? A good resistor for mst LEDs would be 330 or 470 ohms for your 5V supply.

The 1.5V reading sounds like you connected the LED directly to the port pin without a resistor.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

steinerhippo wrote:
According to the datasheet, a port can handle 40mA of current.
No, not really. This is the absolute maximum before the I/O pin could self destruct.
1284P data sheet wrote:
Absolute Maximum Ratings
DC Current per I/O Pin ... 40.0 mA

26.1 DC Characteristics

5. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:.....

Notice you only get around 10 ma per pin at 3 volts Vcc. The safe current draw for each pin is around 20 ma at 5 volts Vcc. There are also limits on how much current total may be drawn by all the pins from groups of ports.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I measured the 1.5V with and without a resistor. The usage of transistors to drive the LEDs worked fine.
I measured the current from the LED: 7mA. So this shouldn't be a problem for the port. And i only had one LED hooked up.

But now, i think i blew the mcu. The atmel programes fine, but it wont set any ports high :(

Damn beginners mistakes ;(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
but it wont set any ports high
So do we ASS-U-ME that you have programmed the pin as an output?

It would help if you had posted some code.

Did you have a resistor in series with the I/O and base of the transistor? What value?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh sorry, code would help for sure.
Here is what i have tried at the end:

#include 

int main(void) {
    DDRC = 0xFF; \\set outputs
    PORTC = 0xFF; \\set outputs high

    while(1) {
    }

    return 0; \\never reached
}

I tried the same code with DDRB and PORTB, with the same result.
And in this code i didn't use any load. I measured directly on the mcu.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that if an AVR remains in reset or does not clock then the default state of all ports is tristated inputs. I wonder if maybe the AVR is not clocking? Have you ever attempted to change the fuses?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What voltage can you measure on the VCC pin if you try to drive the load? Maybe your power supply is too weak or you have a PCB failure (wrong components attached).

Regards
Sebastian

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@S-Sohn: The supply voltage on Vcc remains 5V. You're from Germany. Maybe you know the Pollin NET-IO board. This one i'm using currently.

@clawson: I disabled JTAG but didn't try to change the fuses after I recognized that the mcu doens't set any output high. But I tried to reflash it and this went fine. Would the mcu reflash without a clock?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, I have no experience with the NET-IO board.
But as far as I see, the board is designed for the ATmega32 (DIP package). The ATmega32 and the ATmega1284P should be pincompatible and there are only a few minor differences in fuse settings.

Do you see the same voltage drop if you assemble the ATmega32? This may help to discern board failures and AVR ATmega1284P issues.

Have you measured total current consumption of the board? Is the voltage regulator and/or the AVR hot?

Have you connected anything else to the board? The board has a bridge rectifier on the power supply input. If you use the same mains adapter to supply the NET-IO board and other circuits connected to the board, the voltage shift caused by the bridge rectifier can produce trouble.

I have attached the schematic of the board. Maybe someone else sees any other issues.

The AVR-NET-IO-board datasheet is available here.

Regards
Sebastian

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It has nothing to do with the OPs dead output pin problem, but this board design is deficient. The ENC28J60 data sheet explicitly states logic level shifters are required when interfacing this chip to a 5 volt microprocessor. The ENC28J60 data sheet even has two examples of level shifting. As ATMEL has been changing its manufacturing process over time, the ATmega1284P has a Vih minimum of (.6 Vcc) while the ATmega32 has a Vih minimum of (.7 Vcc). This .1 Vcc minimum threshold difference should make the ENC28J60 un-shifted level output pins SO and INT fail with the 5 volt Vcc ATmega1284P input pins. Of course these pins are already marginal on the 5 volt Vcc ATmega32 anyway.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
an let it light when PC0 is low? .......PORTC = 0xFF; \\set outputs high

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@js: This was only the last program i tried, with no load attached, just to see if the port is at 5V.
The question with the LED was befor the mcu stopped working.

@S-Sohn: No in my last program, nothing was connected to the board. I directly measured on the mcu.
I will try an other mcu to see if the old one is faulty

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I now tested the following program in the mcu and it works as it should. I tested it without a load.

#define F_CPU 1000000

#include 
#include 

int main(void) {
	
	DDRC = 0xFF;
	DDRB = 0xFF;
	PORTC = 0xFF;
	PORTB = 0xFF;

	while (1) {
		PORTB = 0x00;
		PORTC = 0x00;
		_delay_ms(1000);
		PORTB = 0xFF;
		PORTC = 0xFF;
		_delay_ms(1000);
	}

	return 0;
}

I measured on some pins of PORTB and PORTC and the're switching fine. Don't know what i did wrong before. Maybe the jumper J11 on the circuit of the NET-IO board. I jumpered to "prog", flashed the mcu, disconnected power, jupered to "normal", connected power and measured on the mcu.
Now i'm trying some LEDS.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

i finally had time to reactivate my Atmega32 and test some LEDs with the Atmega32 and the Atmega1282P.

Both MCUs now work as desired. Don't know what I did wrong.

Anyway, thx to all of you who helped ;)

Greets

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

S-Sohn wrote:

I have attached the schematic of the board. Maybe someone else sees any other issues.

Regards
Sebastian

There is a full page here in OP's native language

http://www.mikrocontroller.net/a...

And a giant thread here
http://www.mikrocontroller.net/t...

I have this board , and it's running fine with a M644
I run with just 1 diode (DC) , and the 7805 needs a heatsink. I replaced it with a MIC-2940-5 that i had a "kazillion of" , i often wonder why i did that , the 9v still have to be to 5v :-)

/Bingo

Last Edited: Mon. Jul 12, 2010 - 07:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...and there is even a (all german) forum here: http://son.ffdf-clan.de/

Lots of discussions, projects and alternative software packages...

BTW: I modified my board to run entierely with 3.3V
-> lower power consumption an no level translation problems.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR port pin--|<--a--\/\/\---Vcc
LED 330ohm

In the ASCII art above, if the LED were lighted (port pin at ground) then the voltage at point a would be about 1.5 volts. This is the normal voltage that is dropped across an LED when lighted.