Radxa 4C+ - mraa not working

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

Is there a group associated with this resource which the user can be defined to ? Thinking like with tty permission needed for arduinos on linux. I don’t have my rock 4c+ handy right now to check but that’s what I would look to alter.

it works for my pwm pins but not for i2c pins. I did all the instructions and tests, still my i2c pins cannot detect a device. I used pca9685 and mpu6050 but none of the sensors were recognized. I also used the i2c tools and mraa-tests.

my i2c devices actually works fine with arduino

I discovered two i2c buses which are 0 and 9 in my rock 4c+, but none of the buses can detect a device