Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gpio:pwm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:common:applications:gpio:pwm [2026/09/14 04:44]
nick [PWM Reference Table]
products:sbc:common:applications:gpio:pwm [2026/09/15 03:25] (current)
nick [Control PWM]
Line 14: Line 14:
 ^  VIM4   |  ''PWM_F''     |  35   |  ''GPIOY_8''    |  ''pwm_f''        |/sys/class/pwm/pwmchip4  | ^  VIM4   |  ''PWM_F''     |  35   |  ''GPIOY_8''    |  ''pwm_f''        |/sys/class/pwm/pwmchip4  |
 ^  VIM1S  |  ''PWM_F''     |  35   |  ''GPIOZ_6''    |  ''pwm_f''        |/sys/class/pwm/pwmchip0  | ^  VIM1S  |  ''PWM_F''     |  35   |  ''GPIOZ_6''    |  ''pwm_f''        |/sys/class/pwm/pwmchip0  |
-^  VIM 5  |  ''PWM_J''     |  35   |  ''GPIOY_5''    |  ''pwm_j''        |Not fixed, using the below command to detect  | +^  VIM-5  |  ''PWM_J''     |  35   |  ''GPIOY_5''    |  ''pwm_j''        |Not fixed, using the below command to detect  | 
-^  :::    |  :::           |  :::  |      :::        |     :::           |set \-\- /sys/bus/platform/devices/fe058400.pwm/pwm/pwmchip* && PWM_J=$1 && echo $PWM_J |+ 
 +**VIM 5:** 
 +```shell 
 +$ set -- /sys/bus/platform/devices/fe058400.pwm/pwm/pwmchip* 
 +$ PWM_J=$1 
 +$ echo $PWM_J 
 +```
  
  
Line 126: Line 132:
 device  export  npwm  power  subsystem  uevent  unexport device  export  npwm  power  subsystem  uevent  unexport
 ``` ```
 +<tabbox VIM-5>
 +
 +Edit ''/boot/dtb/amlogic/kvim-5.dtb.overlay.env'' to add pwm node to ''fdt_overlays'' node if it doesn't exist.
 +
 +You need to add ''pwm_j'' to node ''fdt_overlays'' if it doesn't exist to enable ''PWM_J''.
 +
 +```shell
 +fdt_overlays=pwm_j
 +
 +```
 +
 +After reboot, you will see the pwm device node.
 +
 +```shell
 +$ set -- /sys/bus/platform/devices/fe058400.pwm/pwm/pwmchip*
 +$ PWM_J=$1
 +$ ls $PWM_J
 +device  export  npwm  power  subsystem  uevent  unexport
 +```
 +
 </tabbox> </tabbox>
  
Line 224: Line 250:
 echo 500000 | sudo tee /sys/class/pwm/pwmchip0/pwm1/duty_cycle echo 500000 | sudo tee /sys/class/pwm/pwmchip0/pwm1/duty_cycle
 echo 1 | sudo tee /sys/class/pwm/pwmchip0/pwm1/enable echo 1 | sudo tee /sys/class/pwm/pwmchip0/pwm1/enable
 +```
 +
 +<tabbox VIM-5> 
 +
 +```shell
 +set -- /sys/bus/platform/devices/fe058400.pwm/pwm/pwmchip*
 +PWM_J=$1
 +echo 0 | sudo tee "$PWM_J"/export
 +echo 1000000 | sudo tee "$PWM_J"/pwm0/period
 +echo 500000 | sudo tee "$PWM_J"/pwm0/duty_cycle
 +echo 1 | sudo tee "$PWM_J"/pwm0/enable
 ``` ```
  
Line 245: Line 282:
 ```shell ```shell
 echo 0 | sudo tee /sys/class/pwm/pwmchip1/pwm1/enable echo 0 | sudo tee /sys/class/pwm/pwmchip1/pwm1/enable
 +```
 +<tabbox VIM3L/1S> 
 +```shell
 +echo 0 | sudo tee /sys/class/pwm/pwmchip0/pwm1/enable
 +```
 +<tabbox VIM-5> 
 +```shell
 +set -- /sys/bus/platform/devices/fe058400.pwm/pwm/pwmchip*
 +PWM_J=$1
 +echo 0 | sudo tee "$PWM_J"/pwm0/enable
 ``` ```
 <tabbox VIM3L/1S>  <tabbox VIM3L/1S> 
Last modified: 2026/09/14 04:44 by nick