PWM
Last updated
Last updated
SDK$
: Refers to the source code path.
console$
: Generally refers to the command-line console of the motherboard.
ADB$
: Android Debug Bridge command-line tool, generally refers to an environment where ADB can be run.
The Extend 40Pin interface contains multiple channels of PWM. The specific pins are shown in the Expansion Pin Section.
The following uses PWM2_CH7_M2 as an example for explanation.
For pwmX_Ych_Z, X represents the controller ID, Y represents the total number of channels supported by the current controller, and Z represents the channel ID.
PWM2_CH7_M2 represents:
pwm0_2ch_1: pwm@27331000
pwm2_8ch_6: pwm@2ade6000
pwm2_8ch_7: pwm@2ade7000
List relevant PWM nodes:
You can view the corresponding PWM DTS nodes:
It indicates that pwnchip0 corresponds to PWM0 Channel 1.
Configure the PWM channel:
Example: Set PWM0_CH1 channel, with a period of 10000ns, a duty cycle of 5000ns, and the polarity as normal.
After the configuration parameters are successfully set according to the example, you can use a multimeter to measure the PWM0 pin. The correct voltage should be around 1.6V.
Export the PWM channel:
Set the PWM period (frequency):
Set the PWM duty cycle:
Set the PWM polarity:
Enable PWM output: