Rock64pro and CPU Fan

Hi everybody. I have a rock64pro board running dietpi. I was wondering how I can get my cpu fan working with it?

I plugged it into the port on the board for the fan and it does not spin at all. I am under the impression that the fan is controlled by software.

Does dietpi manage this or do I need a 3rd party peice of software?

griphook
Could you please paste:

cat /sys/devices/platform/pwm-fan/hwmon/hwmon0/automatic
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp
cat /sys/devices/platform/pwm-fan/hwmon/hwmon0/fan_speed
cat /sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1
cat /sys/class/hwmon/hwmon0/pwm1

The following might work: https://github.com/tuxd3v/ats
But I started to work on a DietPi script to implement fan control. But currently the API is known to work with C2 only. Didn’t have the time and priority to implement further devices: https://github.com/MichaIng/DietPi/blob/dev/.meta/dietpi-fan_control
But the above outputs could help to check how RockPro64 implements PWM control.

Hi,

I have almost the same problem:
I’ve just installed DietPi on my RockPro64. The fan is always on.
I’ve managed to install ATS but it doesn’t to work cause the fan is always on.

Do you have of what could be the root cause of that?

Hi,

I’ve found the solution:
I had to modify the /etc/ats.conf file.
“/sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1” and cat /sys/class/hwmon/hwmon0/pwm1 don’t exit.
For me it was cat /sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1 and cat /sys/class/hwmon/hwmon3/pwm1

Many thanks for reporting. Good to know it uses hwmon3, through strange when hwmon0 is unused :roll_eyes:.

I collected the info here: https://github.com/MichaIng/DietPi/issues/1818
Probably someone finds time to implement a few more devices for our fan control script, but good to know that ATS works.

Hi,

I’m glad to help.
Though, I’ve rebooted my devices this morning and it changed to hwmon2.
I don’t what made it change that but when I replaced by hwmon2 on ats.conf, everything went ok.

Hi aldopi

can you help this newby what to type andd where to controll my fan with my Rock64pro?

MichaIng Can you give me a helping hand?

Followed this: https://github.com/tuxd3v/ats

apt-get install lua5.3 lua5.3-dev gcc make
update-alternatives --install /usr/bin/lua lua /usr/bin/lua5.3 1
update-alternatives --install /usr/bin/luac luac /usr/bin/luac5.3 1
apt-get install luarocks

line 1) apt-get works
line 2+3) The results of the 2 update command lines:

root@DietPi:~# update-alternatives --install /usr/bin/lua lua /usr/bin/lua5.3 1
update-alternatives: error: alternative link /usr/bin/lua is already managed by lua-interpreter
root@DietPi:~# update-alternatives --install /usr/bin/luac luac /usr/bin/luac5.3 1
update-alternatives: error: alternative link /usr/bin/luac is already managed by lua-compiler

line 4) apt-get works

checking status doesn’t work:

root@DietPi:~# systemctl status ats
Unit ats.service could not be found.

How further?

Ah, I missed

Install or Remove
Several independent Options: Master, Release and Manual.

A. Using Luarocks
Install from master( last code, but more prone to errors… )

luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-master-0.rockspec

Install by release, check in Releases tab( ie: v0.2.0 ):

luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-0.2-0.rockspec

Remove using LuaRocks

luarocks remove ats



root@DietPi:~# luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-0.2-0.rockspec

Warning: variable CFLAGS was not passed in build_variables
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o debug.o src/debug.c
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o ats.o src/ats.c
gcc -shared -Wl,-soname,ats.so.0 -llua5.3  -o ats.so.0.9 debug.o ats.o
Install ATS Tool ..................: ats in /usr/local/sbin
Install ATS Config ................: ats.config in /etc
Install ATS Service File ..........: ats.service in systemd
mkdir: created directory '/usr/local/lib/lua'
mkdir: created directory '/usr/local/lib/lua/5.3'
Install new ATS Library ...........: ats.so.0.9 in /usr/local/lib/lua/5.3
Create soname symLink .............: ats.so in /usr/local/lib/lua/5.3
Created symlink /etc/systemd/system/basic.target.wants/ats.service → /lib/systemd/system/ats.service.
Starting ATS Service..
● ats.service - ATS - Active Thermal Service
     Loaded: loaded (/lib/systemd/system/ats.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2021-12-22 20:32:31 CET; 1s ago
    Process: 23551 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
   Main PID: 23551 (code=exited, status=1/FAILURE)
        CPU: 11ms
make: *** [Makefile:119: install] Error 3

Error: Build error: Failed installing.
root@DietPi:~#
root@DietPi:~# luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-master-0.rockspec
Cloning into 'ats'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 24 (delta 1), reused 11 (delta 0), pack-reused 0
Receiving objects: 100% (24/24), 106.81 KiB | 338.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.
Warning: variable CFLAGS was not passed in build_variables
** PLATFORM = linux  **
** OS       = 64Bits **
** ARCH     = armv8-a+crc **
** TUNE     = cortex-a72.cortex-a53 **
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o debug.o src/debug.c
gcc -c -march=armv8-a+crc -mtune=cortex-a72.cortex-a53 -fPIC -Wall -Werror -O3 -g -I/usr/include/lua5.3  -o ats.o src/ats.c
gcc -shared -Wl,-soname,ats.so.0 -llua5.3  -o ats.so.0.9 debug.o ats.o
Install Method: LuaRocks ..
SystemD Detected ..
Searching for Previous Install, and Remove it:
removed '/etc/ats.conf'
removed '/lib/systemd/system/ats.service'
removed '/usr/local/sbin/ats'
removed '/usr/local/lib/lua/5.3/ats.so'
removed '/usr/local/lib/lua/5.3/ats.so.0.9'
Install ATS Service File ..........: ats.service in '/usr/local/lib/luarocks/rocks/ats/master-0'
Install ATS Config ................: ats.config in '/usr/local/lib/luarocks/rocks/ats/master-0'
Install ATS Tool ..................: ats in '/usr/local/lib/luarocks/rocks/ats/master-0'
Install new ATS Library ...........: ats.so.0.9 in '/usr/local/lib/luarocks/rocks/ats/master-0'
Creating soname symLink ........: ats.so in '/usr/local/lib/luarocks/rocks/ats/master-0'
Creating Service symLink .......: ats.service in '/lib/systemd/system'
Creating Binary symLink ........: ats in '/usr/local/sbin/ats'
Creating Config symLink ........: ats.conf in '/etc/ats.conf'
Creating SharedObject symLink ..: ats.so.0.9 in '/usr/local/lib/lua/5.3'
Created symlink /etc/systemd/system/ats.service → /usr/local/lib/luarocks/rocks/ats/master-0/ats.service.
Starting ATS Service..
● ats.service - ATS - Active Thermal Service
     Loaded: loaded (/usr/local/lib/luarocks/rocks/ats/master-0/ats.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-12-22 20:34:51 CET; 37ms ago
   Main PID: 23816 (lua)
      Tasks: 1 (limit: 4463)
     Memory: 424.0K
        CPU: 14ms
     CGroup: /system.slice/ats.service
             └─23816 lua /usr/local/sbin/ats

Dec 22 20:34:51 DietPi systemd[1]: Started ATS - Active Thermal Service.
ats master-0 is now installed in /usr/local (license: See License..)

root@DietPi:~#

Checking Status:

root@DietPi:~# systemctl status ats
● ats.service - ATS - Active Thermal Service
     Loaded: loaded (/usr/local/lib/luarocks/rocks/ats/master-0/ats.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-12-22 20:34:51 CET; 54s ago
   Main PID: 23816 (lua)
      Tasks: 1 (limit: 4463)
     Memory: 328.0K
        CPU: 16ms
     CGroup: /system.slice/ats.service
             └─23816 lua /usr/local/sbin/ats

Dec 22 20:34:51 DietPi systemd[1]: Started ATS - Active Thermal Service.
root@DietPi:~#

ATS is running…!

Seems the editing of /etc/ats.conf isn’t nessecary anymory?

        ---  Assigning SysFs Locations for control..
        --
        -- CPU Thermal Zone[ String ]
        THERMAL0_CTL    = {
                        "/sys/class/thermal/thermal_zone0/temp"
        },
        -- GPU Thermal Zone[ String ]
        THERMAL1_CTL    = {
                        "/sys/class/thermal/thermal_zone1/temp"
        },
        -- FAN Control[ String ]
        PWM_CTL         = {
                        "/sys/class/hwmon/hwmon0/pwm1",
                        "/sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1",
                        "/sys/devices/platform/pwm-fan/hwmon/hwmon1/pwm1",
                        "/sys/devices/platform/pwm-fan/hwmon/hwmon2/pwm1",
                        "/sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1"
        },

My Fan is off now…

dietpi-banner 1



─────────────────────────────────────────────────────
 DietPi v7.9.3 : 20:53 - Wed 12/22/21
 ─────────────────────────────────────────────────────
 - Device model : ROCKPro64 (aarch64)
 - CPU temp : 31 °C / 87 °F : Cool runnings
 - LAN IP : X.X.X.X (eth0)
 - MOTD : WARNING: Learn whether your system is affected by the
          Java Log4j vulnerability CVE-2021-44228 and how to mitigate:
          https://dietpi.com/blog/?p=1172
 ─────────────────────────────────────────────────────

 DietPi Team     : MichaIng (lead), Daniel Knight (founder), Joulinar (support)
 Image by        : DietPi Core Team (pre-image: Armbian)
 Web             : https://dietpi.com | https://twitter.com/DietPi_
 Patreon Legends : Camry2731
 Contribute      : https://dietpi.com/contribute.html
 DietPi Hosting  : Powered by https://myvirtualserver.com

 dietpi-launcher : All the DietPi programs in one place
 dietpi-config   : Feature rich configuration tool for your device
 dietpi-software : Select optimised software for installation
 htop            : Resource monitor
 cpu             : Shows CPU information and stats

root@DietPi:/#

Hi,

it seems that ‘ats’ doesn’t autostart after booting…

How to autostart ats via

/var/lib/dietpi/dietpi-autostart/custom.sh

?

Is the following correct?

service ats start

did you enabled the service to be started on boot?

systemctl enable ats

Jep, as it ships an own systemd unit (doesn’t it?), no need to start via via custom.sh (which would require to enable the dietpi-autostart option). Use systemctl as Joulinar suggested, to also start it in the same turn (without reboot):

systemctl enable --now ats

Thx guys for your replies
Wil have a look next year, something less then 3 hours before 2021 here in The Netherlands

:wink:

Same on us locate next to you (Germany) :stuck_out_tongue:

Hi neighbours :wink:

deleted the line in custom.sh and added

systemctl enable --now ats

Happy Newyear
Frohes neues Jahr
Gelukkig Nieuwjaar

Have a great and healthy DietPi 2022 !

Usually it should be enough to execute systemctl enable --now ats once, as it will enable the service to start on boot automatically.

previous I started it with

service ats start

therefore it didnt autostart