Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:c2_hardware_pwm [2016/02/29 14:26] ck.kim [Hardware PWM] |
en:c2_hardware_pwm [2017/01/31 19:10] (current) odroid [freq0] |
||
---|---|---|---|
Line 8: | Line 8: | ||
===== Usage ===== | ===== Usage ===== | ||
- | For pin position, numbers and names, please refer to the pinmap [[http://odroid.com/dokuwiki/doku.php?id=en:c1_hardware#expansion_connectors|Expansion Connector]] | + | For pin position, numbers and names, please refer to the pinmap [[http://odroid.com/dokuwiki/doku.php?id=en:c2_hardware#expansion_connectors|Expansion Connector]] |
- | === Option 1: Single PWM and SPI === | + | === Option 1: Single PWM === |
The code below loads the PWM module with a single PWM and the PWM controller module. | The code below loads the PWM module with a single PWM and the PWM controller module. | ||
Line 15: | Line 15: | ||
<code> | <code> | ||
- | sudo modprobe pwm-meson npwm=1 | + | sudo modprobe pwm-meson |
sudo modprobe pwm-ctrl | sudo modprobe pwm-ctrl | ||
</code> | </code> | ||
- | === Option 2: Two PWM and **NO-SPI** === | + | === Option 2: Two PWMs === |
//**PWM PINS:**// | //**PWM PINS:**// | ||
Line 32: | Line 32: | ||
</code> | </code> | ||
+ | <WRAP left round important 100%> | ||
+ | If you are using TWO pwm setup, PWM1 & SPI can not be used simultaneously.\\ | ||
+ | Because GPIOX_7(pin19) has two function spi_mosi & pwm. | ||
+ | </WRAP> | ||
==== Examples of usage ==== | ==== Examples of usage ==== | ||
You can control this pwm via simple sysfs entries. | You can control this pwm via simple sysfs entries. | ||
- | On **/sys/devices/platform/pwm-ctrl** You'll find the following files: | + | On **/sys/devices/platform/pwm-ctrl/** You'll find the following files: |
==== duty0 ==== | ==== duty0 ==== | ||
Line 59: | Line 63: | ||
enable1, freq1, duty1 | enable1, freq1, duty1 | ||
</WRAP> | </WRAP> | ||
+ | |||
+ | ==== How to access the PWM port in C language ==== | ||
+ | |||
+ | [[http://forum.odroid.com/viewtopic.php?f=141&t=25563#p177696|Example code by paulcrawford ]] | ||
+ | |||
+ |