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 06:27] nick [Table] |
products:sbc:common:applications:gpio:pwm [2023/03/30 23:56] nick |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This document mainly describes | + | This page introduces |
- | ===== PWM Information | + | ===== PWM Reference Table ===== |
- | < | + | | |
+ | ^ | ||
+ | ^ VIM2 | ||
+ | ^ VIM3 | ||
+ | ^ VIM3L | '' | ||
+ | ^ VIM4 | ||
+ | ^ VIM1S | '' | ||
- | ^ PWM | ||
- | | PWM_AO_A | ||
- | <tabbox VIM2> | + | ===== Enable PWM ===== |
- | ^ | + | In order to use the PWM, you need to enable the PWM function via [[products: |
- | | PWM_D | 35 | + | |
- | < | + | < |
- | ^ PWM | PIN ^ GPIO Number | + | Edit '' |
- | | PWM_F | 35 | + | |
- | <tabbox VIM4> | + | Take VIM3 as an example to enable '' |
- | ^ PWM | + | ```shell |
- | | PWM_F | PIN35 - GPIOY_8 (# | + | overlays=uart3 |
+ | ``` | ||
- | </ | + | After reboot, you will see the pwm device node. |
+ | ```shell | ||
+ | $ ls / | ||
+ | device | ||
+ | ``` | ||
- | ===== Enabel PWM ===== | + | < |
- | + | ||
- | In order to use the PWM, you need to enable the PWM function via [[products: | + | |
- | + | ||
- | < | + | |
Edit ''/ | Edit ''/ | ||
- | Take VIM3 as an example to enable '' | + | Take VIM3L as an example to enable '' |
```shell | ```shell | ||
- | overlays=uart4 pwm_ao_a | + | overlays=uart3 pwm_f i2c3 i2s watchdog |
``` | ``` | ||
Line 47: | Line 50: | ||
```shell | ```shell | ||
- | $ ls / | + | $ ls / |
device | device | ||
``` | ``` | ||
Line 70: | Line 73: | ||
``` | ``` | ||
+ | <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 ===== | ===== Disable PWM to Use GPIO ===== | ||
- | If you want to use normal GPIO instead of PWM, you can remove the PWM node in device tree overlays configration file. | + | If you want to use normal GPIO instead of PWM, you can remove the PWM node in [[products: |
===== Control PWM ===== | ===== Control PWM ===== | ||
Line 80: | Line 101: | ||
**Enable PWM:** | **Enable PWM:** | ||
- | <tabbox VIM1/3/3L/ | + | <tabbox VIM1/ |
```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> | ||
```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 VIM3L/ | ||
+ | |||
+ | ```shell | ||
+ | echo 1 | sudo tee / | ||
+ | echo 1000000 | sudo tee / | ||
+ | echo 500000 | sudo tee / | ||
+ | echo 1 | sudo tee / | ||
+ | ``` | ||
</ | </ | ||
Line 109: | Line 139: | ||
**Disable PWM:** | **Disable PWM:** | ||
- | <tabbox VIM1/3/3L/ | + | <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 VIM3L/ | ||
+ | ```shell | ||
+ | echo 0 | sudo tee / | ||
``` | ``` | ||
</ | </ | ||