Introduction
I am Satwik M Kotian, an Electrical and Electronics Engineering student interested in embedded systems and firmware development. In this blog, I will explain one of the most fundamental concepts in embedded systems — GPIO.
GPIO (General Purpose Input Output) is the basic way a microcontroller interacts with the external world.
What is GPIO?
GPIO pins are configurable pins on a microcontroller that can act as either:
- Input → to read signals (button, sensor)
- Output → to control devices (LED, buzzer, relay)
In STM32, each pin can be configured using registers or tools like STM32CubeIDE.
GPIO Modes in STM32
1. Input Mode
Used to read signals from external components.
Example:
- Push button
- Sensor output
2. Output Mode
Used to send signals to control devices.
Example:
- Turning ON/OFF an LED
- Controlling a motor
Pull-Up and Pull-Down Resistors
GPIO input pins can be unstable if left floating. To solve this:
- Pull-up → Default HIGH
- Pull-down → Default LOW
This ensures reliable input readings.
Practical Example: Button Controlled LED
In one of my STM32 projects, I implemented a simple system where:
- Button pressed → LED ON
- Button released → LED OFF
This involves:
- Reading GPIO input
- Controlling GPIO output
This simple project helps in understanding real-time hardware interaction.
Key Learning Points
- GPIO is the foundation of all embedded systems
- It is used in almost every project
- Understanding GPIO helps in learning advanced peripherals like UART, SPI, and I2C
Conclusion
GPIO is one of the first and most important concepts in embedded systems. Mastering GPIO helps in building a strong foundation for more complex topics like communication protocols and real-time systems.






