Difference between revisions of "PWM"
From ArmadeusWiki
(→Usage) |
(→Usage) |
||
Line 24: | Line 24: | ||
Now you have access to /sys/class/pwm/ functionnalities: | Now you have access to /sys/class/pwm/ functionnalities: | ||
* to activate PWM: | * to activate PWM: | ||
− | # echo 1 > /sys/class/pwm/active | + | # echo 1 > /sys/class/pwm/pwm0/active |
* to de-activate PWM: | * to de-activate PWM: | ||
− | # echo 0 > /sys/class/pwm/active | + | # echo 0 > /sys/class/pwm/pwm0/active |
* to change frequency (for example 500 Hz): | * to change frequency (for example 500 Hz): | ||
− | # echo 500 > /sys/class/pwm/frequency | + | # echo 500 > /sys/class/pwm/pwm0/frequency |
* to change period (for example 100us): | * to change period (for example 100us): | ||
− | # echo 100 > /sys/class/pwm/period | + | # echo 100 > /sys/class/pwm/pwm0/period |
* to change duty cycle (for example 50.0%) | * to change duty cycle (for example 50.0%) | ||
− | # echo 500 > /sys/class/pwm/duty | + | # echo 500 > /sys/class/pwm/pwm0/duty |
Audio playback mode is not fully functionnal/tested yet. Ask JulienB if you really need it... | Audio playback mode is not fully functionnal/tested yet. Ask JulienB if you really need it... |
Revision as of 18:16, 2 February 2007
On this page, you will find usefull informations to configure and use the Pulse Width Modulation (PWM) capabilities of your APF9328 board.
Your is capable of driving 2 PWM signals:
- one is linked to the LCD controller and allow to control LCD backlight, see LCD page for more informations
- the other can be used to generate PWM signals in several mode:
* audio playback * real PWM
Contents
Configuration
First be sure to have the PWM Linux driver activated:
$ make linux-menuconfig
$ make
Installation
Either copy generated module target/linux/modules/pwm/pwm.ko to your system with TFTP or NFS or reflash the generated rootfs
Usage
Load the module:
# /lib/modules/2.6.18.1/extra/pwm/pwm.ko
Now you have access to /sys/class/pwm/ functionnalities:
- to activate PWM:
# echo 1 > /sys/class/pwm/pwm0/active
- to de-activate PWM:
# echo 0 > /sys/class/pwm/pwm0/active
- to change frequency (for example 500 Hz):
# echo 500 > /sys/class/pwm/pwm0/frequency
- to change period (for example 100us):
# echo 100 > /sys/class/pwm/pwm0/period
- to change duty cycle (for example 50.0%)
# echo 500 > /sys/class/pwm/pwm0/duty
Audio playback mode is not fully functionnal/tested yet. Ask JulienB if you really need it...