Changes

Jump to: navigation, search

Orange Pi Zero 2W

1,068 bytes added, 11:02, 26 September 2023
PWM test method
# As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4.
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>/UART4_TX'''| '''<span style="color:#FF0000">7</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''<span style="color:#FF0000">33</span>'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-
| '''Pin'''
| '''Function'''
| '''GPIO NO.'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''| '''PI5'''| '''TWI0_SCL<span style="color:#FF0000">16</UART2_TX'''| '''15'''|| '''16span>'''| '''<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31'''|| '''>32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure below, and then use the '''space''' to select the &gt; configuration corresponding to the pwm you want to open.</p>
<p>[[File:zero2w-img176.png]]</p></li>
<li><p>Then select '''&lt;Save&gt;''' to save</p>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li>
<li><p>After restarting, you can start the PWM test</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 &gt; output a 50Hz square wave</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/export'''</p>
<p>root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm1/period'''</p>
<p>root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>
<p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}</li><li><p>Enter the following command on the command line to make pwm2 &gt; output a 50Hz square wave</p></li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''echo 2 &gt; /sys/class/pwm/pwmchip0/export'''
root@orangepi:~# '''echo 1 &gt; /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 &gt; a 50Hz square wave</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''echo 3 &gt; /sys/class/pwm/pwmchip0/export'''
root@orangepi:~# '''echo 1 &gt; /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 &gt; a 50Hz square wave</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''echo 4 &gt; /sys/class/pwm/pwmchip0/export'''
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable'''
|}
<div class="figure">
[[File:zero2w-img177.png]]
</div></ol></li></ol>
<span id="how-to-install-and-use-wiringop-python"></span>

Navigation menu