Radxa 4C+ - mraa not working

Hi

image:bullseye/sid
only apt source:deb http://apt.radxa.com/bullseye-testing/ bullseye main

all previous mraa stuff removed.
root@rock-4c-plus:/home/rock# sudo mraa-gpio list
No Pins
root@rock-4c-plus:/home/rock#

1 Like

please update the /etc/apt/sources.list.d/apt-radxa-com.list, then reinstall the libmraa

cat /etc/apt/sources.list.d/apt-radxa-com.list 
deb http://apt.radxa.com/bullseye-stable/ bullseye main

You can try the following steps:
export DISTRO=bullseye-stable
wget -O - apt.radxa.com/$DISTRO/public.key | sudo apt-key add -
sudo apt-get update -y
sudo apt-get install libmraa -y

root@rock-4c-plus:/home/rock# sudo apt-get install libmraa -y
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libmraa : Depends: libjson-c5 but it is not installable

please update the apt source and install again.

did that multple times. Got the latest image (rock-4c-plus-ubuntu-focal-server-arm64-20230101-1210-gpt.img.xz). Added the source and updated repo, but nothing. Still

root@rock-4c-plus:/home/rock# apt-get update
Hit:1 http://apt.radxa.com/focal-stable focal InRelease
Hit:2 http://apt.radxa.com/bullseye-stable bullseye InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Reading package lists… Done
root@rock-4c-plus:/home/rock# sudo apt-get install libmraa -y
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libmraa : Depends: libjson-c5 but it is not installable

Is your system debian or ubuntu ?

right now i have a ubuntu image.

If it’s ubuntu, please delete the debian related lines in /etc/apt/sources.list.d/apt-radxa-com.list

root@rock-4c-plus:/home/rock# pico /etc/apt/sources.list.d/apt-radxa-com.list
root@rock-4c-plus:/home/rock# apt-get update
Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:4 http://apt.radxa.com/focal-stable focal InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Reading package lists… Done
root@rock-4c-plus:/home/rock# sudo apt-get install libmraa -y
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
libmraa
0 upgraded, 1 newly installed, 0 to remove and 275 not upgraded.
Need to get 206 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://apt.radxa.com/focal-stable focal/main arm64 libmraa arm64 1.8 [206 kB]
Fetched 206 kB in 0s (1016 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libmraa.
(Reading database … 58305 files and directories currently installed.)
Preparing to unpack …/archives/libmraa_1.8_arm64.deb …
Unpacking libmraa (1.8) …
Setting up libmraa (1.8) …
root@rock-4c-plus:/home/rock# mraa-gpio list
No Pins
root@rock-4c-plus:/home/rock# date
Tue Jan 10 06:24:06 UTC 2023
root@rock-4c-plus:/home/rock#

libmraa.zip (203.2 KB)
please try this deb packge, and we will update our apt source.

2 Likes

Nice

root@rock-4c-plus:/home/rock# mraa-gpio list
01 3V3:
02 5V:
03 SDA7: GPIO I2C
04 5V:
05 SCL7: GPIO I2C
06 GND:
07 SPI2_CLK: GPIO SPI
08 TXD2: GPIO UART
09 GND:
10 RXD2: GPIO UART
11 PWM0: GPIO PWM
12 GPIO4_A3: GPIO
13 PWM1: GPIO PWM
14 GND:
15 GPIO4_C5: GPIO
16 GPIO4_D2: GPIO
17 3V3:
18 GPIO4_D4: GPIO
19 SPI1TX,TXD4: GPIO SPI UART
20 GND:
21 SPI1RX,RXD4: GPIO SPI UART
22 GPIO4_D5: GPIO
23 SPI1CLK: GPIO SPI
24 SPI1CS: GPIO SPI
25 GND:
26 ADC_IN0: AIO
27 SDA2: GPIO I2C
28 SCL2: GPIO I2C
29 SCL6,SPI2RX: GPIO I2C SPI
30 GND:
31 SDA6,SPI2TX: GPIO I2C SPI
32 GPIO3_C0: GPIO
33 SPI2CS: GPIO SPI
34 GND:
35 GPIO4_A5: GPIO
36 GPIO4_A4: GPIO
37 GPIO4_D6: GPIO
38 GPIO4_A6: GPIO
39 GND:
40 GPIO4_A7: GPIO
root@rock-4c-plus:/home/rock#

1 Like

I had exactly the same problem and installed the deb package, no I can get a list of GPIOs with command mraa-gpio list. However, I have tested the functionality: set pin#32 (which yields GPIO112)
to high with command mraa-gpio set 32 1. Then check value with mraa-gpio get 32 -> value “0” !!!
Check /sys/class/gpio, you find gpio112 existing, cd gpio112 and check direction -> “in” and value
“0”.
When manually defining the pin#32 by
cd /sys/class/gpio
sudo echo 112 > export -> this creates dir gpio112
cd gpio112
sudo echo out > direction
echo 1 > value
more direction -> “out”
more value -> “1”
so everything as expected. But then check with command
mraa-gpio get 32 -> “0” -> different value compared to /sys/class/gpio/gpio112…

Not really working…

hello nasca, can you help me with installing the libmraa? when i actually follow the steps on this link “https://wiki.radxa.com/Rockpi4/dev/libmraa” I have this following error when inputting the fourth step command:

"Reading package lists… Done

Building dependency tree… Done

Reading state information… Done

rockchip-overlay is already the newest version (4.1).

0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

Reading package lists… Done

Building dependency tree… Done

Reading state information… Done

E: Unable to locate package rockpi4-dtbo

can you tell me which system image you uesed ?

rock-4c-plus_debian_bullseye_kde_b55.img.xz

please give me a download link, and I will give you a reply next Monday.

https://github.com/radxa-build/rock-4c-plus/releases/download/20230312-1521/rock-4c-plus_debian_bullseye_kde_b55.img.xz

I installed the libmraa succesfully but when I run a python code, the error says “PermissionError: Permission denied: '/sys/class/gpio/export”

have to run as root