I have an application involving an ATmega328 which may be powered while the ATmega is not.
The circuit is an led driver (operating at 24V) which can be controlled either by potentiometers or digitally with the ATmega. In the latter case, the circuit will be connected to a controller board, providing the ATmega with 3.3V. In the first case, though, only the driver and the potentiometers are powered from a 24V PSU and as the pots and the ATmega control the same pin on an IC, the ATmega will see up to 3.3V on some GPIOs while not being powered.
Each pot has additional 680 kΩ in series and the current will therefore be limited to ~30 µA, which should be fine (according to this document). I'm not concerned about the current through the clamping diodes, because I'm bypassing those with Schottky diodes anyway, but I'm clueless about how the ATmega will behave in such a situation. My guess is, that it will boot as soon as there's sufficiently high voltage on the rail (how should it know about a current limitation of the supply).
I'm thinking of a software solution, something like "wait until capacitor is charged above threshold", but that would still require the MCU to show predictable behaviour.
Another idea is to pull down the 3.3V, maybe with a MOSFET, so I don't waste power in the "digital version" operation.
At the moment it is hard for me to decide on a solution because I have not much experience with it and I also couldn't find much information about it either.
So my questions are mainly:
Is there a way to keep the ATmega in a reset state by hardware (from my undestanding, the RESET pin requires a pulse to trigger a reset)?
Is there a chance, that the firmware or data in EEPROM/RAM gets corrupted or that the MCU shows unpredictable/erratic behaviour when the µC is power cycled continuously?
Do microcontrollers include "features" that avoid problems in such a scenario (brownout detector)?