GPIO is an acronym for general purpose input/output. The term is typically applied to a pin on a microcontroller (or other device) that may be changed between an input and output under software control. It can be used for an application defined purpose, as opposed to being constrained to a single designated function.
Questions tagged [gpio]
837 questions
77
votes
3 answers
Push-pull/open drain; pull-up/pull-down
I am reading the datasheet of an ARM Cortex chip, specifically the GPIO chapter. Ultimately, I want to configure various GPIO pins to use them in "Alternate Function" mode for read/write access to SRAM.
Of all the GPIO registers available, I do not…

Randomblue
- 10,953
- 29
- 105
- 178
50
votes
2 answers
STM32 Understanding GPIO Settings
In STM32 Standard Peripheral library, we need to configure the GPIO.
But there are 3 functions which I not sure how to configure them;
GPIO_InitStructure.GPIO_Speed
GPIO_InitStructure.GPIO_OType
GPIO_InitStructure.GPIO_PuPd
In the GPIO_Speed,…

Tim
- 899
- 2
- 12
- 18
21
votes
2 answers
What's an alternate pin function on a microcontroller?
I'd like to know what "Alternative Function" refers to in the context of the IO ports of a microcontroller.
I don't need to know how to activate it when connecting to a peripherial, but I'd like to know what it exactly is and why we'd need it.

user929404
- 401
- 2
- 5
- 9
19
votes
5 answers
Pull-up and Pull-down Resistor Usage on Input or Output MCU Pins
Are pull-up/down resistors (whether internal or external) only needed for MCU INPUT pins? In contrast, an MCU pin configured as an OUTPUT "knows what level it's at" because it does the driving - a "floating" MCU OUTPUT pin tied to some input of…

The_Ders
- 379
- 1
- 4
- 9
19
votes
1 answer
Getting a large number of (~100) digital output signals from Arduino
I would like to be able to control around 100 independent LEDs using an Arduino. The problem is that the Arduino does not have nearly enough pins that can be configured for this. What would be a way to solve this problem? Is there a chip that can…

Alexis K
- 2,719
- 8
- 30
- 33
18
votes
5 answers
Are BJTs suitable for level-shifters? It seems FETs are more common,how do they compare?
I'm a hobbyist, and never got past the datasheets/tutorials for FET transistors; I'm a BJT man. I never found discussions dealing with BJT vs. FET and specific applications best suited for each type. My projects are very simple switching and logic…
user160409
16
votes
2 answers
USB to GPIO module
I'm working on a project which involves having users press buttons on a webpage which the server needs to send onto a microcontroller in the form of a GPIO signal. The only ports available on the server are USB.
I have had a couple of…

routeburn
- 357
- 1
- 2
- 5
16
votes
4 answers
How to drive a 20mA LED From a 4mA max GPIO Pin
I have an IC that has an GPIO with which I would like to drive a LED.
Since the device will be running off battery, keeping the power use low (Zero maybe) while the LED is off as a priority.
The GPIO supplies 3.3V when turned on and 0.0V votes when…

Geven
- 163
- 1
- 1
- 6
16
votes
1 answer
Open Drain vs Open Collector
Is there a practical difference between Open Drain and Open Collector outputs, or are the terms used interchangably? If they are indeed different, what are the contexts where each is advantageous? My hunch is that they are functionally equivalent,…

vicatcu
- 22,499
- 13
- 79
- 155
16
votes
3 answers
Why do I first need to set a value and then direction of the GPIO in an embedded processor?
I have a full time job as a firmware engineer. I've recently been given a task to review GPIO configurations and change the settings as needed. I found a few pins that were incorrectly configured so naturally I reconfigured them, however I was told…

flashburn
- 287
- 2
- 8
14
votes
6 answers
Is a pull up/down resistor really necessary?
Logical reading (1 or 0) of a micro-controller input GPIO pin may float if it is neither connected to VCC nor GND; someone said it is because of surrounding RF interference.
When a floating GPIO input pin voltage is affected by RF interference that…

mannok
- 481
- 4
- 10
12
votes
1 answer
Plugging a LDR into GPIO pins of a Raspberry Pi
I want to connect a LDR into the GPIO pins of my Raspberry Pi, I know that Raspberry Pi doesn't have an analog-to-digital converter so what I want to do is to signal a HIGH signal (3.3v) on the GPIO when there is low resistance on the LDR (something…

Tarantula
- 423
- 6
- 12
12
votes
3 answers
12 V input on 3.3 V GPIO, TVS pulled down or Schottky pull up?
I am building my own PLC that has to accept permanent inputs of up to 30 V DC into a STM32F with 3.3 V inputs.
The switched input will have to work with 8-30 V, but 90% of the time the input voltage will be fixed at 12 V or 24 V. Inputs will only…

Newbie Noob
- 886
- 10
- 27
12
votes
3 answers
Understanding GPIO analog and digital
I'm trying to understand GPIO, and have read a bunch of different blog posts and I think I'm close to getting it, but still struggling with a few things.
I've seen a few reference to GPIO only being able to work with binary values, but other posts…

pedalpete
- 223
- 1
- 2
- 6
11
votes
3 answers
What happens on the STM32 when two pins are configured to have the same alternate function?
Reading through the STM32F051 manual, it looks like it's possible to configure the same alternate function on two pins; for example, you could have multiple USART1_TX pins at the same time. Or for example the more problematic case of two USART_RX…

joeforker
- 5,596
- 10
- 38
- 59