The GPIO is one of the most frequently encountered acronyms in the embedded domain. It stands for General Purpose Input/Output and exactly does the same thing i.e either it is used to take input or to give output. These are hardware lines which are general purpose in the sense that they are not specifically used for only one functionality by any peripheral. For example, if any MCU contains 8 Gpio’s then one at any given instance one Gpio may be used in taking input from a button, other may be used to give output to an LED and the next one may be used to communicate with other MCU.So by using these Gpio’s an MCU can give/take instructions/inputs from other electronic components such as LED’s, buttons, sensors etc.
In a nutshell, the Gpio’s are the mediators through which the internal peripherals such as the different communication protocols, Timers, analog to digital converters can perform there functionalities. In the case of an ADC(Analog to digital converter), It requires analog data to be given as input and converts it into digital(binaries). So the Gpio’s are used to take the analog data as input. This functionality of a Gpio is known as Alternate Functionality as the Gpio is taking the input for another peripheral.
GPIO pins have no predefined purpose and the user has to define the purpose of a particular Gpio. A GPIO port is a group of GPIO pins arranged in a group and controlled as a group. The Gpio’s often have the pull-up and pull-down functionality. The pull-up means connecting a Gpio pin to +Vcc through a resistor and The pull-down means connecting a Gpio pin to Ground through a resistor. These resistors are called Pull up/down resistors. This is an important concept as there are many scenarios in which the user wants to take input from a button.so when the button is pressed the Gpio is connected to Ground and the user can turn on an led as soon as the Gpio’s input becomes low But there lies a problem in such a design as if the Button is not pressed the Gpio is neither connected to Ground nor to +Vcc. This state is known as Floating state as the Gpio now takes the surrounding noise as input and may take a logic 0 reading even when the button is not pressed. So as to counter this scenario, If the pull-up resistor is used then until the button is not pressed the Gpio will stay connected to +Vcc and as soon as the button is pressed it gets connected to ground and hence provides a clean State change.
The Gpio’s will be used in most of the upcoming blogs and if still, their use is not clear to the readers then it will be understood in the near future.


Comments
Post a Comment