-
Notifications
You must be signed in to change notification settings - Fork 0
PWM on Odroid
Isaac Vandor edited this page Feb 2, 2017
·
2 revisions
ODROID HAS 2 Hardware PWM output pins, 33 and 19.
To use the PWM output module, follow the instructions below:
-
First, start the PWM module in the kernel. Specify the number of PWM pins to use.
sudo modprobe pwm-meson npwm=1 #USING 1 PWM PIN (33)
Alternatively, to use both pins (33 and 19), run:
#sudo modprobe pwm-meson npwm=2 #USING 1 PWM PIN (33, 19)
-
Begin the PWM control module in the kernel.
# START PWM CONTROL sudo modprobe pwm-ctrl
-
Change directory to avoid supplying absolute paths.
# CHANGE DIRECTORY cd /sys/devices/platform/pwm-ctrl
-
Set your parameters.
export DUTY_CYCLE=102 # 0 ~ 1023 export FREQUENCY=1024 # IN Hz, 0 ~ 1000000
-
Launch PWM.
echo ${DUTY_CYCLE} > duty0 echo 1 > enable0 echo ${FREQUENCY} > freq0
-
When you're done, remove the loaded modules from the kernel.
sudo modprobe -r pwm-ctrl sudo modprobe -r pwm-meson