Penta HAT, top fan won't work

I can’t seem to get the pwm for GPIO heads on the rockpi 4 to work. Note, the intent is to run the fan from penta hat, currently no operating and way too hot to be a usable product.
rockpi services won’t run:

Please note I’m running armbian, buster server. I do not wish to deviate to radxa’s older debian

As someone who is not a programmer, it seems to me the issue is with mraa not properly being translated by SWIG. Please help. I’ve been looking into this almost 2 days and I’m about to throw the rockpi 4 at a wall…

services not running
rk3399-bluetooth.service loaded failed failed Bluetooth Rockpi
rng-tools.service loaded active running rng-tools.service
rockpi-penta.service loaded failed failed Rockpi SATA Hat

service data as follows:
rockpi-penta.service - Rockpi SATA Hat
Loaded: loaded (/lib/systemd/system/rockpi-penta.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-06-27 21:27:49 -08; 4min 30s ago
Process: 1721 ExecStart=/usr/bin/python3 /usr/bin/rockpi-penta/main.py on (code=exited, status=1/FAILURE)
Main PID: 1721 (code=exited, status=1/FAILURE)

Jun 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Service RestartSec=100ms expired, scheduling restart.
Jun 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Scheduled restart job, restart counter is at 5.
Jun 27 21:27:49 fileserver systemd[1]: Stopped Rockpi SATA Hat.
Jun 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Start request repeated too quickly.
Jun 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Failed with result ‘exit-code’.
Jun 27 21:27:49 fileserver systemd[1]: Failed to start Rockpi SATA Hat.

system log detail as follows:
un 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Service RestartSec=100ms expired, scheduling restart.
Jun 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Scheduled restart job, restart counter is at 4.
Jun 27 21:27:49 fileserver systemd[1]: Stopped Rockpi SATA Hat.
Jun 27 21:27:49 fileserver systemd[1]: Started Rockpi SATA Hat.
Jun 27 21:27:49 fileserver libmraa[1721]: libmraa version v2.0.0-57-gf374a26 initialised by user ‘root’ with EUID 0
Jun 27 21:27:49 fileserver libmraa[1721]: gpio: platform doesn’t support chardev, falling back to sysfs
Jun 27 21:27:49 fileserver libmraa[1721]: libmraa initialised for platform ‘ROCK Pi 4’ of type 20
Jun 27 21:27:49 fileserver libmraa[1721]: pwm_init: pwm0. Failed to open export for writing: No such file or directory
Jun 27 21:27:49 fileserver python3[1721]: Traceback (most recent call last):
Jun 27 21:27:49 fileserver python3[1721]: File “/usr/bin/rockpi-penta/main.py”, line 3, in
Jun 27 21:27:49 fileserver python3[1721]: import fan
Jun 27 21:27:49 fileserver python3[1721]: File “/usr/bin/rockpi-penta/fan.py”, line 6, in
Jun 27 21:27:49 fileserver python3[1721]: pin13 = mraa.Pwm(13)
Jun 27 21:27:49 fileserver python3[1721]: File “/usr/local/lib/python3.7/dist-packages/mraa.py”, line 579, in init
Jun 27 21:27:49 fileserver python3[1721]: this = _mraa.new_Pwm(pin, owner, chipid)
Jun 27 21:27:49 fileserver python3[1721]: ValueError: Error initialising PWM on pin
Jun 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Main process exited, code=exited, status=1/FAILURE
Jun 27 21:27:49 fileserver systemd[1]: rockpi-penta.service: Failed with result ‘exit-code’.

Testing the PMW code of pwm.py yields the same:
Traceback (most recent call last):
File “./pwm.py”, line 6, in
x = mraa.Pwm(11) # pin11 pwm0
File “/usr/local/lib/python3.7/dist-packages/mraa.py”, line 579, in init
this = _mraa.new_Pwm(pin, owner, chipid)
ValueError: Error initialising PWM on pin

Refer to step 1 here How to install PoE HAT's software on Armbian , both fan use the same pin.

Just completed the poe procedure:
Looks like progress but still no fan movement or oled screen display…

see below output
udo systemctl start rockpi-poe.service
exampler@fileserver:~$ sudo systemctl status rockpi-poe.service
● rockpi-poe.service - Rockpi PoE-FAN
Loaded: loaded (/lib/systemd/system/rockpi-poe.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sun 2020-06-28 00:09:54 -08; 4s ago
Process: 4700 ExecStart=/usr/bin/python3 /usr/bin/rockpi-poe.py start (code=exited, status=0/SUCCESS)
Process: 4716 ExecStop=/usr/bin/python3 /usr/bin/rockpi-poe.py stop (code=exited, status=0/SUCCESS)
Main PID: 4700 (code=exited, status=0/SUCCESS)

Jun 28 00:09:54 fileserver libmraa[4700]: pwm_init: pwm0. Failed to open export for writing: No such file or directory
Jun 28 00:09:54 fileserver python3[4700]: ‘NoneType’ object has no attribute ‘write’
Jun 28 00:09:54 fileserver python3[4700]: using python3 rockpi-poe.py start|stop|enable
Jun 28 00:09:54 fileserver libmraa[4716]: libmraa version v2.0.0-57-gf374a26 initialised by user ‘root’ with EUID 0
Jun 28 00:09:54 fileserver libmraa[4716]: gpio: platform doesn’t support chardev, falling back to sysfs
Jun 28 00:09:54 fileserver libmraa[4716]: libmraa initialised for platform ‘ROCK Pi 4’ of type 20
Jun 28 00:09:54 fileserver libmraa[4716]: pwm_init: pwm0. Failed to open export for writing: No such file or directory
Jun 28 00:09:54 fileserver python3[4716]: ‘NoneType’ object has no attribute ‘write’
Jun 28 00:09:54 fileserver python3[4716]: using python3 rockpi-poe.py start|stop|enable
Jun 28 00:09:54 fileserver systemd[1]: rockpi-poe.service: Succeeded.

Please note also for reference, not sure if this has to do with it, as a last ditch effort I attempted to install your kernal, currently when I attempt I get the following:
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up rockchip-fstab (0.1) …
sed: -e expression #1, char 0: no previous regular expression
mount all partitions
mount: vfat: mount point does not exist.
mount: vfat: mount point does not exist.
mount: vfat: mount point does not exist.
mount: vfat: mount point does not exist.
dpkg: error processing package rockchip-fstab (–configure):
installed rockchip-fstab package post-installation script subprocess returned error exit status 32
Setting up linux-image-4.4.154-95-rockchip-gd2ab1f26e1b3 (4.4.154-95-rockchip) …
update-initramfs: Generating /boot/initrd.img-4.4.154-95-rockchip-gd2ab1f26e1b3
update-initramfs: Converting to u-boot format
Kernel configuration : earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait root=PARTUUID=B921B045-1DF0-41C3-AF44-4C6F280D3FAE

Creating new extlinux.conf…
cp: cannot stat ‘/usr/lib/linux-image-5.4.45-rockchip64’: No such file or directory
run-parts: /etc/kernel/postinst.d/zz-update-extlinux exited with return code 1
dpkg: error processing package linux-image-4.4.154-95-rockchip-gd2ab1f26e1b3 (–configure):
installed linux-image-4.4.154-95-rockchip-gd2ab1f26e1b3 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-4.4-latest:
linux-4.4-latest depends on linux-image-4.4.154-95-rockchip-gd2ab1f26e1b3; however:
Package linux-image-4.4.154-95-rockchip-gd2ab1f26e1b3 is not configured yet.

dpkg: error processing package linux-4.4-latest (–configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
rockchip-fstab
linux-image-4.4.154-95-rockchip-gd2ab1f26e1b3
linux-4.4-latest
E: Sub-process /usr/bin/dpkg returned an error code (1)

For reference, output of rockpi penta service expectedly remains unchanged also also.

Just step 1: Enable hardware resources

lol I remember thinking when I did it I had to reboot, I didn’t which was the problem.
Fan is working :slight_smile: so stoked to see progress thanks.
Next issue: nothing is showing on the oled

This is the same problem, hardware resource not enabled. The oled using I2C-7. If you’re familiar with Armbian you can open it. I will also provide a dtbo later.

Nowhere near familiar enough, not a coder but always keen to learn. Any guidance you could provide to speed up the process would be preferred. I assume I essentially need to write another dtbo as another overlay? Or edit the uncompiled code of the existing one (could you supply?). As I read it I can just uncompile it myself?
It’s my way that I can’t leave a job half done, any further guidance you could provide to assist would be much appreciated.

I uploaded the new dtb and it enabled PWM and I2C:

https://rock.sh/rockpi-penta-dtbo

Replace rockpi-poe.dtbo with this rockpi-penta.dtbo, and remember to modify /boot/armbianEnv.txt

Works great, thanks heaps for the prompt assist.

Hey - apologies for necroing this thread, but how would I get the fan working on a Rock Pi 3A running stock Radxa Debian? I have the rk3568-pwm8-m0-fan overlay installed and I’ve tried pins 8, 13, and 33 in fan.py, but none of them can initialize PWM.

Hello smerrill,

It seems that the libmraa of ROCK 3A is not working yet, our colleagues are working on it.

Cool - thanks for the update!