GPIO concepts

Notes on GPIO concepts

Introduction

  • MCUs have PORTS and PINS , PORTS are a collection of PINS and each PIN has a functionality thats assigned by the manufacturer

  • GPIO is used as switch , interrupts , in SPI as CS etc

  • GPIO - General Purpose Input Output has the below structure

Input Confiiguration:

  • PIN of an MCU can be configured as Input with pullup or pulldown resistors

  • Why pullup or pulldown ? Because if a PIN doesnt have a internal pullup or extenal pullup/down activated then it will be in floating state when nothing is connected and this will lead to wrong input read values

  • floating state can also cause leakage current (the mosfets will turn on partially and the current will leak)

Output Configuration:

  • Output PIN can be in open drain (pulled low when 0 but floating when 1) so it requires an external pullup resistor (use this when the current to be sourced needs to be higher than what mosfet / PIN can source)

  • Output PIN can be in Push pull configuration and this doesnt require a pullup resistor

Last updated