This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
products:sbc:edge2:applications:gpio:pwm [2022/11/24 02:29] ivan created |
products:sbc:edge2:applications:gpio:pwm [2022/12/02 02:19] (current) ivan [Introduction] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~tag> | ||
+ | |||
====== Edge2 PWM ====== | ====== Edge2 PWM ====== | ||
- | {{page> | + | ===== Introduction ===== |
+ | |||
+ | This page introduces the usage of hardware PWM, and leads you to control the hardware PWM on the [[products: | ||
+ | |||
+ | <WRAP important | ||
+ | For Edge2, in order to use the PWM function, you need to attach the IO extension board. | ||
+ | </ | ||
+ | ===== PWM Information ===== | ||
+ | |||
+ | | | ||
+ | ^ Edge2 | PWM14 | ||
+ | |||
+ | |||
+ | ===== Enable PWM ===== | ||
+ | |||
+ | In order to use the PWM, you need to enable the PWM function via [[products: | ||
+ | |||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | |||
+ | You need to add '' | ||
+ | |||
+ | ```shell | ||
+ | fdt_overlays=edge2-io-pwm | ||
+ | |||
+ | ``` | ||
+ | |||
+ | 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:** | ||
+ | |||
+ | ```shell | ||
+ | echo 0 | sudo tee / | ||
+ | echo 1000000 | sudo tee / | ||
+ | echo 500000 | sudo tee / | ||
+ | echo 1 | sudo tee / | ||
+ | ``` | ||
+ | |||
+ | Use an oscilloscope to check if the pins have been successfully enabled. | ||
+ | |||
+ | {{products: | ||
+ | |||
+ | <WRAP info > | ||
+ | If you use an oscilloscope to view the PWM waveform, remember that the SBC and the oscilloscope need to share the same GND (ground). | ||
+ | </ | ||
+ | |||
+ | **Disable PWM:** | ||
+ | |||
+ | ```shell | ||
+ | echo 0 | sudo tee / | ||
+ | ``` | ||
+ | |||
+ |