3
\$\begingroup\$

I have a 3.3 V microcontroller pin (not 5 V tolerant) with an external 10 kΩ pull-up resistor. By mistake, the external pull-up resistor was connected to 5 V. As I understand it, the only thing that protects the pin from burning is its protection diode.

If the pin is declared as input, the current path will be 5 V -> pull-up resistor -> pin -> protection diode -> 3.3 V and on the MCU pin there will be 3.3 V + Vdiode.

What is the current path when the pin is declared as a push-pull output and the output level is set to high? What is the voltage level on the microcontroller pin? What is the voltage level when the pin is set to low?

enter image description here

Microcontroller is STM32F103C6T6, and pin is PB5

\$\endgroup\$
1
  • 4
    \$\begingroup\$ You have copypasted a diagram from some STM32 datasheet. As each MCU model is different and has different limitations, you should mention which exact MCU model it is and which IO pins are pulled up via 10k to 5V. The datasheet lists not only a cumulative total but pin specific limits for injected (clamped) current. \$\endgroup\$
    – Justme
    Commented Oct 10, 2022 at 14:04

3 Answers 3

5
\$\begingroup\$

If you pulled up with 10k, nothing really bad happens as the current will be limited by the resistor.

Specifically, with the pin at its high-Z state:

  • I/O pin will bias to about 3.3V + 1 Schottky protection diode drop (0.3V), so about 3.6V.
  • Current will be about (5V-3.6V)/10k, so about 140uA.

If pin is driven output-high, the high-side p-FET will conduct taking the 10k pullup close to Vdd (3.3V).

The I/O voltage is therefore limited to within Absolute Maximum ratings, so the part will not suffer damage. Nonetheless, it's something you should fix.

This ST document spells out some of this detail. For most 3.3V I/O, the max voltage is Vdd+0.3V (which implies a Schottky protection diode.) See section 5.1.2, and also note that 'TT' and 'FT' pins tolerate no injected current at all to Vdd. So, this contradicts my own experience with typical 3.3V pads that allow for at least some conduction of the upper diode before Bad Things Happen. Anyway, that's what they said.

If your signal needs to be a 5V open collector style, you can employ a level shifter using a number of techniques. If it's an output, a FET like a BSS138 is ideal.

A thing you need to watch out for is power supply sequence. If 5V comes on before 3.3V then the part can be 'phantom powered' via the I/O pin, leading to unexpected power on / power off behavior.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ The protection diodes shown in the OP's diagram don't look like Schottky diodes. Do you have some other reference that indicates that they are Schottky rather than silicon PN? \$\endgroup\$ Commented Oct 10, 2022 at 18:44
  • \$\begingroup\$ If the pin is output high, then the current would pass through the high-side FET. If the pin is high-Z then the current would pass through the protection diode. \$\endgroup\$
    – user319836
    Commented Oct 10, 2022 at 19:55
  • \$\begingroup\$ The specific type of diode doesn't matter. The point is that the maximum allowable voltage is VCC+0.3. If the OP goes over that then we don't really know what will happen (at production scale). Also, even if the voltage doesn't go over that, there might be an injected current limit, and that can't be violated either. \$\endgroup\$
    – user57037
    Commented Oct 10, 2022 at 21:13
  • 1
    \$\begingroup\$ I don't have special expertise in this area. But the voltage by itself is not enough to convince me. So I will tentatively believe you but kind of sort of have in the back of my mind that it is not 100% verified. Hope that does not offend. \$\endgroup\$
    – user57037
    Commented Oct 11, 2022 at 0:32
  • 1
    \$\begingroup\$ The difference between injecting current and sinking / sourcing current is in the direction and the path that the current takes. In sinking/ sourcing it’s through the driver pair to Vss/Vdd. Injecting current is through the protection diodes, in the opposite direction of normal sink/source. This current is injected into the substrate and can cause latch-up. \$\endgroup\$ Commented Oct 11, 2022 at 16:37
7
\$\begingroup\$

The voltage on the pin will simply be (very close to) 3.3 V or 0 V (depending on whether it is set low or high). The remaining voltage is simply dropped across the pull up resistor, and the current path is from 5 V, through the resistor, through one of the MOSFETs to either \$V_{DD}\$ or \$V_{SS}\$ depending on the pin state.

\$\endgroup\$
3
\$\begingroup\$

When the pin is driving low, all is well. At any other time, the internal protection diode will likely be forward biased with current flowing into the GPIO pin by way of the 10 k pullup. Whether this will cause damage is hard to say. The datasheet may list allowable current in this condition. Or it may not.

You can probably fix this satisfactorily by putting an external 20 k pulldown on the IO pin or putting Schottky diode from the GPIO to the 3.3 V rail powering the processor. These should be adequate fixes for the problem.

Another solution which is more of a half-way solution would be to increase the value of the pullup resistor to 100 k or even more. This may limit the current to a value that does not cause damage to the GPIO.

From a practical perspective, I doubt that the GPIOs will instantly go bad on every board. Most likely, if you have 5 or 10 boards used around the lab, they will all continue to work for a long time. But I would not let this design get out into the wild as-is unless you can verify definitively that the GPIO will tolerate it.

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.