1 1

PWM1 on H5

Recommended Posts

On the Orange Pi Zero Plus the pwm1 port is available on the header instead of pwm0.

Ik have tried to create a custom overlay but it does create a pwm device but it is not working.


pwm1 is on PA6

I have created a folder: overlay-user in /boot

In this folder I created a sun50i-h5-pwm1.dts file with the following content:


/ {
        compatible = "allwinner,sun50i-h5";

        fragment@0 {
                target = <&pio>;
                __overlay__ {
                        pwm1_pin: pwm1 {
                                pins = "PA6";
                                function = "pwm1";

        fragment@1 {
                target = <&pwm>;
                __overlay__ {
                        pinctrl-names = "default";
                        pinctrl-0 = <&pwm1_pin>;
                        status = "okay";

I converted this file with the command:

sudo dtc -O dtb -o sun50i-h5-pwm1.dtbo sun50i-h5-pwm1.dts 


after rebooting a pwmchip is available in the /sys/class/pwm

but if I try to export pwm1 I get an error


arnoud@orangepizeroplus:/sys/class/pwm/pwmchip0$ export sudo sh -c "echo 1 > export"  

sh: 1: echo: echo: I/O error


There seems to be a pwm0 but when I start this pwm no pwm output is given


arnoud@orangepizeroplus:/sys/class/pwm/pwmchip0$ export sudo sh -c "echo 1 > export"  

arnoud@orangepizeroplus:cd pwm0

arnoud@orangepizeroplus:/sys/class/pwm/pwmchip0/pwm0$ sudo sh -c "echo 1000000 > period"                                      

arnoud@orangepizeroplus:/sys/class/pwm/pwmchip0/pwm0$ sudo sh -c "echo 500000 > duty_cycle"
arnoud@orangepizeroplus:/sys/class/pwm/pwmchip0/pwm0$ sudo sh -c "echo 1 > enable"


Can someone please give me a hint in what I am doing wrong.




Share this post

Link to post
Share on other sites

OMG. I am looking in the docs of the datasheet of the Allwinner H5 and noticed the functions of the pinning is totally different and there is no pwm1



A second look at the schematics of the orange pi zero plus confronted me with the fact they did not replaced the chip and have just used the H3 chip in the schematics.



Using pwm on this board is not usable for me, as I do not want to disable the ttyS0. 

As it is only for driving a buzzer I will probably replace the buzzer for an active buzzer.


So solved: Documentation of board is misleading.. 


Share this post

Link to post
Share on other sites

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.

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.

1 1