8,367
edits
Changes
→PWM test method
=== PWM test method ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The development board can use up to 4 channels of PWM, and the positions of their pins are shown in the figure below:'''</big>
[[File:media/image183.png|388x180px]]
|}
<ol style="list-style-type: decimal;">
<li><p>In the Linux system, the pwm is closed by default, and it needs to be opened manually to use it. The steps to open are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config''', normal users remember to add > '''sudo''' permission</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:media/image85.png|398x194px]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:media/image86.png|393x202px]]</p></li>
<li><p>Then use the arrow keys on the keyboard to navigate to the > position shown in the figure below, and then use the space to > select the configuration corresponding to pwm</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Since the RX and TX pins of UART5 in the PWM1, PWM2 and 26pin interfaces are multiplexed, please make sure that the UART5 configuration is not selected (do not check ph-uart5) when turning on PWM1 and PWM2 (you need to select ph-pwm12).'''</p><p>'''PWM3, PWM4 and the TX and RX pins in the debug serial port are multiplexed, so when using PWM3 and PWM4 (need to select ph-pwm34), please turn off the configuration of UART0 (need to select disable-uart0), after turning off UART0 The debug serial port cannot be used.'''</p></big>|}
<p>[[File:media/image184.png|402x156px]]</p></li>
<li><p>Then select '''<Save>''' to save</p>
<li><p>Then select '''<Back>'''</p>
<p>[[File:media/image89.png|395x91px]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect</p>
<p>[[File:media/image90.png|374x187px]]</p></li></ol>
</li>
<li><p>After restarting, the PWM test can be started</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Please execute the following commands under the root user.'''</p></big>|}
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command on the command line to make pwm1 > output a 50Hz rectangular wave</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/export'''</p>
<p>root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p>
<p>root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>
<p>root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}</li><li><p>Enter the following command on the command line to make pwm2 > output a 50Hz square wave</p></li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''echo 2 > /sys/class/pwm/pwmchip0/export'''
root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Enter the following command on the command line to make pwm3 output > a 50Hz rectangular wave</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''echo 3 > /sys/class/pwm/pwmchip0/export'''
root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable'''
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Enter the following command on the command line to make pwm4 output > a 50Hz square wave</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''echo 4 > /sys/class/pwm/pwmchip0/export'''
root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm4/enable'''
|}
<div class="figure">
[[File:media/image185.jpeg|574x344px|69D96433378187B10005CDD2A52881B0]]
</div></ol></li></ol>
<span id="how-to-install-and-use-wiringop-python"></span>
== How to install and use wiringOP-Python ==