Banana pi R3 fan with PWM

Yes because the trips are updated every x seconds (imho 5s) from system…you can only override it only till next update

What is the chance that this is a hardware problem on the board?

The reset of cur_state is normal behaviour…or what do you mean with hardware fault?

Well, the fan works only if I disconnect the PWM wire, which is the red one in my case. And then it only runs at full speed and is a bit noisy. It used to work normally. I could set/adjust RPMs before .

is this the same with openwrt from @dangowrt?

I managed to build an image but was not able to boot with it. Can I test PWM functionality with your image @frank-w ? I mean this one:

Afair pwm patches were added after i created the image…but you could use the image as base and build and install a newer kernel (6.5.rc)

First I need to confirm that the PWM problem is not hardware related. Any idea how I can check this?

you can build openwrt with kernel 6.1 from daniels tree which should be right now (5.15 seems to not working with the clock i upstreamed).

Do you have an oscilloscope or voltmeter?

Please give me the instructions how to check it. I will have access to oscilloscope and voltmeter tomorrow.

With the ground probe touch the sfp cage or any other gnd pin, and with the other one the pwm pin, which is the one closer to the sfp/eth ports side of the board.

Then type

echo 2 > /sys/class/thermal/cooling_device0/cur_state

And you should see pwm signals for few seconds, maybe ask someone to help you

Please do not shorten pins…best way is to use a matching connector with cables for testing it. You can also measure voltage with multimeter between gnd (middle pin) and the pwm pin. If pwm is off you will measure 3v3 as pwm high brings gnd to the pin (inverted signal)

1 Like

It’s riskier trying to use the middle pin for gnd. The sfp cage is very convenient

1 Like

Thank you! Voltmeter or oscilloscope? A friend of mine will help me.

With scope you will see the pwm signal, with voltmeter you should see a temporary voltage increase

If your friend or you can handle oscilloscope correctly it will be better choice as you will see the signal shape. Multimeter is easier but you see only voltage change when pwm goes through the states

Do you know which trip point is activated when? I have 0 , 1 , 2 , 3 , and 4 So setting the trip point 1 to 32000 didn’t do anything, so I set

echo 32000 > /sys/class/thermal/thermal_zone0/trip_point_4_temp
echo 32000 > /sys/class/thermal/thermal_zone0/trip_point_3_temp
echo 32000 > /sys/class/thermal/thermal_zone0/trip_point_2_temp
echo 32000 > /sys/class/thermal/thermal_zone0/trip_point_1_temp

and now the fan actually spins! YEAH! It is keeping it much cooler, as it was very hot, and hot to touch before. So thank you for pointing me to the trip points but I am not sure what the levels are and how the different trip points affect the fan speed at each point?

1 Like

what 32000 means ? is it the temp in °c * 1000 ? so if i set 40000 the fan will start @40°c

Yes,the temp-value of trippoints is in millicelsius

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/mediatek/mt7986a.dtsi#n606

Mainline has current problems merging dts changes,but i thought daniel has merged my latest version into openwrt where the lowest trippoint is active. I guess you need to update temp from second trip point as only active trips can trigger fan

1 Like