DzubyBB Posted yesterday at 04:53 PM Posted yesterday at 04:53 PM (edited) Hi everyone, I'm trying to control an 5v PWM Fan using hardware PWM pins of Banana Pi M5. I'm not able to output any pwm signal on any pin. It looks like there is an pwm controller visible at `/proc/device-tree/soc/bus@ffd00000/pwm@19000`. File `/proc/device-tree/soc/bus@ffd00000/pwm@19000/status` has content `okay` and file `/proc/device-tree/soc/bus@ffd00000/pwm@19000/pinctrl-0` has content `&`. When i run script: echo 0 | tee /sys/class/pwm/pwmchip0/export echo 40000 | tee /sys/class/pwm/pwmchip0/pwm0/period echo 20000 | tee /sys/class/pwm/pwmchip0/pwm0/duty_cycle echo 1 | tee /sys/class/pwm/pwmchip0/pwm0/enable echo 1 | tee /sys/class/pwm/pwmchip1/export echo 40000 | tee /sys/class/pwm/pwmchip1/pwm1/period echo 20000 | tee /sys/class/pwm/pwmchip1/pwm1/duty_cycle echo 1 | tee /sys/class/pwm/pwmchip1/pwm1/enable (only those 2 pins of PWMs are free, script runs without any errors) i cannot detect any pwm signals on any of 40-pin connector. Additionally after that : #: cat /sys/kernel/debug/pinctrl/*/pinmux-pins | grep pwm pin 81 (GPIOX_16): ffd19000.pwm (GPIO UNCLAIMED) function pwm_e group pwm_e pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d group pwm_ao_d_e #: cat /sys/kernel/debug/pwm 0: platform/ff802000.pwm, 2 PWM devices pwm-0 (sysfs ): requested enabled period: 100000 ns duty: 50000 ns polarity: normal pwm-1 (regulator-vddcpu ): requested enabled period: 1250 ns duty: 100 ns polarity: normal 1: platform/ffd19000.pwm, 2 PWM devices pwm-0 (wifi32k ): requested period: 30518 ns duty: 15259 ns polarity: normal pwm-1 (sysfs ): requested enabled period: 100000 ns duty: 50000 ns polarity: normal So looks like pwm signals are not routed to IO pins. I tried to add overlay : /dts-v1/; /plugin/; / { compatible = "bananapi,m5", "amlogic,meson-sm1"; fragment@0 { target-path = <&pwm_ef>; _overlay__ { status = "okay"; pinctrl-0 = <&pwm_e_pins>; pinctrl-names = "default"; }; }; fragment@1 { target-path = "/"; __overlay__ { pwm_e_pins: pwm_e_pins { compatible = "pwm-gpio"; pinctrl-names = "default"; pinctrl-0 = <&pwm_e>; }; }; }; }; which i compiled with dtc and added to `/boot/overlay-user`, after that i added a line user_overlays=meson-m5-custom-pwm to `/boot/armbianEnv.txt` But it didn't worked. I'm not surprised because it was generated by AI, and i don't now anything about overlays. Is there anybody that can help me with writing this overlay ? Or maybe there is simpler solution ? Edited yesterday at 04:58 PM by DzubyBB 0 Quote
c0rnelius Posted yesterday at 05:42 PM Posted yesterday at 05:42 PM Have you tried the meson-g12-pwm-gpiox-5-fan overlay? 0 Quote
DzubyBB Posted 9 hours ago Author Posted 9 hours ago Well, with `meson-g12-pwm-gpiox-5-fan` something works, but very strangely. The fan turns on at 100% when I start the load and runs until the CPU temperature drops below 46°C. Then it stops working, there is no smooth fan speed control in between. 0 Quote
c0rnelius Posted 9 hours ago Posted 9 hours ago It is set to kick on at 55*C. You can review the dtso in the patch dir; https://github.com/armbian/build/blob/main/patch/kernel/archive/meson64-6.12/overlay/meson-g12-pwm-gpiox-5-fan.dtso 0 Quote
DzubyBB Posted 9 hours ago Author Posted 9 hours ago It looks that it kicks in on 100% at 55C, and it's shuts the fan on 44C. I will try the one You sent, thanks. 0 Quote
c0rnelius Posted 9 hours ago Posted 9 hours ago 5 minutes ago, DzubyBB said: It looks that it kicks in on 100% at 55C, and it's shuts the fan on 44C. I will try the one You sent, thanks. That is exactly what it does. It would take a lot more work to make it gradually speed up, if it even could be done? Hence why I wrote it simply. The one I linked is the one you are using. 0 Quote
c0rnelius Posted 8 hours ago Posted 8 hours ago I also have a personal preference. I don't like my fans just spinning to spin. I prefer them to trigger under heavy load and then cut off once that load has passed. You are more than welcome though, to make adjustments to it and submit them via PR. 0 Quote
Recommended Posts
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.