Tool to Control Fan - fanctl
Hello deathisunknown,

I don't see nothing wrong with the compilation process, maybe a install problem on DietPi of the service...maybe.
Or something else..  Shy

To make sure, before going further, please paste the output of:
Code:
journalctl -u ats|tail -n 15

Also:
Code:
find /sys -name temp -o -name pwm1 -o -name pwm


In any case, when if you stop the service:
Code:
systemctl stop ats

And run it by hand:
Code:
ats -t

Does it run?
  Reply
(05-18-2019, 03:57 AM)tuxd3v Wrote: To make sure, before going further, please paste the output of:
Code:
journalctl -u ats|tail -n 15

Code:
root@RockPro:~# journalctl -u ats
May 18 20:10:00 RockPro systemd[1]: Started ATS - Active Thermal Service.
May 18 20:10:00 RockPro ats[25059]: getConditions: Warning, Values { THERMAL0_CTL, THERMAL1_CTL, FAN_CTL }: /sys/class/thermal/thermal_zone0/temp, /sys/class/thermal/thermal_zone1/temp, ERROR
May 18 20:10:00 RockPro ats[25059]: exit 1
May 18 20:10:00 RockPro systemd[1]: ats.service: Main process exited, code=exited, status=1/FAILURE
May 18 20:10:00 RockPro systemd[1]: ats.service: Unit entered failed state.
May 18 20:10:00 RockPro systemd[1]: ats.service: Failed with result 'exit-code'.

(05-18-2019, 03:57 AM)tuxd3v Wrote: Also:
Code:
find /sys -name temp -o -name pwm1 -o -name pwm

Code:
root@RockPro:~# find /sys -name temp -o -name pwm1 -o -name pwm
/sys/kernel/debug/pwm
/sys/class/pwm
/sys/devices/platform/ff420020.pwm/pwm
/sys/devices/platform/ff420010.pwm/pwm
/sys/devices/platform/ff420000.pwm/pwm
/sys/devices/virtual/thermal/thermal_zone0/temp
/sys/devices/virtual/thermal/thermal_zone1/temp
/sys/firmware/devicetree/base/pinctrl/pwm1
/sys/firmware/devicetree/base/__symbols__/pwm1

(05-18-2019, 03:57 AM)tuxd3v Wrote: In any case, when if you stop the service:
Code:
systemctl stop ats

And run it by hand:
Code:
ats -t

Does it run?

Code:
root@RockPro:~# systemctl stop ats
root@RockPro:~# ats -t
getConditions: Warning, Values { THERMAL0_CTL, THERMAL1_CTL, FAN_CTL }: /sys/class/thermal/thermal_zone0/temp, /sys/class/thermal/thermal_zone1/temp, ERROR
exit 1

Thanks tuxd3v!
  Reply
(05-18-2019, 04:16 AM)deathisunknown Wrote:
Code:
root@RockPro:~# systemctl stop ats
root@RockPro:~# ats -t
getConditions: Warning, Values { THERMAL0_CTL, THERMAL1_CTL, FAN_CTL }: /sys/class/thermal/thermal_zone0/temp, /sys/class/thermal/thermal_zone1/temp, ERROR
exit 1

Thanks tuxd3v!

You Welcome.  Shy
Seems that you don't have the hwmon sysfs subsystem.. maybe you haven't configured it on kernel compilation?

This is an output of my config for it:
Code:
root@rockpro64:~# zgrep "HWMON" /proc/config.gz
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_HWMON_DEBUG_CHIP is not set
# CONFIG_SENSORS_IIO_HWMON is not set
CONFIG_THERMAL_HWMON=y

I have it set, and I can control pwm via sysfs in:
/sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1


Have you compiled that kernel yourself?
If so configure hwmon to 'Yes' like above:
Code:
CONFIG_HWMON=y
CONFIG_THERMAL_HWMON=y

After that, ATS will start to work  Shy
Regards
  Reply
Thank you for sharing this tool. 
However I've some troubles, the build fails for me with an error I don't understand. Looks like something with systemctl?


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
Failed to enable unit: Unit file ats.service does not exist.
Makefile:103: recipe for target 'install' failed
make: *** [install] Error 1

Error: Build error: Failed installing.
root@rockpro64:~# uname -a
Linux rockpro64 4.4.132-1075-rockchip-ayufan-ga83beded8524 #1 SMP Thu Jul 26 08:22:22 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
root@rockpro64:~# cat /etc/issue
Ubuntu 18.04.1 LTS \n \l

root@rockpro64:~# which lua
/usr/bin/lua
root@rockpro64:~# /usr/bin/lua -v
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
root@rockpro64:~# 


I should have PWM enabled (at least I think so).


Code:
root@rockpro64:~# ls /sys/class/pwm/pwmchip0/
device  export  npwm  power  subsystem  uevent  unexport
root@rockpro64:~# zegrep "PWM" /proc/config.gz 
CONFIG_ROCKCHIP_REMOTECTL_PWM=y
# CONFIG_INPUT_PWM_BEEPER is not set
# CONFIG_SENSORS_PWM_FAN is not set
CONFIG_REGULATOR_PWM=y
CONFIG_BACKLIGHT_PWM=y
# CONFIG_LEDS_PWM is not set
# CONFIG_COMMON_CLK_PWM is not set
CONFIG_PWM=y
CONFIG_PWM_SYSFS=y
# CONFIG_PWM_CROS_EC is not set
# CONFIG_PWM_FSL_FTM is not set
# CONFIG_PWM_GPIO is not set
# CONFIG_PWM_PCA9685 is not set
CONFIG_PWM_ROCKCHIP=y
# CONFIG_PWM_ROCKCHIP_I2S is not set
root@rockpro64:~# 

Thanks!
  Reply
Hello tikonen,
 You need a kernel at least >= 4.4.132-1083..

It seems that you have everything in place.., but you need a supported kernel..


This one works:
Code:
Code:
apt-get update
apt-get install linux-image-4.4.138-1097-rockchip-ayufan-gb5128c0a1684 linux-headers-4.4.138-1097-rockchip-ayufan-gb5128c0a1684 linux-firmware-image-4.4.138-1097-rockchip-ayufan-gb5128c0a1684
reboot


After rebooting,
Check if the service is up and running  [Image: shy.png]
  Reply
Here is my output:
Code:
root@RockPro:~# zgrep "HWMON" /proc/config.gz
CONFIG_HWMON=y
# CONFIG_HWMON_DEBUG_CHIP is not set
# CONFIG_SENSORS_IIO_HWMON is not set
CONFIG_THERMAL_HWMON=y
CONFIG_RTC_DRV_DS3232_HWMON=y

I have not compiled the kernel myself. I downloaded it from ayufan's repo here: https://github.com/ayufan-rock64/linux-m...105-ayufan

Thanks for your continued help tuxd3v!
  Reply
hello deathisunknown,
You Welcome!
I am not using mainline,

This should print the sysfs file..
"find /sys -name \*pwm\* -type f"

Can you also do a:
"uname -a"
  Reply
Hi tuxd3v,

Here is the output from the commands you requested:

Code:
root@RockPro:~# find /sys -name \*pwm\* -type f
/sys/kernel/debug/pwm
/sys/devices/platform/ff420020.pwm/pwm/pwmchip2/npwm
/sys/devices/platform/ff420010.pwm/pwm/pwmchip1/npwm
/sys/devices/platform/ff420000.pwm/pwm/pwmchip0/npwm
/sys/firmware/devicetree/base/pwm@ff420020/#pwm-cells
/sys/firmware/devicetree/base/pwm@ff420010/#pwm-cells
/sys/firmware/devicetree/base/pwm@ff420000/#pwm-cells
/sys/firmware/devicetree/base/vdd-log/pwms
/sys/firmware/devicetree/base/vdd-log/pwm-supply
/sys/firmware/devicetree/base/pwm-fan/pwms
/sys/firmware/devicetree/base/__symbols__/vop0_pwm_pin
/sys/firmware/devicetree/base/__symbols__/pwm3a_pin
/sys/firmware/devicetree/base/__symbols__/pwm0_pin
/sys/firmware/devicetree/base/__symbols__/pwm3
/sys/firmware/devicetree/base/__symbols__/pwm3b_pin
/sys/firmware/devicetree/base/__symbols__/pwm1
/sys/firmware/devicetree/base/__symbols__/pwm1_pin
/sys/firmware/devicetree/base/__symbols__/pwm1_pin_pull_down
/sys/firmware/devicetree/base/__symbols__/vop1_pwm_pin
/sys/firmware/devicetree/base/__symbols__/pwm2_pin
/sys/firmware/devicetree/base/__symbols__/pwm2
/sys/firmware/devicetree/base/__symbols__/pwm2_pin_pull_down
/sys/firmware/devicetree/base/__symbols__/pwm0
/sys/firmware/devicetree/base/__symbols__/pwm0_pin_pull_down
/sys/firmware/devicetree/base/pwm@ff420030/#pwm-cells

Code:
root@RockPro:~# uname -a
Linux RockPro 5.0.0-rockchip64 #5.85 SMP Wed May 8 19:38:28 CEST 2019 aarch64 GNU/Linux

Thanks again!
  Reply
Hi,

I updated the kernel but install still fails with the same error, maybe earlier install attempt broke something? 


Code:
rock64@rockpro64:~$ find /sys -name "*pwm*" -type f
/sys/devices/platform/ff420020.pwm/pwm/pwmchip0/npwm
/sys/firmware/devicetree/base/pwm@ff420000/#pwm-cells
/sys/firmware/devicetree/base/pwm@ff420010/#pwm-cells
/sys/firmware/devicetree/base/pwm@ff420020/#pwm-cells
/sys/firmware/devicetree/base/pwm@ff420030/remote_pwm_id
/sys/firmware/devicetree/base/pwm@ff420030/#pwm-cells
/sys/firmware/devicetree/base/rockchip-suspend/rockchip,pwm-regulator-config
/sys/firmware/devicetree/base/voppwm@ff9001a0/#pwm-cells
/sys/firmware/devicetree/base/voppwm@ff8f01a0/#pwm-cells
/sys/firmware/devicetree/base/vdd-log/pwms
/sys/firmware/devicetree/base/vdd-log/rockchip,pwm_voltage
/sys/firmware/devicetree/base/vdd-log/pwm-supply
/sys/firmware/devicetree/base/vdd-log/rockchip,pwm_id
find: '/sys/kernel/debug': Permission denied

rock64@rockpro64:~$ sudo 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
Failed to enable unit: Unit file ats.service does not exist.
Makefile:103: recipe for target 'install' failed
make: *** [install] Error 1

Error: Build error: Failed installing.

rock64@rockpro64:~$ uname -a
Linux rockpro64 4.4.138-1097-rockchip-ayufan-gb5128c0a1684 #1 SMP Sat Sep 29 15:08:06 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
rock64@rockpro64:~$ 
  Reply
Hello tikonen,

You need to install the tool has root..
  Reply


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

Forum Jump:


Users browsing this thread: 9 Guest(s)