2017-08-16 03:31 AM
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?
Solved! Go to Solution.
2017-08-16 06:02 AM
The resistors on the board does not know what are you using in your project, they are always there.
JW
2017-08-16 03:45 AM
JW
2017-08-16 05:53 AM
Well, I'm not using USB OTG FS in project, and PC4 is not configured with alt function, only as a generic input.
2017-08-16 06:02 AM
The resistors on the board does not know what are you using in your project, they are always there.
JW