Special Shutdown Procedure when Sinking current

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

Using a mega48 with two voltage sources.
Problem when the mega48 power goes down
second voltage supply still on led's

Portb 0..7
PortC 1..5
PortD 0..2

Toggling data direction bits form input to output using an interrupt and software PWM, maximum of 2 pins sinking current at one time.

I am driving 16 LED's fading one up and the one next to it down in a circle that makes a nice simulated rotating light.

When I disconnect the power from just the chip (it disconnects all three pins VCC, AVCC, AREF) The LED's are still connected to another power source. I get random pins that are toggling and the LED's flicker.

Is there a way to make sure the pins will not sink current when the chip is not powered?

or, do I just use a fet and an extra pin to turn the power to the led's on when the mega48 has power?

Link to flash streaming movie clip:

http://www.metron9.com/movie/lht...

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

Is there a reason for the 2 supplies ? If the supply to the leds is more robust then use it .

Pete
P.S. Prophead in training

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

You are powering the controller through the port pins. Stop doing that. Why two supplies?

Go electric!
Happy electric car owner / builder

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

Use a regulator from the higher supply to power the micro. That way, it is one supply.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

It was really an accident that I came up with this question. I was experimenting with the project and I decided to measure the current the device was drawing. because I am using a breadboard, I set it up so I can pull the power wire to the processor so I can remove it , program it and put it back in place. When I removed the power from the uc to put the current meter in series I noticed the flickering. ( I simply did not think about the power on the other pins as I usually source current from the pins.

That got me to thinking, what if the power to the uc goes down, what state are the pins in and is it a potential problem to use pins to sink current instead of source current in a case where there are two power supplies. (thus I stated the question with two power supplies). The question is still valid I think with one power supply. During startup the state of the pins are unknown and power at those pins using one power supply can be on before the uc has powered up. Add the time it takes for a regulator to power up, especially if it is a boost converter and you can see perhaps how my brain is mulling the ramifications over. Typically it is not something one would think about but I tend to think things happen for a reason and when they do I typically have a list of questions I ask myself and sometimes post the somewhat ill formed thought process on this board.

I am actually going to use just one supply (and I will rewire the breadboard to pull the power to both Led's and the uc orf course)

One other note, I have connected all 16 led's in parallel with one resistor. Now before you reach for that keyboard to tell me why this should not be done, let me explain the logic.

Using an interrupt to increment a register on each interrupt, a second register is incrementing in the main program, when a match is made the code in the interrupt turns on one led and turns off the other led. When the pwm register matches zero it simply does the opposit turning off one and turning on the other. This allows 2 leds to seem to be on at one time but only one is on at any time.

So, I think to be safe , a small fet connected to the uc will turn on the power to the LED's , that way I know the uc is running and the pins are set to input hi z before the power hits them.

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

On power up, pins are hi-Z inputs. This happens very early in the reset cycle. I have yet to see any real problems with behavior between the time that power comes up and the processor begins operating. When the power comes up, so do all of the Vcc and AVcc pins so that powers internal I/O logic. There should be no "SCR latching" and I have never seen any.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!