Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Why I measure voltage on unused GPIO pins ?

Status
Not open for further replies.

unalCe

Newbie level 3
Newbie level 3
Joined
Oct 31, 2018
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
27
Hey all!
I'm trying to improve myself on a STM32F407 Discoveryboard and I noticed something strange (for a newbie like me). I was simply blinking a LED on Port A pin 3. But I noticed some of other pins had some voltage on them too. Though I didn't configure them, by default they're configured as inputs.

While debugging I put a breakpoint after I set the pin 3 and checked GPIOA_IDR(Input Data Register) was 0x0000 86C8 and GPIOA_ODR(Output Data Register) was 0x0000 0008 as expected because I turned on the pin 3.

Pull-up/Pull-down register for GPIOA is 0x6400 0000 by default. Which means there should be no pull-up/pull-down on pin 9 for example.

The question is why I measured 4,68V(which is equal to 5v output on my mcu) on PA9,PA14,PA13 etc. Are they being used for something else in the background? Because I know these ports are not only used for GPIO. And if not is there something wrong with my mcu?

Code:
GPIO_InitTypeDef GPIO_InitStruct;
	
 /* GPIO Ports Clock Enable */
 __GPIOA_CLK_ENABLE();

/* GPIO Configuration */

GPIO_InitStruct.Pin = GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
// GPIO_InitStruct.Pull = GPIO_PULLUP; 		// Not necessary for outputs
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Hope this is not a waste of time for you.
Thanks in advance.

Unal
 

Hi,


Though I didn't configure them, by default they're configured as inputs.
configured as "input" means they are floating.

General rule for analog as well as digital circuits:
Don´t leave any (unused) input floating.
(This has been discussed many times here in this forum as well as in the internet)

In your case I recommend to:
* use internal pullup or pulldown feature. (with this you can´t short circuit anything even if you externally connect VCC or GND)

* Other users recommend to switch them to "output LOW"

*******
Floating means "undefined" this is what you see. You see "a voltage" but you can´t predict what voltage it will be.
Floating inputs may oscillate, they may be more prone to ESD faults, they usually increase power supply current due to internal crowbar currents. (all this is explained many times, just do a search for more detailed informations)


Klaus
 
  • Like
Reactions: unalCe

    unalCe

    Points: 2
    Helpful Answer Positive Rating
Thanks Klaus.

How did you measure?

I measured it with my multimeter while my positive prob was on the PA9 pin and negative probe on the mcu's ground pin.
 

Measuring 4.68V with multimeter means the pins are not floating. I see that according to the schematic some of the pins have secondary function, e.g. PA13 and P14 is used for SW debug interface.
 
  • Like
Reactions: unalCe

    unalCe

    Points: 2
    Helpful Answer Positive Rating
Hi,

I´m not sure about this.
A high input resistance voltmeter and a lot of flux residuals ...

But I agree it´s more likely that an internal pullup and the input resistance of the multimeter causes such voltage.
Like: 200k pullup and a 3MOhm multimeter input..

Klaus
 
  • Like
Reactions: unalCe

    unalCe

    Points: 2
    Helpful Answer Positive Rating
I see that according to the schematic some of the pins have secondary function, e.g. PA13 and P14 is used for SW debug interface.

Yeah that was the other side of my question. Thanks!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top