How to use an n-channel mosfet to reset multiple ICs

Hello

I'm trying to build a board. It will integrate an ATMega328, an ESP8266 and an ATtiny85

I'd like to be able to do a reset over all three ICs using software to drive the reset line shared by the ICs

By now I'm having some success using a RFP30N06LE, mounted as in the image below

My question is regarding what is the ideal mosfet to do this ? and mounted how ? and or best practices

Will a 2N7002 do the job ?

With a RFP30N06LE (purchased at ebay), I have tried many values for R1 (from 100 ohms, to 300K ohms), resulting in no 100% predictable results, some times it reset all ICs, sometimes just ATMEGA328 and ATtiny85 but not ESP9266. Even tried without any R1. May be some of the mosfets are broken (defective) and then the different results ?

Please any help is appreciated, thanks

Why do you want a MOSFET especially with so high current as a RFP30N06LE? A simple regular transistor will do this job better.

At 5V, the 2N7002 is well suited for this. At 3.3V, borderline -- but it should still work [but I wouldn't trust it for a production design. I'd go with something like the FDV303N -- it's cheap and has a very low Gate Threshold voltage (0.65 to 1V) BUT, it only comes in an SOT23 package, so not hand-solder-friendly. But, if that's an issue, then the 2N7002 is probably just fine.

R1 can be some large value, like 1M, and only acts as a control element before PD3 is configured as a Output [the initial state for an Atmega328 port pin, is Tri-State, which means it will float, and thus the Gate voltage could wind up in a state between "ON" and "OFF", which usually is not desired]. But, because the input impedance of a MOSFET Gate is so high, it doesn't take much to pin it to ground.

Both the FDV303N, and the 2N7002, have a 100nA forward leakage [at TC = 25°C], so 1M*100nA = 0.1V, so no prob since, at 3.3VCC, the VIL threshold is around 1.4V. And, that goes up with higher VCCs. Though, that assumes a Tri-State Hi-Z greater than the impedance of the MOSFET input. I couldn't find a spec for what "Hi-Z" actually means, in the datasheet.

So, the selection of the Gate Pull Down resistor is a trade off between reducing load current on the power source, and making sure the gate doesn't float the MOSFET into it's "active region". If power conservation isn't an issue [for instance, the thing is not being powered by a battery], then use something like a 10k resistor. If, it's battery powered then go higher, like 300k to 1M.

The circuit looks ok (aside from possible MOSFET gate voltages). I think the problem is that the reset line is being held low for long enough. To check this out, have a look at the modified schematic I've attached (please excuse the terrible MS Paint job, it is the best I can manage right now). This circuit will let you activate the MOSFET via a pushbutton rather than driving it via a microcontroller. My hope is that when you press the buthbutton it will reliably reset all the microcontrollers. That will at least show what the problem is.

The problem with using software to drive the reset lines is that as soon as reset is asserted, all the I/O pins go high impedance; the line may rise again before it has been held low long enough to reset everything.

I would have one of the microcontrollers(probably the '328p) reset the others via an I/O pin, then reset itself with a WDT reset.

A pulse-stretcher might be another approach, using a monostable logic chip? You certainly need something
in hardware to guarantee the pulse width is long enough for all of the chips.

Thank you all very much !

All comments are valuable

I'll start by trying a FDV303N

Thanks !

MarkT:
A pulse-stretcher might be another approach,

Capacitor in parallel with R1? Target RC maybe 100-500 ms. Should be able to keep the lines low long enough.

Smaller cap * larger R1 is preferred, faster discharge through the Arduino's pin.

DrAzzy:
The problem with using software to drive the reset lines is that as soon as reset is asserted, all the I/O pins go high impedance; the line may rise again before it has been held low long enough to reset everything.

I would have one of the microcontrollers(probably the '328p) reset the others via an I/O pin, then reset itself with a WDT reset.

Good point! And, how about this. Have the 328P reset the others, and, if the 328P also needs a reset, then, for instance, the ATTiny85 can, following it's own reset, issue a Reset to the 328P. How is that possible, you ask?

Let me explain:

There are a set of flags that can be used to determine what caused a particular Reset. In the 328P these flags reside in the MCUSR register and are as follows:

  • PORF: Power-on Reset Flag
  • BORF: Brown-out Reset Flag
  • EXTRF: External Reset Flag
  • WDRF: Watchdog [Timer] Reset Flag

[I didn't look up the flags for the ATTiny or the ESP-12, so, don't know if such exists or how similar they are if they do, but I've never know an MCU to *not* have such flags]

So, assuming the ATTiny85 also has such flags, and for the sake of discussion, lets say they are the same [as they probably are], following the External Reset induced by the 328P, the ATTiny85, checks it's EXTRF flag, and if set, has a pretty good hankering it came from the 328P, so it clears it, and then issues an External Reset to the 328P, which also, following the Reset, checks it's EXTRF flag, and if set, is by-gosh sure the ATTiny85 was the instigator, so it goes on with whatever business should follow an external reset.

And, at anytime, the code in either MCUs, can also use the PORF flag to double check, and know it just Powered Up. In fact, probably a good idea to, during the initialization phase [called "Setup" in an Arduino Script"], check the PORF flag, and clear it if it's set. That way, you avoid possible ambiguity, down the road.

And, BTW: This solves the Reset timing issue, as the 328P can, programmatically, hold the Reset line low for however long it needs holding, for the Reset to properly register.

Note: Be sure, if you decide to implement this crazy scheme, to rewire that Reset line [the one that currently goes to ALL the Reset inputs].

Note 2: Of course, this is not the correct solution if all three of these MCUs need an exactly simultaneous Reset.

Hello & thank you all

Just to say that I tried with the FDV303N and it perform great

Thanks !