I'm using a 3.3V atmega2560 to disable a switching regulator that's operating on a ~12V battery. The EN pin on the switcher is pulled up to the battery voltage, and needs to be driven to ground to disable it. Clearly this is outside what the uC can do. My (very rudimentary) understanding is that I can achieve this with an N-MOSFET, by tying it to the enable pin like this:
Will this work? It looks a bit like I'm creating a short (V_BATT -> R1 -> Q1 -> GND), but I assume that's not an issue given the size of R1.
EDIT
I've got two such regulators: http://www.ti.com/lit/ds/symlink/lm2734.pdf http://www.ti.com/lit/ds/symlink/tps62125.pdf
One thing I'm not sure of is whether as asked in the comments, the EN voltage has to be tied to VIN, or if it just needs to be above some absolute value. There's discussion in the datasheets about EN thresholds, but they make no mention of whether these are thresholds relative to VIN or absolute values:
That said, TPS62125 does need to be tied to VIN to avoid a catch 22 - it powers the MCU, and a supercap that the MCU uses for power when it puts the system, and the regulator to sleep. So - until that supercap is charged for the first time, there is nothing to activate the regulator except the battery.