This document introduces how to use hardware PWM.
By default, the DTS configuration file specifies PWM_F as the pin used to control the backlight of a VBO screen. 
The following code modification is required:
1  | diff --git a/arch/arm64/boot/dts/amlogic/kvim4.dts b/arch/arm64/boot/dts/amlogic/kvim4.dts  | 
PWM-F Harware Interfaces
PWM Usage
- Export PWM
1
root@Khadas:~# echo 1 > /sys/class/pwm/pwmchip4/export
 - Configure PWM period
1
root@Khadas:~# echo 1000000 > /sys/class/pwm/pwmchip4/pwm1/period
 - Configure PWM duty cycle
1
root@Khadas:~# echo 500000 > /sys/class/pwm/pwmchip4/pwm1/duty_cycle
 - Enable PWM
1
root@Khadas:~# echo 1 > /sys/class/pwm/pwmchip4/pwm1/enable
 - Disable PWM
1
root@Khadas:~# echo 0 > /sys/class/pwm/pwmchip4/pwm1/enable
 
If you successfully turn on the hardware pwm, you can see the waveform through the oscilloscope:

NoteIf you use an oscilloscope to check the waveform, remember that the board and the oscilloscope need to share the same ground.