How to enable the 2 pin header on RockPi 4c

Hi everyone

New post from a newbie!
I have searched for an answer but I am not finding any information so please forgive me if this question is already answered.

How do I enable the 2 pin header on the Rock Pi4c for fan connection?

The specification says it can be used with PWM, but I can only see how to enable PWM on the 40 pin connector. I will be using the 40 pin header so I want to transfer the fan to the 2 pin header.

Any help welcome!

Still need some help here !
I’m using image rock-4c-plus_debian_bullseye_kde_b55
But any pointers for other distros welcome

Thanks

I have seen posts on pwm use on other boards. There are two disabled rk3399-pwm*dto files in /boot. You might start there. And I think in rock 5b boards either in this forum or discord , there are instructions on implementing a script and “pwm curve” that may apply to this as well. I don’t use it, i just connect to 5v / grnd pins on gpio and let it run full on. The NAS, 3d printer, work laptop dans, tv, music or other usually drown out that annoying fan noise. LOL

Thanks for the reply - will check that out

I checked out the links and started looking at the directories in Debian and I am probably more confused than before!

To ask a simpler question…can I enable 5v on the 2pin header?

In other words forget PWM for the moment.

Finally I have a solution after some research, hints from other models and some experimentation.

I have two small fans connected to the 2 pin header and I can control by writing to
/sys/class/thermal/cooling_device2/cur_state
0 off, 1 single fan runs, 2 both fans run quiet, 3 both fans full speed

Writing with sudo nano worked but the change was not persistent and reset after boot.
Tried using echo in a bash script to run at startup but hit permissions errors.

Solution was adding a udev rule:
/etc/udev/rules.d/02-radxa-fan.rules
ACTION==“add|change”, KERNEL==“cooling_device2”, SUBSYSTEM==“thermal”, ATTR{cur_state}=“3”

The fans now start on boot and stop on exit

Some useful commands that may be obvious to others but were not to me…
Test rule: sudo udevadm test /sys/class/thermal/cooling_device2
Start rules: sudo udevadm trigger or sudo udevadm control --reload
Check attributes: udevadm info -a /sys/class/thermal/cooling_device2

1 Like