I'm using the SM32F207Z MCU for input/outputs digital processing. The MCU will also handle Ethernet communications. I/O port functions will be provided by 16 + 16 digital input/outputs.
Our application will read logic levels from GPIO pins configured as inputs, but it is also able to write to a GPIO pin port configured as an output.
Our application consists of a '0' level input detection on 16 input pins. Every pin has a 10K pull-up to 3.3 V to give a default read level of logic high. I have also added a current limiter resistor in case a pin is programmed as an output by mistake.
The application will also use GPIO outputs to control external loads, such as LEDs, relays etc. Obviously, NMOS transistors will be needed for this output proposal and this part is our choice.
From the outside, our card interface could be seen as a '0' detector and '0' writable card, a kind of 'NPN inputs, NPN outputs concept'. We can read '0' from one pin and we can also put '0' in other one in order to close external input/output circuitry. Briefly: the card reads GND and it also gives GND to some user-attached circuits.
Having said this, users must give a 'GND' or 'hi-Z' to the input pins through their external circuits. The user's input circuits should not drive voltages into here, but this could happen by user error.
I want to design the input circuit to withstand an accidental 12 V or 24 V into an input that expects 3.3 V or 5 V.
It doesn't seem to occur much but we don't want the card to be damaged by it when it happens, if it is possible.
As I have read in a datasheet, I/O pins can allow less than 3.3 V or 5 V but it depends on the kind of pin.
The same is happening at the outputs. The external circuit is connecting its GND reference node there. Their circuit node (their GND node) could be driven by our card with a steady logic high, a steady logic low or be switched at a frequency. But sometimes, users could accidentally connect a voltage to our card output instead of the correct load node (GND node). I know nMOS maximum VDS value can be up to 30V, so I don't panic about damage to the card if a user puts 12V..24V by mistake onto an output pin.
I think the risk of card circuitry damage is at the input pins.
The first thought that comes to my head is using the Zener and TVS diodes. But Zener is designed for steady states and TVS seems to deal with transients. I also consider the worst case situation, where users could continue, not realising they've made a bad connection. I don't know how TVS handles a continuous overload condition. On the other hand I have read that a Zener diode could give problems with the input read level due its leakage current.
I would also use double Schottky diodes to protect my ADC inputs from overvoltage because they are better than a Zener for this, but that's not the same situation. I have seen discussion about this topic. But I think that my case has two factor that makes this one different.
- The most cases deal with transient situation. My case is close to be a steady voltage situation (1, 2,.., even 5 minutes).
- I don't see any diodes solution with pull up resistor at the input. I think that way could be adding an undesirable current path from 24V node to 3.3V.
I made simulations for the above circuit, taking GPIO internal impedance as resistor value from 100K to 1M (I don't find it on datasheet). Some simulators shown the zener limitation with this solution. The main one is the current that it can drive, such as 5mA. My configuration is driveng about 5mA. If I push up the resistor value I can decrease the zener current, but GPIO Low state goes up, near logic level bordier. Making some resistors exchange I find that my GPIO low level logic state is compromised by the current I need to decrease.
I would like to know how to give a protection against putting voltages greater than 3.3V/5V at MCU input pins. Out of fuses, TVS diodes, Zener diodes up to 24 V, which one is better?
How should I correctly connect the diodes to my input circuit to work, specially with the pull-up resistor and serial resistor?
How should I choose the correct parameters for the diode?
Thanks to the post cooperators I have achieved two kind of solutions. My prefered and most popular one was a zener based protection. But theorically I can adjust values for keeping the 3 voltage values that application needs to be read correctly. I think it is because of low current that zener allows. It is forcing a higher resistor values than voltage divisor needs to get 3.3V.
Then I went to Schottky solution that someone from here suggest me. It would work theorically fine. The last step is to test with real devices. But bring the real circuit results will take some time. So I will put my proposal at the end of the question.
Interactive link here: for life simulations clik here