Tool to Control Fan - fanctl
Hi,

My issue seems to be quite similar to the last solved issue in the thread, but I didn't succeed to follow the steps.

I got my 80 mm fan in the RockPro64 with the NASCase. After I started the computer, the fan didn't spin (the case is getting really warm tho.). So I looked around and found this tool that may solve my issue.

I installed OMV on the Pro according to the steps on the wiki (on my SD card). Then I tried to install ATS according to the steps on the github (automatically). But the service wouldn't start.

Code:
root@rockpro64:/# 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
Remove previous ATS Library .......: ats.so.* from /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
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 Mon 2019-07-01 16
:25:03 CEST; 865ms ago
 Process: 26146 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
Main PID: 26146 (code=exited, status=1/FAILURE)
     CPU: 14ms

Jul 01 16:25:03 rockpro64 systemd[1]: ats.service: Failed with result 'exit-code'.
Makefile:103: recipe for target 'install' failed
make: *** [install] Error 3

Error: Build error: Failed installing.

So my question is twofold. 1. How do I get my fan working? and if ATS is the solution for this: 2. How do I get ATS working?

All the best,

P.S If the fan doesn't work out of the box, how to get it working should really be mentioned in the wiki!

P.P.S OMV version 4.1.23-1 (Arrakis)
Kernel: Linux 4.4.132-1075-rockchip-ayufan-ga83beded8524
  Reply
(06-30-2019, 08:12 PM)TheSupercomputer Wrote: EDIT: With "always on" option I got the behavior i was expected, exept for that if the minimum temp is reached ats produces an load spike pushing the temp above the minimum so the fan will speed up, slow down until near stop and spin up again.

Hello TheSupercomputer,
If you push the board at full throttle, temps could be above 50C, but that's a normal behaviour, also you can tune that in '/etc/ats.conf'.

Each time you change '/etc/ats.conf', you need to restart the service, don't forget that..

Here is a output, of mine, at full throttle..

You can see all cores are at 100%..they are like that for one year, testing ATS tool..
and there you can see the CPU Utilisation of ATS since last restart:
Code:
# ps -L -F -p 585
UID        PID  PPID   LWP  C NLWP    SZ   RSS PSR STIME TTY          TIME CMD
root       585     1   585  0    1   866  1516   2 May29 ?        00:00:28 lua /usr/local/sbin/ats

 It have 28 seconds of CPU used since that time, which translate to to approximately:
Code:
# Time of ATS Process( 28 seconds, running for 33 days )
~# ps -L -F -p 585
UID        PID  PPID   LWP  C NLWP    SZ   RSS PSR STIME TTY          TIME CMD
root       585     1   585  0    1   866  1516   2 May29 ?        00:00:28 lua /usr/local/sbin/ats

# Usage per each CPU Second Time( 1 second = 1000000 microseconds ):
~# bc -l <<<'28/(33*24*3600)'
.00000982042648709315 ( ~ 9.82042648709315 microseconds )

# Normalised usage in %( 1000000 microseconds = 100 % ):
~# bc -l <<<'(9.82042648709315/1000000)*100'
.00098204264870931500
So ATS is using ~ 0.00098%, or roughly ~0.001% CPU Time..
 
I haven't detected that spikes ever( you could have a increase if you are in test mode, because it needs to pint out information, and such.. but in daemon mode that shouldn't happen.. ).

My Suggestion, is to stop ATS( do it several times..like bellow ), reload units and then start it again...it could be that a previous unit is trying to restart a service that doesn't exist any more( this situation I have already experienced.. )

Code:
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl daemon-reload;
systemctl start ats;

Then check if everything is ok, and no more spikes..  Shy

Best Regards,
  Reply
My Rock is running now for roughly 8 Hours, HTOP give me for CPU Time used by ats 3:09.30, thats  more than 3 Minutes.

My configuration of ats is following:


Code:
MAX_CONTINOUS_TERMAL_TEMP = 60
MIN_CONTINOUS_TERMAL_TEMP = 35
MAX_PWM = 255
MIN_PWM = 30
ALWAYS_ON = true

Every time the temp drops below 35 degrees ats produces a spike that pushes the temp above this limit, so the fan will ramp up, settle down and ramps up again.
Instead of just topping as I would expect.

Max CPU usage of ats was 48.5% (So far what I could see with HTOP) while temp was below MIN_CONTINOUS_TERMAL_TEMP.
Because of these load spikes while every else is Idle the temp will naturally rise and if this happened ats works just fine, but as soon as the temp drops ats acts wired.

As I was in test mode (before this current start of the system) I could see, that as soon es the temp drops below the min limit ats requests really fast the temp, the terminal impressiv was scrolling, but as soon as the temp was high enough the normal working output was seen.

EDIT:
After a night in idle the CPU Time consumed by ats is now 4:13 hours, run time of the RockPro64 is now 22 Hours.
  Reply
(07-01-2019, 03:58 PM)TheSupercomputer Wrote: EDIT:
After a night in idle the CPU Time consumed by ats is now 4:13 hours, run time of the RockPro64 is now 22 Hours.

Humm,
Something could by messy there..

Can you post the output of:
Code:
ps -L -F -p $(pidof lua)

and also:
Code:
uname -a

Best Regards,
  Reply
Code:
ps -L -F -p $(pidof lua)
UID        PID  PPID   LWP  C NLWP    SZ   RSS PSR STIME TTY          TIME CMD
root       591     1   591 15    1   869   564   2 Jul01 ?        04:32:55 lua /
rock64@rockpro64:~$ uname -a
Linux rockpro64 4.4.167-1213-rockchip-ayufan-g34ae07687fce #1 SMP Tue Jun 18 20:44:49 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

Here are the informations.
  Reply
(07-02-2019, 01:31 PM)TheSupercomputer Wrote:
Code:
ps -L -F -p $(pidof lua)
UID        PID  PPID   LWP  C NLWP    SZ   RSS PSR STIME TTY          TIME CMD
root       591     1   591 15    1   869   564   2 Jul01 ?        04:32:55 lua /
rock64@rockpro64:~$ uname -a
Linux rockpro64 4.4.167-1213-rockchip-ayufan-g34ae07687fce #1 SMP Tue Jun 18 20:44:49 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

Here are the informations.

Hello TheSupercomputer,
Something is very wrong there..

I Advise you, to stop that service, it is heating your CPU..
1) do this:
Code:
sudo echo $HOSTNAME && lsb_release -a && systemctl status ats && ats --test && systemctl stop ats && journalctl -u ats;

2) Does to have done this, before?
Code:
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl stop ats;sleep 2;
systemctl daemon-reload;
systemctl start ats;

Best Regards,
  Reply
I killed ats in the night with successfully with:

Code:
sudo service ats stop


After a fresh start with:

Code:
sudo service ats start


Your command gives me following output:


Code:
rock64@rockpro64:~$ sudo echo $HOSTNAME && lsb_release -a && systemctl status ats && ats --test && systemctl stop ats && journalctl -u ats;
[sudo] password for rock64:
rockpro64
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
��� ats.service - ATS - Active Thermal Service
  Loaded: loaded (/lib/systemd/system/ats.service; enabled; vendor preset: enab
  Active: active (running) since Wed 2019-07-03 12:59:16 CEST; 1min 58s ago
Main PID: 13266 (lua)
   Tasks: 1 (limit: 4640)
  CGroup: /system.slice/ats.service
          ������13266 lua /usr/local/sbin/ats

Jul 03 12:59:16 rockpro64 systemd[1]: Started ATS - Active Thermal Service.


The fan acts the same as before and there seems to be only one task.
  Reply
(07-01-2019, 08:28 AM)kromsam Wrote: Hi,

My issue seems to be quite similar to the last solved issue in the thread, but I didn't succeed to follow the steps.

I got my 80 mm fan in the RockPro64 with the NASCase. After I started the computer, the fan didn't spin (the case is getting really warm tho.). So I looked around and found this tool that may solve my issue.

I installed OMV on the Pro according to the steps on the wiki (on my SD card). Then I tried to install ATS according to the steps on the github (automatically). But the service wouldn't start.

Code:
root@rockpro64:/# 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
Remove previous ATS Library .......: ats.so.* from /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
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 Mon 2019-07-01 16
:25:03 CEST; 865ms ago
 Process: 26146 ExecStart=/usr/local/sbin/ats (code=exited, status=1/FAILURE)
Main PID: 26146 (code=exited, status=1/FAILURE)
     CPU: 14ms

Jul 01 16:25:03 rockpro64 systemd[1]: ats.service: Failed with result 'exit-code'.
Makefile:103: recipe for target 'install' failed
make: *** [install] Error 3

Error: Build error: Failed installing.

So my question is twofold. 1. How do I get my fan working? and if ATS is the solution for this: 2. How do I get ATS working?

All the best,

P.S If the fan doesn't work out of the box, how to get it working should really be mentioned in the wiki!

P.P.S OMV version 4.1.23-1 (Arrakis)
Kernel: Linux 4.4.132-1075-rockchip-ayufan-ga83beded8524

Did I offer enough info? I also brought this issue to Pine support, but they send me to the forum. I really hope someone can help me out.
  Reply
I may found the bug, the Problem is following:

If you select "Always on" the fan runs continuously between min and max continuous temp , as expected . (It's not so annoying as the start stop cycles if this option is set to false)

But if you drop under the min_thermal temp ats will try to run the fan for no time and also waits for no time.
So ats will refresh the temp readings and the pmw settings as fast as it can causing the load spikes I see.
  Reply
(07-05-2019, 12:39 PM)TheSupercomputer Wrote: I may found the bug, the Problem is following:

If you select "Always on" the fan runs continuously between min and max continuous temp , as expected . (It's not so annoying as the start stop cycles if  this option is set to false)

But if you drop under the min_thermal temp ats will try to run the fan for no time and also waits for no time.
So ats will refresh the temp readings and the pmw settings as fast as it can causing the load spikes I see.

Hello TheSupercomputer,
It was not necessarily a problem, depending were you live  Smile
The idea behind it was to heat up the CPU until a "comfortable temperature"..

Depending on the region of the globe you live in..
Since the CPU should not be operated bellow -20C.. and spikes of around 20-30C up in that region in less than a second is not very good( imagine launching 6 threads at full throttle there.. )..
So it was a 'warming up' feature( But above 10C I think it makes less sense to have it.. )

I changed it for temps >= 10C


 Please install from the master branch, and give some feed-back  Shy
Code:
luarocks build https://raw.githubusercontent.com/tuxd3v/ats/master/ats-master-0.rockspec

(07-03-2019, 09:43 AM)kromsam Wrote: Did I offer enough info? I also brought this issue to Pine support, but they send me to the forum. I really hope someone can help me out.

Hello kromsam,
Sorry for that, I din't saw it  Blush
You need at least, kernel   4.4.132-1083,

Do this:
Code:
sudo apt-get update
sudo apt-get install linux-image-4.4.138-1097-rockchip-ayufan-gb5128c0a1684
sudo apt-get install linux-headers-4.4.138-1097-rockchip-ayufan-gb5128c0a1684
sudo apt-get install linux-firmware-image-4.4.138-1097-rockchip-ayufan-gb5128c0a1684
sudo reboot

After that you should be fine  Shy
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PWM Fan Control Python Script superbox 0 1,269 02-04-2022, 10:02 PM
Last Post: superbox

Forum Jump:


Users browsing this thread: 6 Guest(s)