Automatic Kernel Control of NanoPi M4 / M4V2 Metal Case Fan


 Share

1 1

Recommended Posts

So, I was doing some reading on how to control PWM fans under Linux. The lm-sensors package has a fancontrol script, but pwmconfig doesn't recognize the PWM devices on my NanoPi M4V2. There's also this repository which has a pwm-fan service, which might be the same one that Friendly Desktop uses (referenced in this post).

 

But then I found this rather interesting link from the Kobol guys: https://wiki.kobol.io/helios4/pwm/. Apparently the Linux kernel has built-in thermal control and user space scripting isn't even required, just editing the Device Tree.

 

But as we have easy user overlays for the RK3399, let's go ...

 

tparys@m4v2:~$ sudo armbian-add-overlay nanopi-m4-fan.dts 
Compiling the overlay
Copying the compiled overlay file to /boot/overlay-user/
Reboot is required to apply the changes

 

... or manually compile via DTC and copy to /boot/overlay-user, update /boot/armbianEnv.txt. Whichever makes you happy.

 

Seems to work well with the metal case I have for my M4V2 and NVME hat. Don't have a SATA hat, but if uses the same PWM pins, it should work there as well. No separate userspace package or SystemD service, and it should even kick in if the system gets stuck in boot (SystemD emergency mode).

 

Probably several improvements that could be made:

  1. Fan is currently triggered only by CPU temperature, not GPU.
  2. The fan replaces the first CPU trip point, which looks like it scales back the two big CPU cores. Not sure if this still needed.
  3. PWM frequency (40000) is a total guess. Better period to use?
  4. I don't see a much fan speed difference between cooling states 1-3. They should be 25, 50, and 100%, but all sound the same. Might have missed something.

 

Would be interested to hear any thoughts/feedback or if it's useful to anyone else.

 

nanopi-m4-fan.dts

Link to post
Share on other sites

Donate and support the project!

6 hours ago, tparys said:

But, I spun up several jobs, the kernel pegged the fan shortly after, and after a few minutes got up to just over 60 C.

This is only feeling and guesswork. I don't have your device model so can't check your setup by myself. Hence my request for a tmon log to see what is really going on. But if you are satisfied with your results, I have no further request and stop my curiosity.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

1 1