zador.blood.stained Posted March 25, 2017 Posted March 25, 2017 Requirements Fresh enough nighly or manually built image Latest kernel and dtb packages (26.03.2017 or newer) Limitations As stated in other PWM related threads, hardware PWM output is supported only on pin PA5 which is also UART0 ("debug" serial console) RX pin, so enabling PWM will disable this console. Activation Add "pwm" to "overlays" line in /boot/armbianEnv.txt Example: overlays=pwm Reboot is required to apply the changes Armbian overlays documentation: https://docs.armbian.com/User-Guide_Allwinner_overlays/ PWM sysfs interface Official documentation: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/Documentation/ABI/testing/sysfs-class-pwm?h=v4.10 Please note that this ABI is considered "testing" so it may change in the future. Sysfs interface example # activate the PWM. On H3 only 1 PWM is supported, so exporting PWM 0 echo 0 > /sys/class/pwm/pwmchip0/export # set period to 10ms echo 10000000 > /sys/class/pwm/pwmchip0/pwm0/period # set normal polarity. needs to be reset explicitly. Bug? echo "inversed" > /sys/class/pwm/pwmchip0/pwm0/polarity echo "normal" > /sys/class/pwm/pwmchip0/pwm0/polarity # enable the PWM echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable # set duty cycle to 1ms echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle Result: # set duty cycle to 2ms echo 2000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle Result: # set duty cycle to 1us, period to 2us echo 1000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle echo 2000 > /sys/class/pwm/pwmchip0/pwm0/period Result: Please note that some settings needs to be changed in a correct sequence, i.e. you can't set duty cycle higher than period root@orangepiplus2e:~# echo 1000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle root@orangepiplus2e:~# echo 500 > /sys/class/pwm/pwmchip0/pwm0/period -bash: echo: write error: Invalid argument root@orangepiplus2e:~# 3
jbuzar Posted April 18, 2017 Posted April 18, 2017 What is maximum possible PWM speed with this devices?
Recommended Posts