Hi everyone again.
Here I am with a little problem.
I'm using a tiny26 for a battery charger.
It's powered on 5V though a HT7550 reg., brown out enabled and watchdog running.
It has a LED which is connected directly to a port's pin (no current limiting resistor). I turn it on a few msecs every second, to show battery status.
Everything works fine, except that when it's being powered by the battery and voltage isn't high enough. It seems to be that when the LED is turned on, it draws so much current that VCC goes down to 4.1V. It stays there forever until I remove power or increase battery voltage.
No WDT reset, No brownout, since brownout level is set to 4.0V.
I know, maybe I shouldn't connect the LED directly to the AVR, but is there any way to reset the uP when this happens (even thou it will hang again presumably).
I don't want to add a current-limiting resistor because it would make the LED less shiny.
I thought adding a HT7044A and connect its output to the AVR reset pin through a 10K resistor to VCC. That way it would act as a brown out detector when VCC goes below 4.4V.
Oh just, by the way, to reduce power consumption I'm using the WDT as a timer, since all I have to do is check some analog data and show status on a led.. then wait 500ms and do it again. So now all I do is that and then go into powerdown mode, to get woken up by the WDT.
I don't think current could be reduced by using the other sleep modes, not mentioning that the only one I can use is the IDLE one, since the rest of them wouldn't let me wake up from a timer overflow or capture interrupt.
maybe external components, but that would increase price also.
thanks to all again,
---edit start ---
btw, when it hangs, the LED stays on, just as if it hanged a few instructions after executing the sbi one. Clearly the AVR's clock got halted when VCC got down when turning the LED on.
--- edit end ---
Carlos