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/07/12 05:13] nick |
products:sbc:common:applications:gpio:pwm [2023/03/30 06:35] ivan [PWM Reference Table] |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This document mainly describes | + | This page introduces |
+ | |||
+ | ===== PWM Reference Table ===== | ||
+ | |||
+ | | | ||
+ | ^ VIM1 | ||
+ | ^ VIM2 | ||
+ | ^ VIM3/ | ||
+ | ^ VIM4 | ||
+ | ^ VIM1S | '' | ||
===== Enable PWM ===== | ===== Enable PWM ===== | ||
+ | |||
+ | In order to use the PWM, you need to enable the PWM function via [[products: | ||
+ | |||
+ | <tabbox VIM1/ | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | Take VIM3 as an example to enable '' | ||
+ | |||
+ | ```shell | ||
+ | overlays=uart4 pwm_ao_a pwm_f | ||
+ | ``` | ||
+ | |||
+ | After reboot, you will see the pwm device node. | ||
+ | |||
+ | ```shell | ||
+ | $ ls / | ||
+ | device | ||
+ | ``` | ||
+ | |||
+ | <tabbox VIM4> | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | You need to add '' | ||
+ | |||
+ | ```shell | ||
+ | fdt_overlays=pwm_f | ||
+ | |||
+ | ``` | ||
+ | |||
+ | After reboot, you will see the pwm device node. | ||
+ | |||
+ | ```shell | ||
+ | $ ls / | ||
+ | device | ||
+ | ``` | ||
+ | |||
+ | <tabbox VIM1S> | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | You need to add '' | ||
+ | |||
+ | ```shell | ||
+ | fdt_overlays=pwm_f | ||
+ | |||
+ | ``` | ||
+ | |||
+ | After reboot, you will see the pwm device node. | ||
+ | |||
+ | ```shell | ||
+ | $ ls / | ||
+ | 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 ===== | ||
+ | |||
+ | **Enable PWM:** | ||
<tabbox VIM1/ | <tabbox VIM1/ | ||
- | %%PWM_F:%% | + | |
```shell | ```shell | ||
- | $ echo 1 | sudo tee / | + | echo 1 | sudo tee / |
- | $ echo 1000000 | sudo tee / | + | echo 1000000 | sudo tee / |
- | $ echo 500000 | sudo tee / | + | echo 500000 | sudo tee / |
- | $ echo 1 | sudo tee / | + | echo 1 | sudo tee / |
``` | ``` | ||
<tabbox VIM2> | <tabbox VIM2> | ||
- | PWM_D: | + | |
+ | ```shell | ||
+ | echo 1 | sudo tee / | ||
+ | echo 1000000 | sudo tee / | ||
+ | echo 500000 | sudo tee / | ||
+ | echo 1 | sudo tee / | ||
+ | ``` | ||
+ | |||
+ | <tabbox VIM1S> | ||
```shell | ```shell | ||
- | $ echo 1 | sudo tee / | + | echo 1 | sudo tee / |
- | $ echo 1000000 | sudo tee / | + | echo 1000000 | sudo tee / |
- | $ echo 500000 | sudo tee / | + | echo 500000 | sudo tee / |
- | $ echo 1 | sudo tee / | + | echo 1 | sudo tee / |
``` | ``` | ||
</ | </ | ||
Line 33: | Line 118: | ||
</ | </ | ||
- | ===== Disable PWM ===== | + | **Disable PWM:** |
<tabbox VIM1/ | <tabbox VIM1/ | ||
```shell | ```shell | ||
- | $ echo 0 | sudo tee / | + | echo 0 | sudo tee / |
``` | ``` | ||
<tabbox VIM2> | <tabbox VIM2> | ||
```shell | ```shell | ||
- | $ echo 0 | sudo tee / | + | echo 0 | sudo tee / |
+ | ``` | ||
+ | <tabbox VIM1S> | ||
+ | ```shell | ||
+ | echo 0 | sudo tee / | ||
``` | ``` | ||
</ | </ | ||