This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
products:sbc:common:applications:gpio:pwm [2022/12/01 04:18] ivan [Table] |
products:sbc:common:applications:gpio:pwm [2023/11/07 04:55] nick [Enable PWM] |
||
---|---|---|---|
Line 5: | Line 5: | ||
This page introduces the usage of hardware PWM, and leads you to control the hardware PWM on the [[products: | This page introduces the usage of hardware PWM, and leads you to control the hardware PWM on the [[products: | ||
- | ===== PWM Information | + | ===== PWM Reference Table ===== |
- | | | + | | |
- | ^ VIM1 | + | ^ VIM1 |
- | ^ VIM2 | + | ^ VIM2 |
- | ^ VIM3/ | + | ^ VIM3 |
- | ^ | + | ^ |
- | ^ | + | ^ |
- | ^ | + | ^ |
- | + | ||
- | <WRAP important > | + | |
- | For Edge2, in order to use the PWM function, you need to attach the IO extension board. | + | |
- | </ | + | |
Line 24: | Line 20: | ||
In order to use the PWM, you need to enable the PWM function via [[products: | In order to use the PWM, you need to enable the PWM function via [[products: | ||
- | <tabbox VIM1/2/3/3L/Edge1> | + | <tabbox VIM1/ |
Edit ''/ | Edit ''/ | ||
Line 31: | Line 27: | ||
```shell | ```shell | ||
- | overlays=uart4 pwm_ao_a | + | overlays=uart3 pwm_f i2c3 i2s os08a10 watchdog |
``` | ``` | ||
Line 41: | Line 37: | ||
``` | ``` | ||
- | < | + | < |
- | Edit ''/ | + | Edit ''/ |
+ | |||
+ | Take VIM3L as an example to enable '' | ||
+ | |||
+ | ```shell | ||
+ | overlays=uart3 pwm_f i2c3 i2s watchdog | ||
+ | ``` | ||
+ | |||
+ | After reboot, you will see the pwm device node. | ||
+ | |||
+ | ```shell | ||
+ | $ ls / | ||
+ | device | ||
+ | ``` | ||
+ | |||
+ | |||
+ | <tabbox VIM3 with 5.15 kernel> | ||
+ | |||
+ | Edit ''/ | ||
Line 54: | Line 68: | ||
After reboot, you will see the pwm device node. | After reboot, you will see the pwm device node. | ||
+ | |||
+ | <tabbox VIM3L with 5.15 kernel> | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | You need to add '' | ||
```shell | ```shell | ||
- | $ ls / | + | fdt_overlays=pwm_f |
- | device | + | |
``` | ``` | ||
- | <tabbox VIM1S> | + | After reboot, you will see the pwm device node. |
- | Edit ''/ | + | <tabbox VIM4> |
+ | |||
+ | Edit ''/ | ||
Line 75: | Line 98: | ||
```shell | ```shell | ||
- | $ ls / | + | $ ls / |
device | device | ||
``` | ``` | ||
- | < | + | < |
- | Edit ''/ | + | Edit ''/ |
- | You need to add '' | + | You need to add '' |
```shell | ```shell | ||
- | fdt_overlays=pwm14 | + | fdt_overlays=pwm_f |
``` | ``` | ||
Line 94: | Line 117: | ||
```shell | ```shell | ||
- | $ ls / | + | $ ls / |
device | device | ||
``` | ``` | ||
- | |||
</ | </ | ||
- | ===== Disable PWM to Use GPIO ===== | ||
- | |||
- | If you want to use normal GPIO instead of PWM, you can remove the PWM node in [[products: | ||
===== Control PWM ===== | ===== Control PWM ===== | ||
Line 108: | Line 127: | ||
**Enable PWM:** | **Enable PWM:** | ||
- | <tabbox VIM1/3/3L/ | + | <tabbox VIM1/ |
```shell | ```shell | ||
Line 116: | Line 135: | ||
echo 1 | sudo tee / | echo 1 | sudo tee / | ||
``` | ``` | ||
+ | |||
<tabbox VIM2> | <tabbox VIM2> | ||
Line 125: | Line 145: | ||
``` | ``` | ||
- | < | + | < |
```shell | ```shell | ||
Line 133: | Line 153: | ||
echo 1 | sudo tee / | echo 1 | sudo tee / | ||
``` | ``` | ||
- | <tabbox Edge2> | ||
- | |||
- | ```shell | ||
- | echo 0 | sudo tee / | ||
- | echo 1000000 | sudo tee / | ||
- | echo 500000 | sudo tee / | ||
- | echo 1 | sudo tee / | ||
- | ``` | ||
- | |||
</ | </ | ||
Line 154: | Line 165: | ||
**Disable PWM:** | **Disable PWM:** | ||
- | <tabbox VIM1/3/3L/ | + | <tabbox VIM1/ |
```shell | ```shell | ||
echo 0 | sudo tee / | echo 0 | sudo tee / | ||
Line 162: | Line 173: | ||
echo 0 | sudo tee / | echo 0 | sudo tee / | ||
``` | ``` | ||
- | < | + | < |
```shell | ```shell | ||
echo 0 | sudo tee / | echo 0 | sudo tee / | ||
- | ``` | ||
- | <tabbox Edge2> | ||
- | ```shell | ||
- | echo 0 | sudo tee / | ||
``` | ``` | ||
</ | </ | ||
+ | |||
+ | ===== Disable PWM to Use GPIO ===== | ||
+ | |||
+ | If you want to use normal GPIO instead of PWM, you can remove the PWM node in [[products: | ||
+ | |||