In order to avoid all unnecessary difficulties, I have freshly installed rockpi4_debian_stretch_lxde_armhf_20181105_2120-gpt.img.gz on my 32GB eMMC. Then I worked through all described steps. https://wiki.radxa.com/Rockpi4/dev/libmraa
Unfortunately I cannot install libmraa-rockpi4.
mike@mpc4:~$ ssh linaro@rpi4b
linaro@rpi4bās password:
Linux rpi4b 4.4.154-75-rockchip-00013-gcc4fef3 #2 SMP Sat Mar 23 15:05:37 CST 2019 aarch64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Mar 26 08:42:21 2019 from 192.168.178.24
linaro@rpi4b:~$ sudo apt update
Hit:1 http://apt.radxa.com/stretch stretch InRelease
Ign:2 Index of /debian stretch InRelease
Hit:3 http://repo.linaro.org/ubuntu/linaro-overlay stretch InRelease
Hit:4 http://security.debian.org stretch/updates InRelease
Hit:5 Index of /debian stretch-updates InRelease
Hit:6 Index of /debian stretch Release
Reading package lists⦠Done
Building dependency tree
Reading state information⦠Done
All packages are up to date.
linaro@rpi4b:~$ sudo apt install libmraa-rockpi4
Reading package lists⦠Done
Building dependency tree
Reading state information⦠Done
libmraa-rockpi4 is already the newest version (0.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up libmraa-rockpi4 (0.1) ā¦
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
dpkg: error processing package libmraa-rockpi4 (āconfigure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
libmraa-rockpi4
E: Sub-process /usr/bin/dpkg returned an error code (1)
linaro@rpi4b:~$
I donāt know why it is to this ālibmraa-rockpi4 is already the newest version (0.1).ā Message comes, this came already with the first attempt of the installation. After that I have to uninstall the package with āapt purgeā and then start over, but nothing changes. However, I get another, perhaps interesting, message.
linaro@rpi4b:~$ sudo apt purge libmraa-rockpi4
Reading package lists⦠Done
Building dependency tree
Reading state information⦠Done
The following packages will be REMOVED:
libmraa-rockpi4*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database ⦠75098 files and directories currently installed.)
Removing libmraa-rockpi4 (0.1) ā¦
dpkg: warning: while removing libmraa-rockpi4, directory ā/usr/local/lib/python2.7ā not empty so not removed
linaro@rpi4b:~$
linaro@rpi4b:~$ sudo apt update
Get:1 http://apt.radxa.com/stretch stretch InRelease [2361 B]
Ign:2 Index of /debian stretch InRelease
Hit:3 http://repo.linaro.org/ubuntu/linaro-overlay stretch InRelease
Get:4 Index of /debian stretch-updates InRelease [91.0 kB]
Hit:5 Index of /debian stretch Release
Hit:6 http://security.debian.org stretch/updates InRelease
Get:7 http://apt.radxa.com/stretch stretch/main armhf Packages [10.3 kB]
Fetched 104 kB in 2s (50.0 kB/s)
Reading package lists⦠Done
Building dependency tree
Reading state information⦠Done
All packages are up to date.
linaro@rpi4b:~$ sudo apt install libmraa-rockpi4
Reading package lists⦠Done
Building dependency tree
Reading state information⦠Done
The following additional packages will be installed:
libjson-c3
The following NEW packages will be installed:
libjson-c3 libmraa-rockpi4
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 248 kB of archives.
After this operation, 57.3 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 Index of /debian stretch/main armhf libjson-c3 armhf 0.12.1-1.1 [24.2 kB]
Get:2 http://apt.radxa.com/stretch stretch/main armhf libmraa-rockpi4 armhf 0.3 [223 kB]
Fetched 248 kB in 0s (1152 kB/s)
Selecting previously unselected package libjson-c3:armhf.
(Reading database ⦠74961 files and directories currently installed.)
Preparing to unpack ā¦/libjson-c3_0.12.1-1.1_armhf.deb ā¦
Unpacking libjson-c3:armhf (0.12.1-1.1) ā¦
Selecting previously unselected package libmraa-rockpi4.
Preparing to unpack ā¦/libmraa-rockpi4_0.3_armhf.deb ā¦
Unpacking libmraa-rockpi4 (0.3) ā¦
Setting up libjson-c3:armhf (0.12.1-1.1) ā¦
Processing triggers for libc-bin (2.24-11+deb9u4) ā¦
Setting up libmraa-rockpi4 (0.3) ā¦
linaro@rpi4b:~$
A small unimportant bug is in Wicki, since we did not clone mraa-gpio from Github and compile it afterwards, but got the package via apt install, the call is slightly different.
Both for the tool i2cdetect and for Python 2.7 the bus 0 has to be addressed with its ID 7. Otherwise it works quite well. I connected the character OLED NHD-0420CW from Newhaven Display to I2C as a test.
linaro@rpi4b:~$ mraa-i2c list
Bus 0: id=07 type=linux default
Bus 1: id=02 type=linux
Bus 2: id=06 type=linux
linaro@rpi4b:~$ sudo mraa-i2c detect 0
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- 3d -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
linaro@rpi4b:~$ sudo i2cdetect -y 7
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- 3d -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Example lcd_showtime
# shows time and date in first tow rows of LCD
# Date: Dec 8th, 2017
#
import os
from I2cCharDisplay import I2cCharDisplay
# import locale # https://help.ubuntu.com/community/Locale
from time import strftime
import threading # I do not like to use sleep(1) to wait a second, not even in an example
OLEDADDRESS = 0x3d # i2c address for the oled display
busnum = 7
# locale.setlocale(locale.LC_ALL,'de_DE.utf8') # Set locale for a nice date, to date french girl, change to fr_FR.utf8
oled = I2cCharDisplay("OLED", OLEDADDRESS, 4) # create an oled object for a 4 line display
def getCpuTemperature():
tempFile = open( "/sys/class/thermal/thermal_zone0/temp" )
cpu_temp = tempFile.read()
tempFile.close()
return float(cpu_temp)/1000
oled.clear()
oled.setBrightness(4)
def show_time():
threading.Timer(1.0, show_time).start() # Show time and date every second
oled.cursorMove(col=7,row=1)
oled.writeString(strftime('%H:%M:%S')) # Hour:minute:second
oled.cursorMove(col=3,row=2)
oled.writeString(strftime('%a %d. %b %Y')) # Weekday as localeās abbreviated name, Day of the month,
# Month as localeās abbreviated name, Year with century
oled.cursorMove(col=4,row=3)
oled.writeString("CPU temp ")
oled.writeString(str(round(getCpuTemperature(), 1)))
oled.writeString("C")
show_time()