2025-11-23 8:23 AM - edited 2025-11-23 2:07 PM
You may encounter an issue when developing for the STM32 microcontroller using STM32 development boards where a pin that is configured for reading on a General Purpose Input/Output (GPIO) reports a high state even when it is not physically connected to any circuit. Pins are not expected to output neither high or low when left floating. This can lead to significant difficulties when developing for the target. In my specific use case, this behavior resulted in an LED flashing when the jumper was not bridged, leading to confusion and misinterpretation of the system's status.
It took me more than a week to understand what was happening because debugging step by step using the STMCubeIDE always resulted in the expected functionality.
I believe such an issue can arise due to floating inputs and/or electrical noise, mainly if the board is sitting on an isolator.
To fix this please make sure to implement pull-up or pull-down resistors in your design to ensure that the GPIO pin has a defined state when it is not actively driven by an external signal, or, if you are using a development board (in my case the NUCLEO-F411RE), make sure to connect to common GND.
Best,
Alessandro
Solved! Go to Solution.
2025-11-23 8:49 AM - edited 2025-11-23 8:50 AM
> Given this, I inserted my board into the breadboard, and the problem got fixed.
Putting your board into a breadboard which connects adjacent pins is absolutely NOT a good solution or advice which should be given out.
> General Purpose Input/Output (GPIO) reports a high state even when it is not physically connected to any circuit
A pin which is floating should not be expected to return low, or high, or any state. Use a pulldown or pullup to set a state when the pin is not otherwise connected. The internal pullups can be helpful here.
2025-11-23 8:49 AM - edited 2025-11-23 8:50 AM
> Given this, I inserted my board into the breadboard, and the problem got fixed.
Putting your board into a breadboard which connects adjacent pins is absolutely NOT a good solution or advice which should be given out.
> General Purpose Input/Output (GPIO) reports a high state even when it is not physically connected to any circuit
A pin which is floating should not be expected to return low, or high, or any state. Use a pulldown or pullup to set a state when the pin is not otherwise connected. The internal pullups can be helpful here.
2025-11-23 2:04 PM
@TDK thanks for the follow up.
I see where you're going with the breadboard. Since i was not using the side pins, this went unchecked. I'll reframe the original with your advice.
Best,
Alessandro
2025-11-24 2:31 AM
@anardinelli wrote:You may encounter an issue when developing for the STM32 microcontroller using STM32 development boards
This has nothing specifically to do with STM32 or ST boards - the same would apply to any digital input.