2015-10-28 12:49 AM
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-disco2015-10-28 04:08 AM
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,Danish2015-10-28 06:48 AM
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.2015-10-29 12:52 AM