U1 is a microcontroller driving M1 to drive a load. I am running into some bizarre behavior and I'll try to include all the relevant information. Hope it's not too much.
- M1 is a logic-level FET.
- U1 is running off a 3.3V supply derived from the 3.7V battery in the system. There are no other power sources connected, like benchtop power supplies. All share a common ground.
- Although I have drawn the load as a resistor, that was more of I didn't see another option in CircuitLab for generic black-box load. I literally am driving a black box load as well, one of those high-voltage generators you can buy on eBay like this one. My understanding is that the first stage input inside their cavernous epoxied insides is some sort of blocking oscillator, and so it's entirely possible this load is not purely resistive. Just keep it in mind, but so far I don't think it's inductive as I haven't had any reliability issues with like back-EMF destroying the FET as if there was a solenoid inside the box.
- The load draws high current, about 2A.
Here's what's happening:
- I am doing this on a breadboard. If I hook VGATE directly to the 3.3V supply to U1 (what the GPIO is pulling to), it works fine.
- When I toggle a pushbutton that drives an ISR to pull the gate high, it does so very briefly and then the IC resets (I have the code blink a different LED at startup so I know it's reset). This made me suspect voltage droop on the supply lines due to the sudden surge from the battery.
- To fix the suspected supply droop, next I added a ton of decoupling capacitors on both the input side of the LDO linear regulator and the output side. This did seem to help a bit but still would only drive the load for less than a second then reset.
- I added an LED to the output and surprisingly this seemed to help. Perhaps it loads down the GPIO a little bit more, reducing voltage slew rate on VGS and thus reducing supply droop?
Now here's where things get weird:
- If I connect a Logic Analyzer probe to VGATE (I wanted to see what the waves looked like), it completely works! Damn you, Werner Heisenberg.
I have done a few experiments and it doesn't matter if both the signal probe and the ground are connected or just one (either, doesn't seem to matter). Yes, a single wire with no return path for current is somehow affecting this. Could this be some weird antenna thing going on, or noise coupling onto the wire which might be doing something? I will say that since I am breadboarding, my wires are getting a bit long, nothing longer than 6" though.
It also doesn't matter if the logic analyzer is plugged into my computer or not (USB logic analyzer, Saleae Logic Pro, if it matters). I was thinking at first maybe there was some different ground potentials going on, though I'd expect the ground in the analyzer to be isolated from my PC USB port. Either way, with a single wire connected I don't see how current can be flowing in or out of that wire anyway and thus doing anything.
Anyway, I'm banging my head against the wall trying to figure this out and figured sometimes it's not good to work in a vacuum. Thanks to anyone who can help me out.
EDIT: Testing the idea again that CGD coupling might be turning off the FET, I tried to make the cap to ground there larger with a cap on VGATE to ground. Though this didn't work, I notice that if I just touch the top of the cap (it is electrolytic), the circuit works again no problem.
So, touching my body to the top of the cap fixes the issue. Putting a wire from a logic analyzer on that net (either GND or VGATE) fixes the issue. And putting an LED load on the GPIO pin also helps (but doesn't completely fix it).
What theory could possibly explain all three and why they fix it?
EDIT2: Getting somewhere... taking Spehro's suggestion that the di/dt from switching such a large load could inductively coupling, I put a large RC filter on VGATE so that would limit the di/dt switching. What I find is that, all else unchanged, the LED on the GPIO slowly dims brighter until the FET is fully on, and when the HVGEN sparks, the micro resets. If you record video of the circuit on a phone, the picture is noisy due to the large EMI.
I basically think the EMI from the sparks is resetting the microcontroller independent of di/dt spikes or other events like this. For some reason when I touch the capacitor on VGATE, the problem goes away. Is it possible I'm a large body that "absorbs" the EMI somehow and thus the micro does not reset?
If so, how can I fix this permanently, short of touching the circuit at all times? ;) Is there some way without enclosing the entire PCB in a Faraday cage?