Dietpi 3705 fan suuport i2c

Which Khadas SBC do you use?

Vim3 Pro

Which system do you use? Android, Ubuntu, OOWOW or others?

Debian

Which version of system do you use? Khadas official images, self built images, or others?

DietPi built on Armbian 23.8.3 bookworm, Kernel 6.1

Please describe your issue below:

I am struggling to find info or documentation on using the 3705 fan on my system, i stumbled upon this script:
https://raw.githubusercontent.com/hyphop/khadas-utils/master/utils/fan

but so far i was unable to get the fan running. I will post below the error i get when executing the script and the result of executing i2c commands to try to understand what’s happening.

appreciate the help with this

Post a console log of your issue below:


"~/Documents$ sudo ./fan.sh on
Error: Could not set address to 0x18: Device or resource busy
[i] set FUN SPEED: 1
"
"~/Documents$ sudo i2cdetect -l
i2c-0   i2c             Meson I2C adapter                       I2C adapter
i2c-1   i2c             Meson I2C adapter                       I2C adapter
i2c-2   i2c             DesignWare HDMI                         I2C adapter
"
"sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- 0e --
10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
20: UU -- 22 -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
~$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
"

Hello @xZeRox

In Mainline linux kernel (6.1), the fan control is automatically controlled by linux kernel driver, and you do not need to use the script.

Thank you for your response @Electr1 and i did suspect that but when doing a stress test, i’ve watched the CPU reach a 75 C with the fan not turning on, is there a way to manually check or trigger it that i’m missing?

It’s worth noting that when booting into OOWOW, the fan spins at the start and then stops, possibly an automatic check of some sort

@xZeRox you can try check if module for fan control is loaded ?

$ lsmod | grep khadas_mcu_fan

its showing to be loaded with a pid number

@xZeRox I will check from my side and let you know.

thank you for looking into this, just to add more info, the module is loaded but doesn’t seem to be used or utilized by anything, unless i’m missing something since i’m new to all of this, here’s what i mean if that makes sense:

~$ lsmod | grep khadas
khadas_mcu_fan         16384  0
rc_khadas              16384  0
rc_core                57344  4 rc_khadas,ir_nec_decoder,meson_ir
khadas_mcu             16384  0

@xZeRox you can set the trigger temp for the fan in mainline with the sysfs at
/sys/class/thermal/thermal_zone0/trip_point_3_temp

eg. to set trigger temperature of fan at 40 c or 40000 millicelcius

echo 40000 | sudo tee /sys/class/thermal/thermal_zone0/trip_point_3_temp

Please note it’s still automatically managed by kernel driver, but you may set the trigger temp to your liking.

Regards.

Thank you @Electr1, that managed to trigger the fan when i benchmarked the CPU, but looking at the rest of the temp trip points, the numbers seem all over the place, for example, before changing the value of trip_point_3_temp to 40000, it was set to 80000, and the other trip points went as high as 110000.

Where can I find a manual for this please and is there any utility that could help manage and adjust these values?

Those trip points are the maximal limit set in place for safe operation.
you can check linux kernel for this detail.

exceeding hot, or critical will cause the board to shut down

We will add some details about this in our documentation shortly.