cancel
Showing results for 
Search instead for 
Did you mean: 

Pin value of a GPIO pin set as high impedance

sommer
Associate II
Posted on October 28, 2015 at 08:49

I am using an STM32F4 discovery board and my intention is to set one of its GPIO pins at high impedance, which I have done as below:

GPIO_InitStruct.Pin = GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; 

From my understanding, in order to configure a pin at high impedance, it's mode is to be input. Am I right?

If I read the status of this pin, I get a value of 1. I am not sure if the pins at high impedance should return a 1 or 0. Could someone please help me understanding this.

#!stm32f4-disco
3 REPLIES 3
Danish1
Lead II
Posted on October 28, 2015 at 12:08

High impedance means that the stm32 microcontroller won't be trying to drive the pin either high or low.

What you read on the pin will be whatever the logic value is (1 or 0) for whatever voltage happens to be on the pin.

If you have an external circuit driving the pin then, of course, that circuit sets the voltage on the pin.

If you _don't_ have any external components attached to the pin, then the voltage on the pin can be anything (within the range Vss - 1 diode drop to Vdd + 1 diode drop), so it might read back as 0 or 1.

If you put a voltmeter between the pin and Vss, then most likely the voltmeter will pull the pin down to 0 through its own input structure which often looks like a 10 Meg resistor. So while the voltmeter is attached you should read logic 0.

When you remove the voltmeter, the voltage on the pin might stay around 0 but it might slowly drift up through tiny leakage currents caused by the fact that your board is ever-so-slightly dirty. So after a time (which might be seconds or hours) you might again read 1.

Hope this helps,

Danish

John F.
Senior
Posted on October 28, 2015 at 14:48

Configure the input as Analog for minimum load.

Analog configuration

When the I/O port is programmed as analog configuration:

• The output buffer is disabled

• The Schmitt trigger input is deactivated, providing zero consumption for every analog

value of the I/O pin. The output of the Schmitt trigger is forced to a constant value (0).

• The weak pull-up and pull-down resistors are disabled

• Read access to the input data register gets the value “0�?

Note: In the analog configuration, the I/O pins cannot be 5 Volt tolerant.

sommer
Associate II
Posted on October 29, 2015 at 08:52

Hi Danish,

Thanks for the reply. Assuming that the pin with high impedance would be connected to an external component, is the configuration that I used sufficient to set the pin in high impedance?