Pi4cplus GPIO not working

I have setup new RockPi 4cplus board with Ubuntu 20.02 and try to setup GPIOs according to this wiki
https://wiki.radxa.com/Rockpi4/hardware/gpio”. I have also installed libmraa. When I define a GPIO
according to the wiki,i.e. GPIO131, under /sys/class/gpio I see gpio131, so everything looks just
fine. However, when I use command mraa-gpio list I get response “NO PINS”. So obviously, GPIOs
do not work according to the above Wiki.
Is there a solution to successfully define GPIOs?
Helmut

I have the same issue with the latest Ubuntu release (20.04) on 4C+. Using the latest Debian, “mraa-gpio list” returns all GPIOs so we can confirm that it’s not a problem with any HW or SW, sounds like a configuration issue.

I could see that the MRAA library reported Unknown Platform in the POE service, maybe this can help us find the issue.

I tested to switch from Focal Release to Focal Testing for the repository and tried to reinstall libmraa with no sucess. Also tried building MRAA from source with no success.

See here: Libmraa, mraa-gpio needs sudo

@bnsearle
I have used all mraa commands as root and it is not working as it should…
When I set the GPIOs manually, direction and value are correct. However I need to make
an electrical measurement to verify that the pin has really +3,3 V when his value has been set to
1 (high), which is still not clear yet…

The GPIO pins are 3.0V, and some have 4K7 resistor pull-ups - see the data sheet. But when calling from a C program the method I used works, provided you initialise with two system gpio reads per pin:

// 'manually' initialise the pins !
system("mraa-gpio get 27");
system("mraa-gpio get 29");
system("mraa-gpio get 31");
system("mraa-gpio get 33");

system("mraa-gpio get 27");
system("mraa-gpio get 29");
system("mraa-gpio get 31");
system("mraa-gpio get 33")

If you don’t do this it will fail! I use these pins for push-buttons as they have the required pull-ups. It’s a ‘kluge’ - a bit flaky really…

Installing Radxa 4C+ - mraa not working fixes the mraa-gpio list not returning pins.

I did more intensive testing with GPIOs on Rock Pi4c+ with help of an external board connected
to the GPIO-.header which offers 4 12V-output-ports to power external devices which are toggled
on/off by help of pins 12, 32, 33, 37 (pin-numbers, not GPIO#), that means toggle pin 12 to high
(+3,3V) and the external board powers 12Vpower-port#1 to ON, toggle pin 32 to high turns the
next 12Vpower-port to ON, toggle pins to low switches 12Vpower-ports to off. This mechanism
works flawlessly on a standard RaspberryPi4-board.

Now testing with RockPi4c plus, no GPIOs have been set initially:
sudo mraa-gpio get 12 --> 12=1 already high, however corresponding 12Vpower-port is OFF
sudo mraa-gpio set 32 1 --> corresponding 12Vpower-port is ON,
however sudo mraa-gpio get 32 --> 32=0 --> 12Vpower-port is OFF !!!
Obviously, reading the pin-state toggles the pin from High to LOW, which is bizarre if not a serious bug.
Pins 33 and 37 also can be set to High (1) and corresponding 12Vpower-ports turn ON, but when
reading states of pins 33 and 37 with mraa-gpio get # the pins fall back to low as with pin# 32…

Pin# 12 never gets into a state where the corresponding 12Vpower-port reacts with status ON…

When I setup a systemd service to set pins 12,32,33,37 to high at bootup I get the following message:

Service mraa-gpio set 12 1 started, libmraa version v2.1.0-25-gf854463 intialized by user root with
EUID 0
gpio: platform doesn’t support chardev, falling back to sysfs
libmraa initialized for platform ‘Rock Pi 4’ of type 20.

I need only to set all 12Vpower-ports of my external board connected to the GPIO-header to ON once,
so the only thing missing is pin#12 which never turns the power-port on although it reports being in
the state “1”.

Has anybody an idea where to look to get pin#12 working?
Any help is appreciated,
Helmut

1 Like

Today I have measured pin voltages: when I do

sudo mraa-gpio set 12 1
sudo mraa-gpio set 32 1
sudo mraa-gpio set 33 1
sudo mraa-gpio set 37 1

then pins 32,33,37 have 3,0 V vs GND, they turn on the corresponding 12Vports of my external power board. However, pin 12 shows only 1V vs GND, and this is the reason why this pin does not activate the correspondent 12V port of my external board. When I set pin 12 to 0 the Voltage measurement reads 0 V, when I set pin 12 again to 1 the reading is again 1V!!! So here is definitely something wrong with the board…
Helmut

Mraa Gpio Rock 4 c+
Hi, I am having a similar problem with my rock Pi 4 C plus, mainly when declaring pin 36 as an input, in this case, which is the one we are using for shutdown with an external power supply that provides 3V to that input while the Rock It is on and 0 when it sends the order to turn off, but as I have already explained, pin 36 is always kept at 1.