Jump to content

Recommended Posts

Posted (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 by DzubyBB

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...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines