Fan/Thermal Trip Points and Fan Speed?

Post Reply
Groove On
Posts: 19
Joined: Thu Sep 21, 2017 12:12 pm
languages_spoken: english
ODROIDs: Odroid N2+
Has thanked: 6 times
Been thanked: 2 times
Contact:

Fan/Thermal Trip Points and Fan Speed?

Post by Groove On »

Hi,
I live in hot tropical weather and I'd like my fan to turn on earlier than the default trip_point (65 deg Celsius). (My ambient temperature is 35-40 deg Celsius).

Questions:
1. Why are there 7 thermal trip point temperature settings? How many do I actually need to set for the Odroid N2+?
2. If I'd like to turn my on fan earlier than the defaults, which one should I set - or does it matter?
3. How are the trip points related to the fan_speed settings? (I'm using the fan for the N2+ from Hard Kernel)

Trip Points / Fan Speed settings:
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp
65000
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_1_temp
75000
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_2_temp
95000
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp
110000
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp
65000
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_5_temp
75000
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_6_temp
60000
cat /sys/devices/platform/pwm-fan/hwmon/hwmon0/fan_speed
0 120 170 220

Groove On
Posts: 19
Joined: Thu Sep 21, 2017 12:12 pm
languages_spoken: english
ODROIDs: Odroid N2+
Has thanked: 6 times
Been thanked: 2 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by Groove On »

This Odroid WIKI seems to explain it for the XU4, hopefully it's also true for the N2+.
https://wiki.odroid.com/odroid-xu4/appl ... ol_the_fan

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

Groove On wrote:
Sun Mar 28, 2021 5:57 pm
This Odroid WIKI seems to explain it for the XU4, hopefully it's also true for the N2+.
https://wiki.odroid.com/odroid-xu4/appl ... ol_the_fan
Which OS are you running?
What's the output of uname -a?

Groove On
Posts: 19
Joined: Thu Sep 21, 2017 12:12 pm
languages_spoken: english
ODROIDs: Odroid N2+
Has thanked: 6 times
Been thanked: 2 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by Groove On »

tobetter wrote:
Sun Mar 28, 2021 6:51 pm
Which OS are you running?
What's the output of uname -a?
OS
Ubuntu Minimal (from Hard Kernel)

uname -a
Linux odroid 4.9.241-113 #1 SMP PREEMPT Wed Mar 17 18:56:00 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

Groove On wrote:
Mon Mar 29, 2021 1:36 pm
tobetter wrote:
Sun Mar 28, 2021 6:51 pm
Which OS are you running?
What's the output of uname -a?
OS
Ubuntu Minimal (from Hard Kernel)

uname -a
Linux odroid 4.9.241-113 #1 SMP PREEMPT Wed Mar 17 18:56:00 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
Then, you can turn on the fan all the time. Add fanspeed-full to /media/boot/config.ini.

Code: Select all

overlays="spi0 i2c0 i2c1 uart0 fanspeed-full"
Your config.ini must be like this.
https://github.com/mdrjr/n2_bootini/blo ... ig.ini#L97
These users thanked the author tobetter for the post:
Groove On (Mon Mar 29, 2021 3:43 pm)

Groove On
Posts: 19
Joined: Thu Sep 21, 2017 12:12 pm
languages_spoken: english
ODROIDs: Odroid N2+
Has thanked: 6 times
Been thanked: 2 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by Groove On »

tobetter wrote:
Mon Mar 29, 2021 1:56 pm
Then, you can turn on the fan all the time. Add fanspeed-full to /media/boot/config.ini.

Code: Select all

overlays="spi0 i2c0 i2c1 uart0 fanspeed-full"
Your config.ini must be like this. https://github.com/mdrjr/n2_bootini/blo ... ig.ini#L97
Thank you, that worked, the fan is running full-speed and the computer is running better. My application uses the CPU aggressively and when the ambient temperature is near 40°C (mid-day), the Odroid N2+ needs extra cooling or I start to get errors.

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

Groove On wrote:
Mon Mar 29, 2021 3:39 pm
tobetter wrote:
Mon Mar 29, 2021 1:56 pm
Then, you can turn on the fan all the time. Add fanspeed-full to /media/boot/config.ini.

Code: Select all

overlays="spi0 i2c0 i2c1 uart0 fanspeed-full"
Your config.ini must be like this. https://github.com/mdrjr/n2_bootini/blo ... ig.ini#L97
Thank you, that worked, the fan is running full-speed and the computer is running better. My application uses the CPU aggressively and when the ambient temperature is near 40°C (mid-day), the Odroid N2+ needs extra cooling or I start to get errors.
Glad to know it works...By the way, are you running your N2 in the outdoor? 40°C it absolutly high... :geek:

Groove On
Posts: 19
Joined: Thu Sep 21, 2017 12:12 pm
languages_spoken: english
ODROIDs: Odroid N2+
Has thanked: 6 times
Been thanked: 2 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by Groove On »

tobetter wrote:
Mon Mar 29, 2021 3:56 pm
are you running your N2 in the outdoor? 40°C it absolutly high... :geek:
I'm in a tropical country and my air-conditioner broke. It will be a few more days until the replacement arrives :)

mmatus1112
Posts: 3
Joined: Thu Jul 29, 2021 6:57 am
languages_spoken: english
ODROIDs: Odroid N2+
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mmatus1112 »

I have the same issue, however, I am running Odroid N2+ with "home assistant". I live in Miami and it gets pretty darn hot, sometimes I feel the odroid needs more cooling. I have hooked the cooling fan but I never see it running. How can I lower the temperature at which it turns on?

Thank you!!!

User avatar
odroid
Site Admin
Posts: 38053
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2003 times
Been thanked: 1207 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by odroid »

@mmatus1112,
Because HomeAssistant OS uses their own development Kernel branch, we don't know if they support a PWM driver for cooling fan or not.
Post a question on their community forum.
https://community.home-assistant.io/

gilray4
Posts: 27
Joined: Wed Mar 20, 2019 8:33 am
languages_spoken: english
ODROIDs: XU-4
Has thanked: 0
Been thanked: 3 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by gilray4 »

I just got an N2+ (with optional cooling fan)

The fan does not work/spin, 'out of the box'
I parsed the forum and have tried this:

CNTRL+ALT+T
from terminal I input the cmd:
'sudo pluma' (when prompted I input my user passwd)

With pluma opened as 'superuser'/ file/open:

/sys/devices/virtual/thermal/thermal_zone0/'trip_point_4_temp'

I edit the default number from 65000 ~> 30000
The fan spins up and stays running for the duration of my session.
After a reboot the file / setting does not persist, it reverts back to 65000

Why ? What am I doing wrong that is causing the file/setting to not persist after a shut down or re-login ?

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

gilray4 wrote:
Sat Jul 31, 2021 3:56 am
I just got an N2+ (with optional cooling fan)

The fan does not work/spin, 'out of the box'
I parsed the forum and have tried this:

CNTRL+ALT+T
from terminal I input the cmd:
'sudo pluma' (when prompted I input my user passwd)

With pluma opened as 'superuser'/ file/open:

/sys/devices/virtual/thermal/thermal_zone0/'trip_point_4_temp'

I edit the default number from 65000 ~> 30000
The fan spins up and stays running for the duration of my session.
After a reboot the file / setting does not persist, it reverts back to 65000

Why ? What am I doing wrong that is causing the file/setting to not persist after a shut down or re-login ?
The files under /sys are volatile, they are not persist in the file system. So they will be gone after rebooting whatever you changed.
Instead, you could add the same command echo 30000 > /sys/devices/virtual/thermal/thermal_zone0/'trip_point_4_temp in /etc/rc.local.

Alternatively, you could try this if you want to make the fan spin up all the time.
viewtopic.php?p=325530#p325530

gilray4
Posts: 27
Joined: Wed Mar 20, 2019 8:33 am
languages_spoken: english
ODROIDs: XU-4
Has thanked: 0
Been thanked: 3 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by gilray4 »

Worked like a champ !

Ty Ty Ty

"Then, you can turn on the fan all the time. Add fanspeed-full to /media/boot/config.ini."

## overlays="spi0 i2c0 i2c1 uart0 fanspeed-full" ##

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

Huh. I've got interesting problem. Wanted to lower CPU fan threshold (so it turns on a least sometimes).

Code: Select all

root@Tomusiomat-ARM:/sys/devices/virtual/thermal/thermal_zone0# echo 45000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp
bash: /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp: Brak dostępu
root@Tomusiomat-ARM:/sys/devices/virtual/thermal/thermal_zone0# echo 45000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp
bash: /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp: Brak dostępu
("No access", I assume this means "Access denied")
How the hell root can't write its own files? :D
I tried to open these files as root, or using sudo, and it says these files are write only.

I run tobetter's Ubuntu 5.12.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
rooted
Posts: 8727
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 743 times
Been thanked: 376 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by rooted »

mctom wrote:Huh. I've got interesting problem. Wanted to lower CPU fan threshold (so it turns on a least sometimes).

Code: Select all

root@Tomusiomat-ARM:/sys/devices/virtual/thermal/thermal_zone0# echo 45000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp
bash: /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp: Brak dostępu
root@Tomusiomat-ARM:/sys/devices/virtual/thermal/thermal_zone0# echo 45000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp
bash: /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp: Brak dostępu
("No access", I assume this means "Access denied")
How the hell root can't write its own files? :D
I tried to open these files as root, or using sudo, and it says these files are write only.

I run tobetter's Ubuntu 5.12.
It means changing the points isn't enabled in the kernel.

Code: Select all

zcat /proc/config.gz | grep CONFIG_THERMAL_WRITABLE_TRIPS

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

Indeed. Thanks!

Code: Select all

mctom@Tomusiomat-ARM:~$ zcat /proc/config.gz | grep CONFIG_THERMAL_WRITABLE_TRIPS
# CONFIG_THERMAL_WRITABLE_TRIPS is not set
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

mctom wrote:
Wed Aug 04, 2021 8:44 pm
Indeed. Thanks!

Code: Select all

mctom@Tomusiomat-ARM:~$ zcat /proc/config.gz | grep CONFIG_THERMAL_WRITABLE_TRIPS
# CONFIG_THERMAL_WRITABLE_TRIPS is not set
Can you try this?
echo NUMBER | sudo tee PATH

User avatar
rooted
Posts: 8727
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 743 times
Been thanked: 376 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by rooted »

mctom wrote:Indeed. Thanks!

Code: Select all

mctom@Tomusiomat-ARM:~$ zcat /proc/config.gz | grep CONFIG_THERMAL_WRITABLE_TRIPS
# CONFIG_THERMAL_WRITABLE_TRIPS is not set
You're welcome, you can either pull the source and the config from proc, enable it and compile or just hit up @tobetter and he will enable it.

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

tobetter wrote:
Wed Aug 04, 2021 9:03 pm
Can you try this?
echo NUMBER | sudo tee PATH

Code: Select all

mctom@Tomusiomat-ARM:~$ echo NUMBER | sudo tee PATH
NUMBER
mctom@Tomusiomat-ARM:~$ sudo rm PATH
errr. :D

Code: Select all

mctom@Tomusiomat-ARM:~$ echo 45000 | sudo tee /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp
tee: /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp: Brak dostępu
45000

Code: Select all

mctom@Tomusiomat-ARM:~$ zcat /proc/config.gz | grep CONFIG_THERMAL_WRITABLE_TRIPS
# CONFIG_THERMAL_WRITABLE_TRIPS is not set
mctom@Tomusiomat-ARM:~$ uname -a
Linux Tomusiomat-ARM 5.12.0-odroid-arm64 #1 SMP PREEMPT Ubuntu 5.12.1-202105080719~hirsute (2021-05-07) aarch64 aarch64 aarch64 GNU/Linux
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

rooted wrote:
Wed Aug 04, 2021 9:29 pm
You're welcome, you can either pull the source and the config from proc, enable it and compile or just hit up @tobetter and he will enable it.
I guess I'll let @tobetter deal with that, I'm already drowning in open source initiatives. :D
Also, I think this should work for everyone, if that's sort of official kernel and supported functionality...
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

mctom wrote:
Wed Aug 04, 2021 10:53 pm
rooted wrote:
Wed Aug 04, 2021 9:29 pm
You're welcome, you can either pull the source and the config from proc, enable it and compile or just hit up @tobetter and he will enable it.
I guess I'll let @tobetter deal with that, I'm already drowning in open source initiatives. :D
Also, I think this should work for everyone, if that's sort of official kernel and supported functionality...
Ok, you got me!
These users thanked the author tobetter for the post:
mctom (Wed Aug 04, 2021 11:34 pm)

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

mctom wrote:
Wed Aug 04, 2021 10:53 pm
rooted wrote:
Wed Aug 04, 2021 9:29 pm
You're welcome, you can either pull the source and the config from proc, enable it and compile or just hit up @tobetter and he will enable it.
I guess I'll let @tobetter deal with that, I'm already drowning in open source initiatives. :D
Also, I think this should work for everyone, if that's sort of official kernel and supported functionality...
I believe the new kernel updates with CONFIG_THERMAL_WRITABLE_TRIPS are uploaded for 5.111/5.12/5.13. And another update with fanspeed-full.dtbo is on the way, I failed to push both patches to the same build queue.... :shock:
https://github.com/tobetter/linux/commi ... 92d3c77127
These users thanked the author tobetter for the post:
mctom (Thu Aug 05, 2021 3:33 pm)

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

Thanks a lot for your effort. :)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

mctom wrote:
Thu Aug 05, 2021 3:37 pm
Thanks a lot for your effort. :)
No problem...I wish your N2 enjoys this summer.

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

It peaked at 55 degrees yesterday, when I accidentally hogged CPU to 100% for extended period. The fan didn't turn on so I wanted to tweak it and keep temperature below 45 or something.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

Okay, so I understand the trip points 0-2 are used for CPU throttling or something (Can't say what trip point 2 does).
However there are two trip points, 3 and 4, that are both used by fan somehow. What exactly do they do?
I assume they are both for different fan PWM values. Can we tweak those as well?
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

mctom wrote:
Fri Aug 06, 2021 1:37 am
Okay, so I understand the trip points 0-2 are used for CPU throttling or something (Can't say what trip point 2 does).
However there are two trip points, 3 and 4, that are both used by fan somehow. What exactly do they do?
I assume they are both for different fan PWM values. Can we tweak those as well?
Tweak how? Want to change the PWM values for each trip points?

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

Yep, I'd like to try other PWM values. Having two steps would be nice, a quiet one at 45 and a royal blow at 55. :D
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

mctom wrote:
Fri Aug 06, 2021 3:25 am
Yep, I'd like to try other PWM values. Having two steps would be nice, a quiet one at 45 and a royal blow at 55. :D
The termperature of cooling point should be set in the device tree file, looks like there is nowhere in /sys to change the temperature.
This is what I've tested to to change the temperatures, 45 and 55 for the two cooling points, currently they are 65 and 75 in the stock device tree.

Code: Select all

diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
index 70ea1faad2ff..bfbf7b01f1ed 100644
--- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
@@ -4,6 +4,7 @@ dtbo-y += \
 	spi0.dtbo \
 	pwm_cd.dtbo \
 	pwm_ef.dtbo \
+	pwmfan-lowtemp.dtbo \
 	uart0.dtbo \
 	uart1.dtbo \
 	sx865x-i2c1.dtbo \
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwmfan-lowtemp.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwmfan-lowtemp.dts
new file mode 100644
index 000000000000..bfa41cb90395
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwmfan-lowtemp.dts
@@ -0,0 +1,20 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+	fragement@0 {
+		target = <&fan_0>;
+
+		__overlay__ {
+			temperature = <45000>;
+		};
+	};
+
+	fragement@1 {
+		target = <&fan_1>;
+
+		__overlay__ {
+			temperature = <55000>;
+		};
+	};
+};
For fun, since you are the maintainer of PiStackMon which is beautiful, you are able to set the fan speed in the user space if you write a service. Actually there is a tool a.k.a fancontrol but this does not work on ODROID-N2 since it requires fan tacho input whilist it works with ODROID-HC4.
https://docs.linuxfactory.or.kr/guides/sensors.html

Instead, you can use /sys/devices/platform/pwm-fan/hwmon/hwmon2/<pwm1_enable|pwm1> to control through the fan connector on ODROID-N2. By echoing 1 to /sys/devices/platform/pwm-fan/hwmon/hwmon2/pwm1_enable, the fan controller will switched to manual mode and the fan will spin at given PWM value through /sys/devices/platform/pwm-fan/hwmon/hwmon2/pwm1.

Code: Select all

echo 1 | sudo tee /sys/devices/platform/pwm-fan/hwmon/hwmon2/pwm1_enable
echo 128 | sudo tee /sys/devices/platform/pwm-fan/hwmon/hwmon2/pwm1
By default, the fan speed mode is automatic which runs the fan in given cooling map in the device tree. Also you can switch to full speed mode by echoing /sys/devices/platform/pwm-fan/hwmon/hwmon2/pwm1_enable.

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

Thanks for your explanation, and thanks for kind words about my little project. :)

I don't know much about device tree files, but since you presented the source code I assume that's something that ought be compiled to work.
Manual control of PWM could solve the issue for me, but I'd have to write a script for that, which again is not something I'm going after. After all the current CPU temperature is 35 degrees. :)

For the record, there is no pwm1_enable file in my hwmon2, and I cannot write or even touch such file. There's only pwm1, which assumes value of 0 when off and 220 when on.

I can write to pwm1 file and temporarily change fan pwm, then it's overwritten after a random few seconds by something else - probably that device tree thing.

So I did a short experiment and discovered there is a very subtle difference in fan performance for values between 30 and 255. Under 30, the fan makes funny noises, certainly nothing I'd accept. ;)

It seems that PWM cannot change the behavior of this particular fan. Decreasing duty cycle ("pwm value") will only cause the fan's internal controller to simply draw more current in short pulses to make up for the losses. If that theory is correct, I'd turn off PWM altogether in N2, because all it does is heating up the switching transistor.

About the PiStackMon, it has its own Fan PWM output - at least the hardware is ready for this task. Right now it's not supported by software - I didn't need it, and as far as I know there are just 3 or 4 other users of PiStackMon, the people that got the board with a few old Pis I was selling online. None of them got in touch, so I guess the blinking LEDs are all they wanted.
But if there was any demand for Fan PWM functionality, I'd definitely add it to daemon code, as another thread, going flip-flop at the user-defined frequency.

But yeah, I should definitely add support for N2/N2+ - just didn't see a point since I keep it under my desk. Sadly it won't work with XU4. :( C1/2/4 probably would work as well, but I don't have any.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
tobetter
Posts: 8391
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1323 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by tobetter »

mctom wrote:
Fri Aug 06, 2021 9:32 pm
Thanks for your explanation, and thanks for kind words about my little project. :)

I don't know much about device tree files, but since you presented the source code I assume that's something that ought be compiled to work.
Manual control of PWM could solve the issue for me, but I'd have to write a script for that, which again is not something I'm going after. After all the current CPU temperature is 35 degrees. :)
Yes, you need to compile the code to build a device tree overlay. Do you want me to add the file to the next kernel update?
For the record, there is no pwm1_enable file in my hwmon2, and I cannot write or even touch such file. There's only pwm1, which assumes value of 0 when off and 220 when on.

I can write to pwm1 file and temporarily change fan pwm, then it's overwritten after a random few seconds by something else - probably that device tree thing.
Why? Do you use Linux kernel 5.12? Then you cannot since I've not ported fan controller patch to the version and 5.12 is dropped. :)
So I did a short experiment and discovered there is a very subtle difference in fan performance for values between 30 and 255. Under 30, the fan makes funny noises, certainly nothing I'd accept. ;)
Stock fan for ODROID-N2 is not quite noisy, lower PWM under 100 is not efficient IMHO. :D

User avatar
mctom
Posts: 440
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: N2+, Game Advance, a few XU4
Location: Gdansk, Poland
Has thanked: 48 times
Been thanked: 41 times
Contact:

Re: Fan/Thermal Trip Points and Fan Speed?

Post by mctom »

tobetter wrote:
Fri Aug 06, 2021 9:51 pm
Yes, you need to compile the code to build a device tree overlay. Do you want me to add the file to the next kernel update?
If that'd be just for me then please don't. I don't feel like tinkering with "compilable" stuff on my main workhorse for now. :)
tobetter wrote:
Fri Aug 06, 2021 9:51 pm
Why? Do you use Linux kernel 5.12? Then you cannot since I've not ported fan controller patch to the version and 5.12 is dropped. :)
Well, I admit I wasn't paying much attention to new kernel lately. Gotta upgrade sometime, and the weekend is the best time to recover from troubles. :)
tobetter wrote:
Fri Aug 06, 2021 9:51 pm
Stock fan for ODROID-N2 is not quite noisy, lower PWM under 100 is not efficient IMHO. :D
Yeah, that makes me realize I don't need a fan on N2+ in the first place, and I was hoping that I could find a PWM setting that would actually work and be quieter than the usual 220. I guess this is not the case. :)
Right now my absolutely cool Sway top bar shows 34 degrees on CPU.. I switched to ondemand CPU governor recently, which also helped. Before that, the usual temperature was anywhere between 37 and 40. :)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 0 guests