Raspberry PI 4 GPIO

Hi is there a way to access the extra GPIO 0 and 1 on the PI 4 as in the list pin 27 and 28 are not configurable as outputs?

Thanks

Rich

I always thought that those pins were basically not for us users as they were dedicated to talking to HATs thru i2c.

Has this changed on the Pi4?

Are you really short of two pins for your project?

1 Like

If you really need more gpio:

Hi,
Thanks for the replies, the reason I need 27 and 28 is I designed a PCB around the PI 4 and stupidly didn't realise that they just added those as general IO so my new board is specific to the new PI 4 and GPIO 0 and 1.

Thanks
Rich

1 Like

Tried modifying the node but it doesn't work.

Even using RPi.GPIO in a simple python prog, I can't control those pins on my Pi4

Googling is getting me nowhere

Does something need configuring to enabling those pins for general use?

The Raspberry Pi has two I2C connections at GPIO 2 and 3 (SDA and SCL) are for I2C0 (master) and physical pins 27 and 28 are I2C pins that enable the Pi to talk to compatible HAT (Hardware Attached on Top) add on boards. - https://www.tomshardware.com/reviews/raspberry-pi-gpio-pinout,6122.html

I've had a look at the RPi.GPIO source code (which is ultimately the library used by the Pi nodes) and it doesn't allow pins 27 and 28 to be used (the -1 indicates not to be used) so in-built Node-RED Pi node isn't going to work at the moment :frowning:

I'm going to see if node-red-node-pi-gpiod will work

@rjandsam Where did you see that these pins can be used for gpio purposes?

Hi,
Thanks for looking into it for me, I have found that some people have successfully used IO0 and IO1 as outputs on the PI 3 but not node-red and the IO information I referred to was from the following link.

Thanks

Rich

even typing pinout in terminal shows them as GPIO.

That article pic is the ONLY thing I've found that shows GPIO0 and GPIO1 on those pins.

Nothing I've found in pigpio suggests that it allows them

Unfortunately I think you've jumped the gun with this one :frowning:

mm - so it does!

They are available :slight_smile:
At least by using shell commands

sudo echo 0 > /sys/class/gpio/export
followed by
sudo echo out > /sys/class/gpio/gpio0/direction

sets it up to be used as an output
then

sudo echo 1 > /sys/class/gpio/gpio0/value
and
sudo echo 0 > /sys/class/gpio/gpio0/value

will switch it high or low :slight_smile:
So, you could be able to control it using exec nodes :slight_smile:
(obviously not easily but at least possible)

Presumably there must be a way to turn off “hat detection” otherwise that could kick in and re-take over the pins. This must be in the Raspbian OS somewhere so may not be available to beginners in an easy to use way.

You'd thought so - but I can't find ANYTHING, ANYWHERE about it :frowning:

Hi,

well done I have just had a similar result as follows.

I firstly turned off i2c in raspberry pi configuration.
then in python I did the following.

from gpiozero import LED

led=LED(0)
led2=LED(1)
led.on()
led2.on()

I just don't know how to implement this in node-red.

Thanks for the great advice and pointers guys.

Rich

mmm - that's interesting that it worked because I thought that gpiozero used the RPi.GPIO library to be its default pin engine

Investigating further....

also works with RPi.GPIO in python.

Rebooting my Pi to see what is going on - I tried using it in python and it didn't work

OK - starting to square the circle off a little bit :slight_smile:

If we use BOARD mode (e.g use 27) it doesn't work but BCM (eg use 0) it does

Can you confirm that this doesn't work for you?

import RPi.GPIO as GPIO
import time as time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(27, GPIO.OUT)
while True:
    GPIO.output(27, 1)
    time.sleep(1)
    GPIO.output(27,0)
    time.sleep(1)

If this is true, then it explains why my mod of the Pi node fails as it uses physical pin numbering

Yes I used the following;
import RPi.GPIO as GPIO
LedPin=0
GPIO.setmode(GPIO.BCM)
GPIO.setup(LedPin, GPIO.OUT)
GPIO.output(LedPin, GPIO.HIGH)

Rich