2025-11-23 8:23 AM
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. 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.
Given this, I inserted my board into the breadboard, and the problem got fixed.
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 place the board in a breadboard and connect GND.
Best,
Alessandro
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.