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:27] nick |
products:sbc:common:applications:gpio:pwm [2023/03/30 23:54] nick [Table] |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This document mainly describes | + | This page introduces |
- | ===== PWM Information | + | ===== PWM Reference Table ===== |
- | < | + | | |
+ | ^ | ||
+ | ^ VIM2 | ||
+ | ^ VIM3 | ||
+ | ^ VIM3L | '' | ||
+ | ^ VIM4 | ||
+ | ^ VIM1S | '' | ||
- | ^ I2C | ||
- | | I2C A | SCL(22) - GPIODV_25 (#474)\\ SDA (23) - GPIODV_24 (# | ||
- | | I2C B | SCL(25) - GPIODV_27 (#476)\\ SDA(26) - GPIODV_26 (# | ||
+ | ===== Enable PWM ===== | ||
- | <tabbox VIM3/3L> | + | In order to use the PWM, you need to enable the PWM function via [[products: |
- | ^ I2C ^ PIN & GPIO Number | + | <tabbox VIM1/ |
- | | I2CM 3 | SCL(22) - GPIOA_15 (#475)\\ SDA(23) - GPIOA_14 (# | + | |
- | | I2C AO | SCL(25) - GPIOAO_2 (#498)\\ SDA(26) - GPIOAO_3 (# | + | Edit ''/ |
+ | |||
+ | Take VIM3 as an example to enable '' | ||
+ | |||
+ | ```shell | ||
+ | overlays=uart3 pwm_f i2c3 i2s os08a10 watchdog | ||
+ | ``` | ||
+ | |||
+ | After reboot, you will see the pwm device node. | ||
+ | |||
+ | ```shell | ||
+ | $ ls / | ||
+ | device | ||
+ | ``` | ||
+ | |||
+ | <tabbox VIM3L> | ||
+ | |||
+ | 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 /sys/class/ | ||
+ | device | ||
+ | ``` | ||
<tabbox VIM4> | <tabbox VIM4> | ||
- | ^ I2C ^ PIN & GPIO Number | + | Edit '' |
- | | I2CM F | SCL(22) - GPIOY_17 (#501)\\ SDA (23) - GPIOY_18 (# | + | |
- | | I2CM A | SCL(25) - GPIOT_20 (#466)\\ SDA(26) - GPIOT_21 (# | + | |
+ | 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 | ||
+ | ``` | ||
</ | </ | ||
- | ===== Enable | + | ===== Disable |
+ | |||
+ | 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 VIM3L> | ||
+ | |||
+ | ```shell | ||
+ | echo 1 | sudo tee / | ||
+ | echo 1000000 | sudo tee / | ||
+ | echo 500000 | sudo tee / | ||
+ | echo 1 | sudo tee / | ||
+ | ``` | ||
+ | |||
<tabbox VIM2> | <tabbox VIM2> | ||
- | PWM_D: | + | |
```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 VIM1S> | ||
+ | |||
+ | ```shell | ||
+ | echo 1 | sudo tee / | ||
+ | echo 1000000 | sudo tee / | ||
+ | echo 500000 | sudo tee / | ||
+ | echo 1 | sudo tee / | ||
``` | ``` | ||
</ | </ | ||
Line 57: | Line 146: | ||
</ | </ | ||
- | ===== Disable PWM ===== | + | **Disable PWM:** |
- | <tabbox VIM1/3/3L/ | + | <tabbox VIM1/ |
```shell | ```shell | ||
- | $ echo 0 | sudo tee / | + | echo 0 | sudo tee / |
+ | ``` | ||
+ | <tabbox VIM3L> | ||
+ | ```shell | ||
+ | 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 / | ||
``` | ``` | ||
</ | </ | ||