tuxd3v / ats

91 stars 12 forks source link

Bug: fan not spinning #31

Closed dfilan closed 1 year ago

dfilan commented 2 years ago

Have installed ats on my Rock64, running Armbian 22.05 Jammy, and am having trouble getting the fan to spin. The fan I'm using is the one that comes with this case, and it spins when I connect it to a battery. One possible issue is that I had to manually add an entry for PWM_CTL: running sudo find /sys -name pwm\*, I get:

/sys/kernel/tracing/events/pwm
/sys/kernel/tracing/events/pwm/pwm_apply
/sys/kernel/tracing/events/pwm/pwm_get
/sys/kernel/debug/tracing/events/pwm
/sys/kernel/debug/tracing/events/pwm/pwm_apply
/sys/kernel/debug/tracing/events/pwm/pwm_get
/sys/kernel/debug/pwm
/sys/class/pwm
/sys/bus/platform/drivers/pwm-clock
/sys/bus/platform/drivers/pwm-regulator
/sys/firmware/devicetree/base/pinctrl/pwm1
/sys/firmware/devicetree/base/pinctrl/pwm1/pwm1-pin
/sys/firmware/devicetree/base/pinctrl/pwmir
/sys/firmware/devicetree/base/pinctrl/pwmir/pwmir-pin
/sys/firmware/devicetree/base/pinctrl/pwm2
/sys/firmware/devicetree/base/pinctrl/pwm2/pwm2-pin
/sys/firmware/devicetree/base/pinctrl/pwm0
/sys/firmware/devicetree/base/pinctrl/pwm0/pwm0-pin
/sys/firmware/devicetree/base/__symbols__/pwm0_pin
/sys/firmware/devicetree/base/__symbols__/pwm3
/sys/firmware/devicetree/base/__symbols__/pwm1
/sys/firmware/devicetree/base/__symbols__/pwm1_pin
/sys/firmware/devicetree/base/__symbols__/pwmir_pin
/sys/firmware/devicetree/base/__symbols__/pwm2_pin
/sys/firmware/devicetree/base/__symbols__/pwm2
/sys/firmware/devicetree/base/__symbols__/pwm0
/sys/firmware/devicetree/base/pwm@ff1b0030
/sys/firmware/devicetree/base/pwm@ff1b0020
/sys/firmware/devicetree/base/pwm@ff1b0010
/sys/firmware/devicetree/base/pwm@ff1b0000

My guess was that I should use /sys/firmware/devicetree/base/pinctrl/pwm1. So, when I run ats -t, I get:

info:'SYSTEM' Table
info:    'BOARD' Table
info:        'NAME' = ROCK64
info:        'CPU'  = RK3328
info:    'THERMAL0_CTL' = /sys/class/thermal/thermal_zone0/temp
info:    'THERMAL1_CTL' = ERROR
info:    'PWM_CTL'      = /sys/firmware/devicetree/base/pinctrl/pwm1
info:    'MAX_CONTINUOUS_THERMAL_TEMP' = 45
info:    'MIN_CONTINUOUS_THERMAL_TEMP' = 20
info:    'MAX_PWM' = 255
info:    'MIN_PWM' = 40
info:    'ALWAYS_ON' = false
info:    'PROFILE_NAME' = profile0
info:    'PROFILE'      = 0
info:'Pratio' timers
info:    'Pratio[ -20 - 20 [' = 0
info:    'Pratio[ 20 ]'       = 40
...
info:    'Pratio[ 45 ]'       = 255
info:    'Pratio[ 45 - 70 ['  = 255

(the temperature range is low so that the fan would definitely run if it was working) When I run this command, the fan doesn't spin. For what it's worth, here's the rest of the output of ats -t:

Stopping for[ seconds ]............... 3
CPU Temperature[ max 70 °C ].......... 0
GPU Temperature[ max 70 °C ].......... 0
Fan PWM Duty Cycle value[ 0 - 255 ]... 190
--------------------
Running for[ seconds ]................ 10
CPU Temperature[ max 70 °C ].......... 39
GPU Temperature[ max 70 °C ].......... 0
Fan PWM Duty Cycle value[ 0 - 255 ]... 0
--------------------

Any idea what might be wrong?

[EDIT: rewrote results of searching for pwm with sudo, also if it helps the kernel version is 5.10.63 (not the latest, because I needed to revert to get the USB 3.0 port working]

dfilan commented 2 years ago

Tried updating the kernel to see if that helped, but the fan still didn't start and there wasn't a difference in the results of running sudo find /sys -name pwm\*.

tuxd3v commented 1 year ago

hello dfilan, The Rock64 is a nice development board, but it doesn't have a socket to connect a Fan :( ATS usually is used with kernel module pwn-fan. Boards like RockPro64 have a socket dedicated to conect the Fan.

Because your board doesn't have a fan header, you will need to find other ways to control the fan, maybe building a small circuit like this one: https://github.com/tuxd3v/pwm_driver

But I don't know how you could get the pwm control, via gpio.. :(