Page 1 of 1

Using all GPIO pins as general purpose GPIO

Posted: Tue Aug 11, 2020 3:31 am
by mogo4414
Hello,

I am working on a project that will required either 18 or 24 GPIO pins. 2/3's of the pins will require the internal pull/up resistor and the other 1/3 will control stepper motors through PUL/DIR.

My question is, despite there being 26 GPIO pins, only 17 are designated as general GPIO, so if I do not enable the SPI/I2C/etc, can all 26 GPIO pins be used reliably, long term, as general function GPIO pins?

I am happy to go through each and test, but I feel like the issue is a bit more complicated and could lead to failures, that might not be immediately obvious.

I guess I am just hoping for some guiding comments: not possible/possible but hard/possible and easy/just use no change necessary/etc.

Thank you in advance for your time and help.

Re: Using all GPIO pins as general purpose GPIO

Posted: Tue Aug 11, 2020 5:18 am
by rpdom
Yes, should be fine.

Things to watch for are:

* Default pull states on boot

* Default functions like UART output from the boot loader

* Hard-wired 1K8 pull-ups on GPIO 2 & 3

* Any enabled interfaces, like 1-wre on GPIO 4, for example

Will any of these things cause undesirable behaviour in your hardware?

Alternatively you can use i2c GPIO expanders to drive many more outputs/inputs.

Re: Using all GPIO pins as general purpose GPIO

Posted: Tue Aug 11, 2020 9:37 am
by LTolledo
rpdom wrote:
Tue Aug 11, 2020 5:18 am
Alternatively you can use i2c GPIO expanders to drive many more outputs/inputs.
+1 on this

1 GPIO extender for inputs
1 GPIO extender for outputs

the GPIO extenders will bear the brunt of possible mistakes.... and protect your RPi

Re: Using all GPIO pins as general purpose GPIO

Posted: Wed Aug 12, 2020 1:07 am
by Imperf3kt
Don't forget the current limits also.
16mA on any single GPIO, 50mA across all GPIO combined.

Re: Using all GPIO pins as general purpose GPIO

Posted: Wed Aug 12, 2020 1:43 am
by mogo4414
Thank you all that was very informative!

rpdom,

I'm not sure specifcally if any of those mentioned points will be an issue, so hopefully all is alright. And as for I2C, I am planning to switch over shortly, still watching some tutorials on it at the moment.

Imperf3kt,

I'm only going to be using the internal pull-up resistor over short distance and PUL/DIR signaling from a stepper motor driver. I'm not sure what the current draw is exactly but I don't think this will reach 50mA?