User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:18 am

Hello,
for the project I'm working on, I'm literally out of GPIO pins. I'm using all of them.
I was thinking about a couple of other things to do, but I would need 2 more pins.

I'm only left with the GPIO0 and GPIO1 pins, marked as ID_SC and ID_SD. I know they seems to be "reserved" for usage with some HAT's EEPROMs and I'm also already aware of this:
0-1.jpg
0-1.jpg (58.34 KiB) Viewed 5931 times
That said, what I noticed is that if I export them as output and put them high, at least from the gpio readall utility they seem to be correctly configured:

Code: Select all

 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |  OUT | 0 | 11 || 12 | 0 | OUT  | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |  OUT | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |  OUT | 0 | 15 || 16 | 1 | OUT  | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 1 | OUT  | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |  OUT | 1 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |  OUT | 1 | 21 || 22 | 1 | OUT  | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |  OUT | 1 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |  OUT | 1 | 27 || 28 | 1 | OUT  | SCL.0   | 31  | 1   |  <<===
 |   5 |  21 | GPIO.21 |  OUT | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 1 | 35 || 36 | 1 | OUT  | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |  OUT | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
I still didn't attach anything to them, because I wanted a confirmation about their usage.
Thanks.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

User avatar
joan
Posts: 14755
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:20 am

I believe you will be fine as long as you don't switch them into I2C mode (ALT0). Setting them as normal inputs or outputs should be okay.

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:23 am

joan wrote:I believe you will be fine as long as you don't switch them into I2C mode (ALT0). Setting them as normal inputs or outputs should be okay.
Hello joan,
another couple of things:
1) is there anything I must configure at boot? Or am I just fine with exporting them as output?
2) do you know if there are any pull-up resistors attached to those two pins?
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:31 am

Well, for the question (2), it seems they don't have any resistor:
Image
Last edited by dentex on Fri Oct 07, 2016 8:38 am, edited 1 time in total.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

User avatar
joan
Posts: 14755
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:35 am

I'd just configure them as outputs. I'm currently generating servo pulses on GPIO 0/1 on my Pi3 and nothing is obviously broken.

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:37 am

joan wrote:I'd just configure them as outputs. I'm currently generating servo pulses on GPIO 0/1 on my Pi3 and nothing is obviously broken.
Thanks for the test!
Really helpful.
I'll go for it!


PS: it seems I cannot attach images anymore :(
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

User avatar
joan
Posts: 14755
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:43 am

There has always been a 64k limit for a single image. Have you hit that limit? I'm not aware of any restriction per user.

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 8:45 am

joan wrote:There has always been a 64k limit for a single image. Have you hit that limit? I'm not aware of any restriction per user.
I was at 53k with the 2nd image... Anyway no problem, I used imgur.
Thanks mate,
Bye!
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 9:50 am

dentex wrote:Hello,
for the project I'm working on, I'm literally out of GPIO pins. I'm using all of them.
I was thinking about a couple of other things to do, but I would need 2 more pins.
I'm not sure if it will help you but if you can free up pins 3 & 5 then you can add i2c input / output expanders giving you a lot more i/o pins (you can add upto 8 mcp23016, which would give you 16 i/o pins each).
Doug.
Building Management Systems Engineer.

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: GPIO0 and GPIO1 as output pins

Fri Oct 07, 2016 10:23 am

BMS Doug wrote:I'm not sure if it will help you but if you can free up pins 3 & 5 then you can add i2c input / output expanders giving you a lot more i/o pins (you can add upto 8 mcp23016, which would give you 16 i/o pins each).
Hello Doug,
Yes I know that, thanks. :)
I will be using one MCP23017 later on for with a LED bar (it will be a water level indicator gauge). As for the rest, most of my used GPiO pins are to PWM various stuff (LEDs & fans). I'm using some pins as output and input, but they are physically scattered around the body of this project and I found it was easier to access them directly.
Anyway, with a more thoughtful design, probably I could had group some of them behind a MCP23008 or two, but I added stuff as I went through the process. Just to give you an idea.

I hope I will be able to show off all this stuff soon! :D
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

Return to “Beginners”