cancel
Showing results for 
Search instead for 
Did you mean: 

High values on unconnected GPIO pins

Ivan Ivan
Associate II
Posted on August 16, 2017 at 12:31

Hello. I'm developing an application based on Discovery board with stm32f429I.

And now I have quite a weird issue:a high signal level is shown on unconnected input pins.

Here is a code:

//Configure PC4 = input
#define GPM_IN((uint32_t) 0x00000000) /*GPIO_Mode_IN*/
#define GPb048
#define GP_HiSpd((uint32_t) 0x00000003)/*GPIO_High_Speed*/
GPIOC->MODER=(GPM_IN<<GPb04);
GPIOC->PUPDR=( (GPIO_PUPDR_PUPDR4_1) );
//((GPIO_OTYPER_OT_4));
GPIOC->OTYPER=0;
GPIOC->OSPEEDR=(GP_HiSpd<<GPb04);�?�?�?�?�?�?�?�?�?�?

I have tried different parameters of pullup and pulldown resistors, referring the following:

http://www.electronics-tutorials.ws/logic/pull-up-resistor.html

https://electronics.stackexchange.com/a/50641

but the issue persists, IDR4 bit shows '1' in debugger, while I'm expecting it to be 0. Strangely, but a similar configuration works OK for other ports. I have checked in debugger, nothing rewrites PC4 configuration, MODER4 is 0 as it should be. I suppose that for GPIO input I should enable pulldown resistor because it linksinput to Ground, which is believed to be as source of zero and use push-pull mode, because StackOverflow answer states that opendrain mode is used with pullup resistor...

How to correctly configure GPIO for input?

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on August 16, 2017 at 13:02

The resistors on the board does not know what are you using in your project, they are always there.

JW

View solution in original post

3 REPLIES 3
Posted on August 16, 2017 at 12:45

0690X00000607tqQAA.png0690X00000607u5QAA.png

JW

Posted on August 16, 2017 at 12:53

Well, I'm not using USB OTG FS in project, and PC4 is not configured with alt function, only as a generic input.

Posted on August 16, 2017 at 13:02

The resistors on the board does not know what are you using in your project, they are always there.

JW