6,556
edits
Changes
→Download orangepi-build from github
== Top view and bottom view of Orange Pi Zero 2w ==
<div class="figure">
[[File:media/image3zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:media/image4zero2w-img4.png|800px]]
</div>
<span id="orange-pi-zero-2w-interface-details"></span>
== Orange Pi Zero 2w interface details ==
<div class="figure">
[[File:media/image5zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:media/image6zero2w-img6.png|800px]]
</div>
[[File:media/image7zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The diameters of the four positioning holes are all 3.0mm.'''</big>|}
<span id="introduction-to-the-use-of-development-boards"></span>
<ol style="list-style-type: decimal;">
<li><p>TF card, high-speed SanDisk card with minimum capacity of 8GB, class 10 or above</p>
<p>[[File:media/image8zero2w-img8.png]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When using other brands of TF cards (non-SanDisk TF cards), as shown in the picture below (including but not limited to these cards), some friends have reported that problems will occur during system startup, such as the system getting stuck halfway through startup. Or the reboot command cannot be used normally, and it was finally solved after replacing the SanDisk TF card. Therefore, if you are using a non-SanDisk TF card and find problems with system startup or use, please replace it with a SanDisk TF card and then test again.'''</p></big><p>[[File:media/image9zero2w-img9.png]][[File:media/image10zero2w-img10.png]][[File:media/image11zero2w-img11.png]][[File:media/image12zero2w-img12.png]]</p><pstyle="text-align: center;">'''There are currently reports that some TF cards have problems booting on Orange Pi Zero 2w.'''</p><big><p>'''In addition, TF cards that can be used normally on other types of development boards are not guaranteed to be able to start normally on Orange Pi Zero 2w. Please pay special attention to this point.'''</p></big>|}</li>
<li><p>TF card reader, used to read and write TF cards</p>
<p>[[File:media/image13zero2w-img13.png]]</p></li><li><p>Mini HDMI to HDMI cable, used to connect the development board to an HDMI monitor or TV for display</p></li></ol>
<div class="figure">
[[File:media/image14zero2w-img14.png]]
</div></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Power supply. If you have a 5V/2A or 5V/3A power supply, you only need to prepare a USB to Type C interface data cable as shown in the picture on the left below. You can also use a cable similar to the picture on the right below. 5V/2A or 5V/3A high-quality USB Type C interface power adapter integrated with the power head.</p>
<p>[[File:media/image15zero2w-img15.png]] [[File:media/image16zero2w-img16.png]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Both Type-C interfaces on the development board can be used for power supply.'''</p></big>
<div class="figure">
[[File:media/image17zero2w-img17.png|252x143px|003]]
</div>|}</li>
<li><p>24pin expansion board</p>
<p>[[File:media/image18zero2w-img18.png|211x110px]]</p></li>
<li><p>USB interface mouse and keyboard, as long as it is a standard USB interface mouse and keyboard, the mouse and keyboard can be used to control the Orange Pi development board</p></li>
<li><p>Infrared remote control, mainly used to control Android TV system</p>
<p>[[File:media/image19zero2w-img19.png|170x173px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the remote control of the air conditioner or the TV cannot control the Orange Pi development board. By default, only the remote control provided by Orange Pi can.'''</p></big>|}</li>
<li><p>Network cable to connect the development board to the Internet</p></li>
<li><p>AV video cable. If you want to display video through the TV-OUT interface instead of the HDMI interface, you need to connect the development board to the TV through the AV video cable.</p>
<p>[[File:media/image20zero2w-img20.png|217x218px]]</p></li>
<li><p>Heat sink. If you are worried that the temperature of the development board is too high, you can add some heat sinks and stick the heat sinks on the H618 chip and memory chip.</p>
<p>[[File:media/image21zero2w-img21.png|162x133px]] [[File:media/image22zero2w-img22.png|287x143px]]</p></li>
<li><p>5V cooling fan, as shown in the figure below. There are 5V and GND pins on the 40pin interface of the development board that can be connected to the cooling fan. The spacing of the 40pin pins is 2.54mm. The power interface of the cooling fan can be purchased according to this specification.</p>
<p>[[File:media/image23zero2w-img23.png|263x142px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the 5V pin can be used directly after the development board is plugged in and no other settings are required. In addition, the voltage output by the 5V pin cannot be adjusted or turned off through software.'''</p><p>'''The pin headers on the 40pin interface are not soldered by default, and you need to solder them yourself before you can use them.'''</p></big>|}</li>
<li><p>Type-C to USB cable for connecting USB devices</p>
<p>[[File:media/image24zero2w-img24.png|193x127px]]</p></li>
<li><p>USB to TTL module and Dupont cable. When using the serial port debugging function, a USB to TTL module and Dupont cable are needed to connect the development board and the computer.</p>
<p>[[File:media/image25zero2w-img25.png|176x118px]] [[File:media/image26zero2w-img26.png|305x110px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the TTL level used by the development board is 3.3v. In addition to the USB to TTL module shown in the picture above, other similar 3.3v USB to TTL modules are generally available.'''</p></big>|}</li><li><p>X64 computer with Ubuntu and Windows operating systems installed</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| 1
| For burning Android and Linux images
|}
</ol>
<span id="download-the-development-board-image-and-related-information"></span>
== Download the development board image and related information ==
# The download URL for the Chinese version of the information is
::{| class="wikitable" style="width:800px;" |-| [http://www.orangepi.cn/downloadresourcescnhtml/hardWare/computerAndMicrocontrollers/service-and-support/ Orange-Pi-Zero-2W.html '''http://www.orangepi.cn/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-2W.html''']|}
<ol start="2" style="list-style-type: decimal;">
<li><p>The download URL for the English version of the information is</p>
{| class="wikitable" style="width:800px;" |-| <p>[http://www.orangepi.org/downloadresourceshtml/hardWare/computerAndMicrocontrollers/service-and-support/ Orange-Pi-Zero-2W.html '''http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-2W.html''']</p>|}</li>
<li><p>The information mainly includes</p>
:<p>a.'''Android source code''': saved on Google Cloud Drive</p>:<p>b.'''Linux source code''': saved on Github</p>:<p>c.'''Android image''': saved on Google Cloud Drive</p>:<p>d.'''Ubuntu image''': saved on Google Cloud Drive</p>:<p>e.'''Debian image''': saved on Google Cloud Drive</p>:<p>f.'''Orange Pi OS (Arch) image''': saved on Google Cloud Drive</p>:<p>g. '''User manual and schematic diagram''': chip-related data manuals will also be placed here</p>:<p>h.'''Official tools''': mainly include software needed when using the development board</p></li></ol>
<span id="method-of-burning-linux-image-to-tf-card-based-on-windows-pc"></span>
== Method of burning Linux image to TF card based on Windows PC ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that the Linux image mentioned here specifically refers to the Linux distribution image such as Debian or Ubuntu downloaded from the Orange Pi information download page.'''</big>|}
<span id="how-to-burn-linux-image-using-balenaetcher"></span>
# First prepare a TF card with 8GB or larger capacity. The transmission speed of the TF card must be class10 or above. It is recommended to use TF cards from SanDisk and other brands.
# Then use the card reader to insert the TF card into the computer
# Download the compressed package of the Linux operating system image file you want to burn from the [http://www.orangepi.org/html/serviceAndSupporthardWare/indexcomputerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-2W.html '''Orange Pi information download page'''], and then use the decompression software to decompress it. In the decompressed file, the file ending with ".img" is the image file of the operating system. The size is generally above 1GB
# Then download the Linux image burning software-'''balenaEtcher''', the download address is
::{| class="wikitable" style="width:800px;"
|-
|
[https://www.balena.io/etcher/ '''https://www.balena.io/etcher/''']
|}
<ol start="5" style="list-style-type: decimal;">
<li><p>After entering the balenaEtcher download page, click the green download button to jump to the software download location.</p>
<p>[[File:media/image27zero2w-img27.png|456x219px]]</p></li>
<li><p>Then you can choose to download the Portable version of balenaEtcher software. The Portable version does not need to be installed. You can use it by double-clicking to open it.</p>
<p>[[File:media/image28zero2w-img28.png|468x173px]]</p></li>
<li><p>If you downloaded the version of balenaEtcher that needs to be installed, please install it first and then use it. If you downloaded the Portable version of balenaEtcher, just double-click to open it. The balenaEtcher interface after opening is as shown below.</p>
<p>[[File:media/image29zero2w-img29.png|335x211px]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If the following error is prompted when opening balenaEtcher:'''</olbig>
[[File:zero2w-img31.png|center]]
|}
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>The specific steps to use balenaEtcher to burn a Linux image are as follows</p>
:<p>a. First select the path of the Linux image file to be burned.</p>:<p>b. Then select the drive letter of the TF card</p>:<p>c. Finally click Flash and it will start burning the Linux image to the TF card.</p>
<div class="figure">
:[[File:media/image32zero2w-img32.png|501x281px|03]]
</div></li>
<li><p>The interface displayed during the process of burning the Linux image by balenaEtcher is as shown in the figure below. In addition, the progress bar displays purple to indicate that the Linux image is being burned into the TF card.</p>
<p>[[File:media/image33zero2w-img33.png|506x317px]]</p></li>
<li><p>After the Linux image is burned, balenaEtcher will also verify the image burned into the TF card by default to ensure that there are no problems during the burning process. As shown in the figure below, a green progress bar indicates that the image has been burned, and balenaEtcher is verifying the burned image.</p>
<p>[[File:media/image34zero2w-img34.png|519x325px]]</p></li>
<li><p>After successful burning, the display interface of balenaEtcher is as shown below. If the green indicator icon is displayed, it means that the image burning is successful. At this time, you can exit balenaEtcher, then pull out the TF card and insert it into the TF card slot of the development board for use.</p>
<div class="figure">
[[File:media/image35zero2w-img35.png|523x324px|04]]
</div></li></ol>
<li><p>Then format the TF card</p>
<ol style="list-style-type: lower-alpha;">
<li>You can use the '''SD Card Formatter''' software to format the TF card. Its download address is:</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[https://www.sdcard.org/downloads/formatter/eula_windows/SDCardFormatterv5_WinEN.zip '''https://www.sdcard.org/downloads/formatter/eula_windows/SDCardFormatterv5_WinEN.zip''']
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>After downloading, just unzip and install it, and then open the software.</p></li>
<div class="figure">
[[File:media/image36zero2w-img36.png|209x228px|选区_199]]
</div></li>
<li><p>Then click "'''Format'''". A warning box will pop up before formatting. After selecting "'''Yes (Y)'''", formatting will begin.</p></li></ol> [[File:media/image37.png|304x147px]]
[[File:zero2w-img37.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>After formatting the TF card, the information shown in the picture below will pop up, click OK.</p>
<p>[[File:media/image38zero2w-img38.png|186x149px]]</p></li></ol> <!-- --/li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Download the compressed package of the Linux operating system image file you want to burn from the [http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-2W.html '''Orange Pi information download page'''], and then use the decompression software to decompress it. In the decompressed file, the file ending with ".img" is the image file of the operating system. The size is generally above 1GB</p></li>
<li><p>Use '''Win32Diskimager''' to burn the Linux image to the TF card</p>
<ol style="list-style-type: lower-alpha;">
<li>The download page of Win32Diskimager is</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[http://sourceforge.net/projects/win32diskimager/files/Archive/ '''http://sourceforge.net/projects/win32diskimager/files/Archive/''']
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>After downloading, you can install it directly. The Win32Diskimager interface is as follows</p>
<div class="figure">
[[File:media/image39zero2w-img39.png|297x206px|C:\Users\orangepi\Desktop\用户手册插图\Pi5 Plus\a8fda8737c5b0b3b38fbb75ef68acfc.pnga8fda8737c5b0b3b38fbb75ef68acfc]]
</div></li>
<li><p>After the image writing is completed, click the "'''Exit'''" button to exit. Then you can pull out the TF card and insert it into the development board to start.</p></li></ol>
</li></ol>
<span id="method-to-burn-linux-image-to-tf-card-based-on-ubuntu-pc"></span>
== Method to burn Linux image to TF card based on Ubuntu PC ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that the Linux image mentioned here specifically refers to the Linux distribution image such as Debian or Ubuntu downloaded from the Orange Pi information download page. Ubuntu PC refers to the personal computer with the Ubuntu system installed.'''</big>|}
# First prepare a TF card with 8GB or larger capacity. The transmission speed of the TF card must be class10 or above. It is recommended to use TF cards from SanDisk and other brands.
# Download the balenaEtcher software, the download address is
::{| class="wikitable" style="width:800px;"
|-
|
[https://www.balena.io/etcher/ '''https://www.balena.io/etcher/''']
|}
<ol start="4" style="list-style-type: decimal;">
<li><p>After entering the balenaEtcher download page, click the green download button to jump to the software download place.</p>
<p>[[File:media/image27zero2w-img27.png|489x235px]]</p></li>
<li><p>Then choose to download the Linux version of the software</p>
<p>[[File:media/image40zero2w-img40.png|485x184px]]</p></li><li><p>Download the compressed package of the Linux operating system image file you want to burn from the [http://www.orangepi.org/html/serviceAndSupporthardWare/computerAndMicrocontrollers/service-and-support/indexOrange-Pi-Zero-2W.html '''Orange Pi information download page'''], and then use the decompression software to decompress it. In the decompressed file, the file ending with ".img" is the image file of the operating system. The size is generally above 1GB. The decompression command for the compressed package ending in 7z is as follows:</p>{| class="wikitable" style="width:800px;" |-|
<p>test@test:~$ '''7z x orangepizero2w_1.0.0_ubuntu_focal_desktop_linux6.1.31.7z'''</p>
<p>test@test:~$ '''ls orangepizero2w_1.0.0_ubuntu_focal_desktop_linux6.1.31.*'''</p>
<p>orangepizero2w_1.0.0_ubuntu_focal_desktop_linux6.1.31.7z </p><p>'''orangepizero2w_1.0.0_ubuntu_focal_desktop_linux6.1.31.sha''' #Checksum file</p><p>'''orangepizero2w_1.0.0_ubuntu_focal_desktop_linux6.1.31.img''' #Image file</p>|}</li>
<li><p>After decompressing the image, you can first use the '''sha256sum -c *.sha''' command to calculate whether the checksum is '''correct'''. If it prompts that it is successful, it means that the downloaded image is correct, and you can burn it to the TF card with confidence. If it prompts that the '''checksum does not match''', it means There is a problem with the downloaded image, please try downloading again</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sha256sum -c *.sha'''</p>
<p>orangepizero2w_1.0.0_ubuntu_focal_desktop_linux6.1.31.img: '''successful'''</p>|}</li>
<li><p>Then double-click '''balenaEtcher-1.14.3-x64.AppImage''' on the graphical interface of Ubuntu PC to open balenaEtcher '''(no installation required)'''. The interface after balenaEtcher is opened is as shown below</p>
<p>[[File:media/image41zero2w-img41.png|423x251px]]</p></li>
<li><p>The specific steps to use balenaEtcher to burn a Linux image are as follows</p>
<p>a. First select the path of the Linux image file to be burned.</p>
<div class="figure">
[[File:media/image32zero2w-img32.png|501x281px|03]]
</div></li>
<li><p>The interface displayed during the process of burning the Linux image by balenaEtcher is as shown in the figure below. In addition, the progress bar displays purple to indicate that the Linux image is being burned into the TF card.</p>
<p>[[File:media/image42zero2w-img42.png|576x247px]]</p></li>
<li><p>After the Linux image is burned, balenaEtcher will also verify the image burned into the TF card by default to ensure that there are no problems during the burning process. As shown in the figure below, a green progress bar indicates that the image has been burned, and balenaEtcher is verifying the burned image.</p>
<p>[[File:media/image43zero2w-img43.png|576x252px]]</p></li>
<li><p>After successful burning, the display interface of balenaEtcher is as shown below. If a green indicator icon is displayed, it means that the image burning is successful. At this time, you can exit balenaEtcher, then pull out the TF card and insert it into the TF card slot of the development board for use.</p>
<p>[[File:media/image44zero2w-img44.png|576x340px]]</p></li></ol>
<span id="method-of-burning-android-image-to-tf-card"></span>
== Method of burning Android image to TF card ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The Android image of the development board can only be burned to the TF card using the <span style="color:#FF0000">PhoenixCard </span> software under the Windows platform. The version of the PhoenixCard software must be <span style="color:#FF0000">PhonixCard-4.2.8</span>.'''
'''Please do not use software to burn Linux images, such as Win32Diskimager or balenaEtcher to burn Android images.'''
'''In addition, PhoenixCard software does not have versions for Linux and Mac platforms, so it is impossible to burn Android images to TF cards under Linux and Mac platforms.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First, please make sure that '''Microsoft Visual C++ 2008 Redistrbutable - x86'''</p>
<p>is installed on your Windows system.</p>
<p>[[File:media/image45zero2w-img45.png|449x293px]]</p></li><li><p>If '''Microsoft Visual C++ 2008 Redistrbutable - x86''' is not installed</p><p>, using '''PhoenixCard''' to format the TF card or burn the Android image will prompt the following error</p>
<div class="figure">
[[File:media/image46zero2w-img46.png|522x395px|NUQB$Q%(){1CV6M6WK4N`5J]]
</div></li>
<li><p>'''Microsoft Visual C++ 2008 Redistrbutable - x86''' installation package can be downloaded from the [http://www.orangepi.org/html/serviceAndSupporthardWare/indexcomputerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-2W.html '''official tool'''] of Orange Pi Zero 2w, or you can download it from [https://www.microsoft.com/zh-cn/download/details.aspx?id=26368 '''Microsoft's official website''']</p><p>[[File:media/image47zero2w-img47.png|242x52px]] [[File:media/image48zero2w-img48.png|200x95px]]</p></li>
<li><p>Then prepare a TF card with 8GB or larger capacity. The transmission speed of the TF card must be class10 or above. It is recommended to use TF cards from SanDisk and other brands.</p></li>
<li><p>Then use the card reader to insert the TF card into the computer</p></li>
<li><p>Download the Android image and PhoenixCard burning tool from the [http://www.orangepi.org/html/serviceAndSupporthardWare/indexcomputerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-2W.html '''Orange Pi download page''']. Please ensure that the version of the PhonenixCrad tool is '''<span style="color:#FF0000">PhonixCard-4.2.8. Please do not use PhonixCard software with a version lower than 4.2.8 to burn the Android image</span>'''. Low There may be problems with the Android image programmed with this version of PhonixCard tool.</p>
<div class="figure">
[[File:media/image49zero2w-img49.png|575x169px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-6.jpg未标题-6]]
</div></li>
<li><p>Then use decompression software to decompress the compressed package of the downloaded Android image. In the decompressed file, the file ending with "'''.img'''" is the Android image file, with a size of more than 1GB. If you don’t don't know how to decompress the Android image compressed package, you can install a '''360 compression software''' to decompress the image.</p><p>[[File:media/image50zero2w-img50.png|438x158px]]</p></li>
<li><p>Then use decompression software to decompress '''PhonixCard4.2.8.zip'''. This software does not need to be installed. Just find PhoenixCard in the decompressed folder and open it.</p>
<p>[[File:media/image51zero2w-img51.png|576x113px]]</p></li><li><p>After opening PhoenixCard, if the TF card is recognized normally, the drive letter and capacity of the TF card will be displayed in the middle list. '''<span style="color:#FF0000">Please make sure that the displayed drive letter is consistent with the drive letter of the TF card you want to burn</span>'''. If If there is no display, you can try to remove the TF card, or click the "'''Refresh Drive Letter'''" button in PhoenixCard.</p></li></ol> [[File:media/image52.png|575x137px]]
[[File:zero2w-img52.png]]
</ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>After confirming the drive letter, format the TF card first and click the "'''Restore Card'''" button in PhoenixCard (if the "'''Restore Card'''" button is gray and cannot be pressed, you can click the "'''Refresh Drive Letter'''" button first)</p>
<div class="figure">
[[File:media/image53zero2w-img53.png|575x316px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-1.jpg未标题-1]]
</div>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''If there is a problem with formatting, please try to remove the TF card and then test again. If there is still a problem after re-inserting the TF card, you can restart the Windows computer or try another computer.'''</p></big>|}</li>
<li><p>Then start writing the Android image to the TF card</p>
<p>a. First select the path to the Android image in the "'''Firmware'''" column</p>
<p>b. Select "'''Start Card'''" in "'''Card Type'''"</p>
<p>c. Then click the "'''Burn Card'''" button to start burning.</p>
<p>[[File:media/image54zero2w-img54.png|576x431px]]</p></li>
<li><p>After burning, the display of PhoenixCard is as shown below. At this time, click the "'''Close'''" button to exit PhoenixCard, and then you can pull out the TF card from the computer and insert it into the development board to start.</p>
<div class="figure">
[[File:media/image55zero2w-img55.png|575x358px|1]]
</div>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''After burning the Android system, you can only see a 128 MB partition on the TF card in Windows. The displayed partition is as shown below (some computers may pop up more than twenty disk partitions, but they can only open the 128 MB one. partition), please note that this is normal, please do not think that the TF card is burned out. The reason for this is that there are more than twenty partitions in the Android system, but most of them cannot be recognized normally in the Windows system. At this time, please feel free to unplug the TF card and insert it into the development board to start.'''</p></big><p>[[File:media/image56zero2w-img56.png|193x45pxcenter]]</p><big><p>'''After the Android system starts, you can use the following command to see the twenty partitions in the TF card:'''</p></big><p>[[File:media/image57zero2w-img57.png|368x131pxcenter]]</p><big><p>'''Using the df -h command, you can see that after burning the Android system on the 16GB TF card, there is about 11 GB of space available (not all of the more than twenty partitions will be mounted to the Android system, focus on these to see to the partition you want to reach).'''</p></big><p>[[File:media/image58zero2w-img58.png|391x220pxcenter]]</p>|}</li></ol>
<span id="instructions-for-using-micro-linux-system-in-onboard-spi-flash"></span>
== Instructions for using micro-linux system in onboard SPI Flash ==
There is a 16MB SPI Flash on the development board, and its location is shown in the figure below:
[[File:media/image59zero2w-img59.png|284x124px]]
A micro Linux system is programmed into SPI Flash by default. This system is mainly used to prove that the development board can start normally. After getting the development board, there is no need to burn the system into the TF card. You only need to connect the Type-C power supply to the development board to start the micro Linux system in the SPI Flash. The main functions of this system are:
<ol style="list-style-type: lower-alpha;">
<li><p>After booting into the kernel, the green LED light will flash;</p></li>
<li><p>If the development board is connected to an HDMI screen, after the > system startup is completed, the command line interface of the > micro Linux system can be seen on the HDMI screen.</p></li></ol><p>'''<span style="color:#FF0000">I would like to emphasize again that the micro Linux system in SPI Flash is only used to prove that the development board can start normally (you can light up the development board without burning the system). If you find that there are other problems with the system in SPI Flash (such as serial port Unable to log in), please ignore it.</span>'''</p><p>If you want to use the development board normally, please burn Ubuntu, Debian and other Linux images or Android images to the TF card, and then use it.</p></li></ol>
<span id="start-the-orange-pie-development-board"></span>
== Start the Orange Pie development board ==
# Connect a high-quality power adapter with a 5V/2A (5V/3A is also available) USB Type C interface
::{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Remember not to plug in a power adapter with a voltage output greater than 5V, as it will burn out the development board.</span>'''
'''<span style="color:#FF0000">Many unstable phenomena during system power-on and startup are basically caused by power supply problems, so a reliable power adapter is very important. If you find that you are constantly restarting during the startup process, please replace the power supply or Type C data cable and try again.</span>'''</big>|}::{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Both Type-C interfaces on the development board can be used for power supply.'''</big>
<div class="figure">
[[File:media/image17zero2w-img17.png|258x146px|003center]]
</div>
|}
<ol start="6" style="list-style-type: decimal;">
<li><p>Then turn on the power adapter. If everything is normal, the system startup screen will be visible on the HDMI monitor.</p></li>
<li><p>If you want to view the output information of the system through the debugging serial port, please use the serial port cable to connect the development board to the computer. For the serial port connection method, please refer to the [[Orange Pi Zero 2W#How to use the debugging serial port | '''section on how to use the debugging serial port''']].</p></li></ol>
<span id="how-to-use-the-debugging-serial-port"></span>
== How to use the debugging serial port ==
<div class="figure">
[[File:media/image60zero2w-img60.png|552x110px|7]]
</div></li>
<li><p>The corresponding relationship between the GND, TX and RX pins of the debugging serial port of the development board is shown in the figure below</p>
<p>[[File:media/image61zero2w-img61.png|345x156px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</p></big>|}</li>
<li><p>The GND, TX and RX pins of the USB to TTL module need to be connected to the debugging serial port of the development board through Dupont lines.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Connect the GND of the USB to TTL module to the GND of the > development board</p></li><li><p>'''<span style="color:#FF0000">Connect the RX of the USB to TTL module to the TX of the > development board</span>'''</p></li><li><p>'''<span style="color:#FF0000">Connect the TX of the USB to TTL module to the RX of the > development board</span>'''</p></li></ol>
</li>
<li><p>The schematic diagram of connecting the USB to TTL module to the computer and Orange Pi development board is as shown below</p>
<p>[[File:media/image62zero2w-img62.png|553x204px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The TX and RX of the serial port need to be cross-connected. If you don’t don't want to carefully distinguish the order of TX and RX, you can casually connect the TX and RX of the serial port first. If there is no output from the test serial port, then exchange the order of TX and RX, so that the There is a right order.'''</p></big>|}</li></ol>
<span id="how-to-use-the-debugging-serial-port-on-ubuntu-platform"></span>
=== How to use the debugging serial port on Ubuntu platform ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''There are many serial port debugging software that can be used under Linux, such as putty, minicom, etc. The following demonstrates how to use putty.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First insert the USB to TTL module into the USB interface of the Ubuntu computer. If the USB to TTL module is connected and recognized normally, you can see the corresponding device node name under '''/dev''' of the Ubuntu PC. Remember this node name and set the serial port later. software will be used</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''ls /dev/ttyUSB*'''</p>
<p>'''/dev/ttyUSB0'''</p>|}</li>
<li><p>Then use the following command to install putty on Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt update'''</p>
<p>test@test:~$ '''sudo apt install -y putty'''</p>|}</li><li><p><span class="mark">Then run putty,</span> '''<span style="color:#FF0000">remember to add sudo permissions</span>'''</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo putty'''</p>|}</li>
<li><p>After executing the putty command, the following interface will pop up</p>
<p>[[File:media/image63zero2w-img63.png|332x290px]]</p></li>
<li><p>First select the serial port setting interface</p>
<div class="figure">
[[File:media/image64zero2w-img64.png|337x297px|9]]
</div></li>
<li><p>Then set the parameters of the serial port</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Set the '''Serial line to connect to''' to '''/dev/ttyUSB0''' > (modify to the corresponding node name, usually > '''/dev/ttyUSB0''')</p></li>
<li><p>Set '''Speed(baud)''' to '''115200''' (baud rate of the serial port)</p></li>
<li><p>Set '''Flow control''' to '''None'''</p>
<div class="figure">
[[File:media/image65zero2w-img65.png|366x359px|未标题-17]]
</div></li></ol>
<div class="figure">
[[File:media/image66zero2w-img66.png|375x333px|11]]
</div></li></ol>
</li>
<li><p>Then start the development board, and you can see the Log information output by the system from the open serial terminal.</p>
<p>[[File:media/image67zero2w-img67.png|376x249px]]</p></li></ol>
<span id="how-to-use-the-debugging-serial-port-on-windows-platform"></span>
=== How to use the debugging serial port on Windows platform ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''There are many serial port debugging software that can be used under Windows, such as SecureCRT, MobaXterm, etc. The following demonstrates how to use MobaXterm. This software has a free version and can be used without purchasing a serial number.'''</big>|}
<ol style="list-style-type: decimal;">
<ol style="list-style-type: lower-alpha;">
<li><p>Download MobaXterm URL as follows</p>
{| class="wikitable" style="width:800px;" |-| <p>[https://mobaxterm.mobatek.net/ '''https://mobaxterm.mobatek.net/''']</p>|}</li>
<li><p>Enter the MobaXterm download webpage and click '''GET XOBATERM > NOW!'''</p>
<p>[[File:media/image68zero2w-img68.png|382x233px]]</p></li>
<li><p>Then choose to download the Home version</p>
<p>[[File:media/image69zero2w-img69.png|353x231px]]</p></li>
<li><p>Then select the Portable version. There is no need to install it after downloading. You can open it directly and use it.</p>
<div class="figure">
[[File:media/image70zero2w-img70.png|322x175px|选区_232]]
</div></li></ol>
</li>
<li><p>After downloading, use decompression software to decompress the downloaded compressed package to get the executable software of MobaXterm, and then double-click to open it.</p>
<p>[[File:media/image71zero2w-img71.png|576x83px]]</p></li>
<li><p>After opening the software, the steps to set up the serial port connection are as follows:</p>
:<p>a. Open the session settings interface</p>:<p>b. Select the serial port type</p>:<p>c. Select the port number of the serial port (select the corresponding port number according to the actual situation). If you cannot see the port number, please use '''360 Driver Master''' to scan and install the driver for the USB to TTL serial port chip.</p>:<p>d.Select the baud rate of the serial port to '''115200'''</p>:<p>e. Finally click the "'''OK'''" button to complete the settings</p></li></ol>
<div class="figure">
::[[File:media/image72zero2w-img72.png|553x280px|12]]
</div></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>After clicking the "'''OK'''" button, you will enter the following interface. At this time, start the development board and you can see the output information of the serial port.</p>
<div class="figure">
[[File:media/image73zero2w-img73.png|628x318px|13]]
</div></li></ol>
<span id="instructions-for-using-the-5v-pin-in-the-40pin-interface-of-the-development-board-for-power-supply"></span>
== Instructions for using the 5v pin in the 40pin interface of the development board for power supply ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The power supply method we recommend for the development board is to use a 5V/2A or 5V/3A Type C interface power cord and plug it into the development board's Type C power interface. If you need to use the 5V pin in the 40-pin interface to power the development board, please ensure that the power cable used can meet the power supply requirements of the development board. If the use is unstable, please switch to Type C power supply.'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<ol style="list-style-type: decimal;">
<div class="figure">
[[File:media/image74zero2w-img74.png|223x160px|图片4]]
</div>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The power cord shown in the picture above can be purchased on Taobao, please search and buy it yourself.'''</p></big>|}</li>
<li><p>Use the 5V pin in the 40pin interface to power the development board. The power cord connection is as follows:</p>
<p>a. The USB-A port of the power cord shown in the picture above needs to be plugged into the 5V/2A or 5V/3A power adapter connector.</p>
<p>b. The red DuPont wire needs to be plugged into the 5V pin of the 40pin interface of the development board</p>
<p>c. The black DuPont wire needs to be plugged into the GND pin of the 40pin interface</p>
<p>d. The positions of the 5V pin and GND pin of the 40pin interface in the development board are as shown in the figure below. '''<span style="color:#FF0000">Remember not to connect them reversely.</span>'''</p><p>[[File:media/image23zero2w-img23.png|345x187px]]</p></li></ol>
<span id="debianubuntu-server-and-xfce-desktop-system-usage-instructions"></span>
= '''Debian/Ubuntu Server and Xfce desktop system usage instructions''' =
== Supported linux image types and kernel versions ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Linux image type'''
|}
After entering the download page of the corresponding development board on the [http://www.orangepi.org/html/serviceAndSupporthardWare/indexcomputerAndMicrocontrollers/service-and-support/Orange-Pi-Zero-2W.html '''Orange Pi data download page'''], you can see the following download options. In the description below, '''Ubuntu images and Debian images are generally referred to as Linux images'''.
<div class="figure">
[[File:media/image75zero2w-img75.png|242x135px|1695354537340]]
</div>
The naming rules for Linux images are:
{| class="wikitable" style="width:800px;"
|-
|
'''Development board model_version number_Linux distribution type_distribution code_server or desktop_kernel version'''
|}
a. '''Development board models''': all are '''orangepizero2w'''. The model names of different development boards are generally different. Before burning the image, please make sure that the model name of the selected image matches the development board.
<span id="linux-kernel-driver-adaptation-situation"></span>
== Linux kernel driver adaptation situation ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Board functions'''
|-
| '''Mali GPU'''
| '''<span style="color:#FF0000">NO</span>'''| '''<span style="color:#FF0000">NO</span>'''
|-
| '''Video codec'''
| '''<span style="color:#FF0000">NO</span>'''| '''<span style="color:#FF0000">NO</span>'''
|}
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin expansion board function'''
|-
| '''TV-OUT'''
| '''<span style="color:#FF0000">NO</span>'''| '''<span style="color:#FF0000">NO</span>'''
|}
<span id="linux-command-format-description-in-this-manual"></span>
== Linux command format description in this manual ==
<ol style="list-style-type: decimal;">
<li><p>All commands that need to be entered in the Linux system in this manual will be enclosed in the following boxes</p>
{| class="wikitable" style="width:800px;height:40px;" |-| |}<p>As shown below, the content in the yellow box indicates content that requires special attention, except for the commands inside.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;height:40px;" |-| |}</li>
<li><p>Description of the prompt type before the command</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The prompt in front of the command refers to the red part in the > box below. This part is not part of the Linux command. > Therefore, when entering commands in the Linux system, please > do not also enter the content in the red font.</p>{| class="wikitable" style="width:800px;" |-| <p>'''<span style="color:#FF0000">orangepi@orangepi:~$ </span> sudo apt update'''</p><p>'''<span style="color:#FF0000">root@orangepi:~#</span>''' '''vim /boot/boot.cmd'''</p><p>'''<span style="color:#FF0000">test@test:~$ </span> ssh [mailto:root@192.168.1.36 root@192.168.1.]xxx'''</p><p>'''<span style="color:#FF0000">root@test:~# </span> ls'''</p>|}</li><li><p>'''<span style="color:#FF0000">root@orangepi:~$</span>''' prompt indicates that this command is > entered in the '''Linux system of the development board'''. The > '''<span style="color:#FF0000">$</span>''' at the end of the prompt indicates that the current > user of the system is an ordinary user. When executing a > privileged command, '''sudo''' needs to be added.</p></li><li><p>'''<span style="color:#FF0000">root@orangepi:~#</span>''' The prompt indicates that this command is > entered in the '''Linux system of the development board'''. The > '''<span style="color:#FF0000">#</span>''' at the end of the prompt indicates that the current > user of the system is the root user and can execute any > command you want to execute.</p></li><li><p>'''<span style="color:#FF0000">test@test:~$</span>''' prompt indicates that this command was > entered in the Ubuntu PC or Ubuntu virtual machine, not the > Linux system of the development board. The '''<span style="color:#FF0000">$</span>''' at the end > of the prompt indicates that the current user of the system is > an ordinary user. When executing privileged commands, sudo > needs to be added.</p></li><li><p>'''<span style="color:#FF0000">root@test:~#</span>''' prompt indicates that this command is entered > in the Ubuntu PC or Ubuntu virtual machine, not the Linux > system of the development board. The '''<span style="color:#FF0000">#</span>''' at the end of the > prompt indicates that the current user of the system is the > root user and can execute any command you want to execute.</p></li></ol>
</li>
<li><p>What are the commands that need to be entered?</p>
<ol style="list-style-type: lower-alpha;">
<li><p>As shown below, the '''bold black part''' is the command that > needs to be input. The content below the command is the output > content (some commands have output, and some may not output). > This part of the content does not need to be input.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''cat /boot/orangepiEnv.txt'''</p>
<p>'''<span style="color:#FF0000">verbosity=7</span>'''</p>
<p>bootlogo=false</p>
<p>'''<span style="color:#FF0000">console=serial</span>'''</p></li><li>|}</li><li><p>As shown below, some commands that cannot be written in one line > will be placed on the next line. As long as the black and bold > parts are the commands that need to be entered. When these > commands are entered into one line, the "\" at the end of > each line needs to be removed. This is not part of the > command. In addition, different parts of the command have > spaces, please don’t don't miss them.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''echo \'''</p>
<p>'''"deb [arch=$(dpkg --print-architecture) \'''</p>
<p>'''signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \'''</p>
<p>'''https://download.docker.com/linux/debian \'''</p>
<p>'''$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null'''</p>|}</li></ol>
</li></ol>
<span id="linux-system-login-instructions"></span>
== Linux system login instructions ==
=== Linux system default login account and password ===
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Account'''
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when entering a password, <span style="color:#FF0000">the specific content of the entered password will not be displayed on the screen</span>. Please do not think that there is any malfunction. Just press Enter after entering the password.'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When you are prompted for an incorrect password or there is a problem with the ssh connection, please note that as long as you are using the Linux image provided by Orange Pi, <span style="color:#FF0000">please do not suspect that the above password is incorrect</span>, but look for other reasons.'''</big>|}
=== How to set up automatic login of Linux system terminal ===
<ol style="list-style-type: decimal;">
<li><p>The Linux system automatically logs in to the terminal by default. The default login user name is '''<span style="color:#FF0000">orangepi</span>'''</p><p>[[File:media/image76zero2w-img76.png|475x240px]]</p></li>
<li><p>Use the following command to set the root user to automatically log in to the terminal</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo auto_login_cli.sh root'''</p>|}</li>
<li><p>Use the following command to disable automatic login to the terminal</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo auto_login_cli.sh -d'''</p>|}</li>
<li><p>Use the following command to set the orangepi user to automatically log in to the terminal again</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo auto_login_cli.sh orangepi'''</p>|}</li></ol>
<span id="instructions-for-automatic-login-of-linux-desktop-version-system"></span>
=== Instructions for automatic login of Linux desktop version system ===
<div class="figure">
[[File:media/image77zero2w-img77.png|576x324px|1]]
</div></li>
<li><p>Run the following command to prevent the desktop system from automatically logging into the desktop.</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo disable_desktop_autologin.sh'''</p>|}</li><li><p>Then restart the system and a login dialog box will appear. At this time, you need to enter a password to enter the system.</p></li></ol>
<div class="figure">
[[File:media/image78zero2w-img78.png|569x320px|IMG_256]]
</div></ol>
<span id="setting-method-for-automatic-login-of-root-user-in-linux-desktop-system"></span>
=== Setting method for automatic login of root user in Linux desktop system ===
<ol style="list-style-type: decimal;">
<li><p>Execute the following command to set the desktop version of the system to automatically log in using the root user</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo desktop_login.sh root'''</p>|}</li>
<li><p>Then restart the system and you will automatically log in to the desktop as the root user.</p>
<p>[[File:media/image79zero2w-img79.png|294x123px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that if you use the root user to log in to the desktop system, you cannot use pulseaudio in the upper right corner to manage audio devices.'''</p><p>'''Also please note that this is not a bug, because pulseaudio is not allowed to run under the root user.'''</p></big>|}</li>
<li><p>Execute the following command to set up the desktop version of the system again to use the orangepi user to automatically log in</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo desktop_login.sh orangepi'''</p>|}</li></ol>
<span id="how-to-disable-the-desktop-in-linux-desktop-system"></span>
=== How to disable the desktop in Linux desktop system ===
<ol style="list-style-type: decimal;">
<li><p>First enter the following command on the command line, '''<span style="color:#FF0000">please remember to add sudo permissions</span>'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo systemctl disable lightdm.service'''</p>|}</li>
<li><p>Then restart the Linux system and you will find that the desktop will not be displayed.</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo reboot'''</p>|}</li><li><p>'''The command to reopen the desktop is as follows, <span style="color:#FF0000">please remember to add sudo permissions</span>'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo systemctl start lightdm.service'''</p><p>orangepi@orangepi:~$ '''sudo systemctl enable lightdm.service'''</p>|}</li></ol>
<span id="onboard-led-light-test-instructions"></span>
== Onboard LED light test instructions ==
# There are two LED lights on the development board, one green light and one red light. The default display of the LED lights when the system is started is as follows:
::{| class="wikitable" style="width:800px;text-align: center;"
|-
|
| '''Bright'''
|}
::{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The green light on the development board can be controlled through software. The red light will be on continuously after power is turned on and cannot be controlled through software.'''
'''When you get the development board, you may find that even if the TF card with the system burned is not inserted into the development board, the green light will flash after connecting the power supply to the development board. This is because the 16MB SPI Flash on the development board is factory default. A miniature Linux system will be burned. This system will set the green light to flash after entering the kernel.'''
'''If the Linux system in the SPI Flash is cleared, then without inserting the TF card with the system programmed in it, you will only see a steady red light on the development board after turning on the power.'''</big>|}
<ol start="2" style="list-style-type: decimal;">
<li><p>The method of setting the green light to turn on and off and flash is as follows:</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the following operations should be performed under the root user.'''</p></big>|}
<ol style="list-style-type: lower-alpha;">
<li><p>First enter the setting directory of the green light</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''cd /sys/class/leds/green_led'''</p>|}</li><li><p>The command to set the green light to stop flashing is as > follows:</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:/sys/class/leds/green_led# '''echo none > trigger'''</p>|}</li>
<li><p>The command to set the green light to be always on is as > follows:</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:/sys/class/leds/green_led# '''echo default-on > trigger'''</p>|}</li>
<li><p>The command to set the green light flashing is as follows:</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:/sys/class/leds/green_led# '''echo heartbeat > trigger'''</p>|}</li></ol>
</li>
<li><p>If you do not need the LED light to flash after powering on, you can use the following method to turn off the green light flashing</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:media/image80zero2w-img80.png|389x192px]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:media/image81zero2w-img81.png|393x202px]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown > in the picture below, and then use the space to select > '''disable-leds'''</p><p>[[File:media/image82zero2w-img82.png|397x35px]]</p></li><li><p>Then select '''<Save>'''to save</p><p>[[File:media/image83zero2w-img83.png|397x92px]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:media/image84zero2w-img84.png|395x91px]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:media/image85zero2w-img85.png|374x187px]]</p></li><li><p>After restarting and entering the system, you can see that the > green LED light on the development board will no longer light > up.</p></li></ol>
</li></ol>
<span id="operation-instructions-for-rootfs-partition-capacity-of-linux-system-in-tf-card"></span>
== Operation instructions for rootfs partition capacity of Linux system in TF card ==
<ol style="list-style-type: decimal;">
<li><p>After burning the Linux image of the development board into the TF card, you can check the usage of the TF card capacity on the '''<span style="color:#FF0000">Ubuntu computer</span>'''. The steps are as follows:</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that failure to perform this step will not affect the automatic expansion of the Linux system of the development board. Here I just want to explain how to check the capacity of the TF card after burning the Linux image on the TF card.'''</p></big>|}
<ol style="list-style-type: lower-alpha;">
<li><p>First install the gparted software on your Ubuntu computer</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y gparted'''</p>|}</li>
<li><p>Then open gparted</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo gparted'''</p>|}</li><li><p>After opening gparted, you can select the TF card in the upper > right corner, and then you can see the usage of the TF card > capacity.</p><p>[[File:media/image86zero2w-img86.png|575x210px]]</p></li><li><p>The picture above shows the situation of the TF card after > burning the Linux desktop system. It can be seen that although > the total capacity of the TF card is 16GB (displayed as > 14.84GiB in GParted), the rootfs partition (/dev/ sdc1) Only > 4.05GiB is actually allocated, leaving 10.79GiB unallocated</p></li></ol>
</li>
<li><p>Then you can insert the TF card with the Linux system burned into the development board to start. When the TF card starts the Linux system for the first time, it will automatically call the '''orangepi-resize-filesystem''' script through the '''orangepi-resize-filesystem.service''' systemd service. Expansion of rootfs partition, '''<span style="color:#FF0000">so there is no need to manually expand it</span>'''</p></li><li><p>After logging in to the system, you can use the '''df -h''' command to check the size of rootfs. If it is consistent with the actual capacity of the TF card, it means that the automatic expansion is running correctly.</p></li>{| class="wikitable" style="width:800px;"|-|<p>orangepi@orangepi:~$ '''df -h'''</p><span style="margin-right: 80px;">Filesystem </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 30px;">Used </span><span style="margin-right: 30px;">Avail</span><span style="margin-right: 50px;">Use% Mounted on</span><br><span style="margin-right: 110px;">udev</span><span style="margin-right: 60px;">430M</span><span style="margin-right: 50px;">0</span><span style="margin-right: 70px;">430M </span><span style="margin-right: 90px;">0% /dev</span><br><span style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">100M </span><span style="margin-right: 30px;">5.6M </span><span style="margin-right: 70px;">95M </span><span style="margin-right: 90px;">6% /run</span><br><span style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1'''</span><span style="margin-right: 50px;color:#FF0000">'''15G'''</span><span style="margin-right: 35px;color:#FF0000">'''915M'''</span><span style="margin-right: 80px;color:#FF0000">'''14G'''</span><span style="margin-right: 90px;color:#FF0000">'''7% /'''</span><br><span style="margin-right: 100px;">tmpfs </span><span style="margin-right: 60px;">500M </span><span style="margin-right: 50px;">0</span><span style="margin-right: 50px;">500M </span><span style="margin-right: 90px;">0% /dev/shm</span><br>|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>After starting the Linux system for the first time, we can also remove the TF card from the development board and reinsert it into the '''<span style="color:#FF0000">Ubuntu computer</span>''', and then use gparted again to check the status of the TF card, as shown in the figure below, rootfs partition (/dev/ The capacity of sdc1) has been expanded to 14.69GiB</p>
=== Method to prohibit automatic expansion of rootfs partition capacity in TF card ===
<ol style="list-style-type: decimal;">
<li><p>First, burn the Linux image of the development board into the TF card on the '''<span style="color:#FF0000">Ubuntu computer</span>''' (Windows is not available), and '''<span style="color:#FF0000">then unplug and insert the TF card again</span>'''.</p></li>
<li><p>Then the Ubuntu computer will usually automatically mount the partition of the TF card. If the automatic mounting is normal, use the ls command to see the following output.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''ls /media/test/opi_root/'''</p>
<p>bin boot dev etc home lib lost+found media mnt opt proc root run <br> sbin selinux srv sys tmp usr var</p>|}</li>
<li><p>Then switch the current user to the root user on the Ubuntu computer</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo -i'''</p>
<p>[sudo] test 的密码: 的密码:</p><p>root@test:~'''<span style="color:#FF0000">#</span>'''</p>|}</li>
<li><p>Then enter the root directory of the Linux system in the TF card and create a new file named '''.no_rootfs_resize'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@test:~# '''cd /media/test/opi_root/'''</p>
<p>root@test:/media/test/opi_root/# '''cd root'''</p>
<p>root@test:/media/test/opi_root/root# '''touch .no_rootfs_resize'''</p>
<p>root@test:/media/test/opi_root/root# '''ls .no_rootfs*'''</p>
<p>'''.no_rootfs_resize'''</p>|}</li>
<li><p>Then you can uninstall the TF card, then pull out the TF card and insert it into the development board to start. When the Linux system starts, when the '''.no_rootfs_resize''' file is detected in the '''/root''' directory, rootfs will not be automatically expanded.</p></li>
<li><p>After disabling the automatic expansion of rootfs, you can enter the Linux system and you can see that the total capacity of the rootfs partition is only 4GB (the image tested here is the desktop version), which is much smaller than the actual capacity of the TF card, indicating that the automatic expansion of rootfs has been successfully disabled.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''df -h'''</p>
<pspan style="margin-right: 80px;">Filesystem </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 30px;">Used </span><span style="margin-right: 30px;">Avail </span><span style="margin-right: 50px;">Use% Mounted on</pspan><br><pspan style="margin-right: 110px;">udev </span><span style="margin-right: 60px;">925M </span><span style="margin-right: 50px;">0 </span><span style="margin-right: 70px;">925M </span><span style="margin-right: 90px;">0% /dev</pspan><br><pspan style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">199M </span><span style="margin-right: 30px;">3.2M </span><span style="margin-right: 70px;">196M </span><span style="margin-right: 90px;">2% /run</pspan><br><pspan style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1 '''</span><span style="margin-right: 50px;color:#FF0000">'''4.0G '''</span><span style="margin-right: 35px;color:#FF0000">'''3.2G '''</span><span style="margin-right: 80px;color:#FF0000">'''686M '''</span><span style="margin-right: 90px;color:#FF0000">'''83% /'''</pspan><br>|}</li><li><p>If you need to re-expand the capacity of the rootfs partition in the TF card, just execute the following command and then restart the Linux system of the development board.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </li></olbig> '''Note, please execute the following command under the root user.'''</big>|}{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''rm /root/.no_rootfs_resize'''
root@orangepi:~# '''sudo reboot'''
|}
After restarting, enter the Linux system of the development board again and you will see that the rootfs partition has been expanded to the actual capacity of the TF card.
{| class="wikitable" style="width:800px;"|-|<p>root@orangepi:~# $ '''df -h'''</p><span style="margin-right: 80px;">Filesystem </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 30px;">Used </span><span style="margin-right: 30px;">Avail</span><span style="margin-right: 50px;">Use% Mounted on</span><br><span style="margin-right: 110px;">udev</span><span style="margin-right: 60px;">925M </span><span style="margin-right: 50px;">0</span><span style="margin-right: 70px;">925M </span><span style="margin-right: 90px;">0% /dev</span><br><span style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">199M </span><span style="margin-right: 30px;">3.2M </span><span style="margin-right: 70px;">196M </span><span style="margin-right: 90px;">2% /run</span><br><span style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1'''</span><span style="margin-right: 50px;color:#FF0000">'''15G'''</span><span style="margin-right: 35px;color:#FF0000">'''3.2G '''</span><span style="margin-right: 80px;color:#FF0000">'''12G '''</span><span style="margin-right: 90px;color:#FF0000">'''23% /'''</span><br>|}</li></ol><span id="method-to-manually-expand-the-capacity-of-rootfs-partition-in-tf-card"></span>
=== Method to manually expand the capacity of rootfs partition in TF card ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If the total capacity of the TF card is large, such as 128GB, and you do not want the rootfs partition of the Linux system to use all the capacity of the TF card, you only want to allocate a part of the capacity, such as 16GB, to the Linux system, and then the remaining capacity of the TF card can be used for other purposes. use. Then you can use the content introduced in this section to manually expand the capacity of the rootfs partition in TF.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First, burn the Linux image of the development board into the TF card on the '''<span style="color:#FF0000">Ubuntu computer</span>''' (Windows is not available), and '''<span style="color:#FF0000">then unplug and insert the TF card again</span>'''.</p></li>
<li><p>Then the Ubuntu computer will usually automatically mount the partition of the TF card. If the automatic mounting is normal, use the ls command to see the following output.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''ls /media/test/opi_root/'''</p>
<p>bin boot dev etc home lib lost+found media mnt opt proc root run <br> sbin selinux srv sys tmp usr var</p>|}</li>
<li><p>Then switch the current user to the root user on the Ubuntu computer</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo -i'''</p>
<p>[sudo] test 的密码: 的密码:</p><p>root@test:~'''<span style="color:#FF0000">#</span>'''</p>|}</li>
<li><p>Then enter the root directory of the Linux system in the TF card and create a new file named '''.no_rootfs_resize'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@test:~# '''cd /media/test/opi_root/'''</p>
<p>root@test:/media/test/opi_root/# '''cd root'''</p>
<p>root@test:/media/test/opi_root/root# '''touch .no_rootfs_resize'''</p>
<p>root@test:/media/test/opi_root/root# '''ls .no_rootfs*'''</p>
<p>'''.no_rootfs_resize'''</p>|}</li></ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>Then install the gparted software on your Ubuntu computer</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y gparted'''</p>|}</li>
<li><p>Then open gparted</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo gparted'''</p>|}</li>
<li><p>After opening gparted, you can select the TF card in the upper right corner, and then you can see the usage of the TF card capacity. The picture below shows the situation of the TF card after burning the Linux desktop system. It can be seen that although the total capacity of the TF card is 16GB (displayed as 14.84GiB in GParted), the rootfs partition (/dev/sdc1) Only 4.05GiB is actually allocated, leaving 10.79GiB unallocated</p>
<p>[[File:media/image86zero2w-img86.png|575x210px]]</p></li>
<li><p>Then select the rootfs partition (/dev/sdc1)</p>
<p>[[File:media/image88zero2w-img88.png|575x211px]]</p></li>
<li><p>Right-click the mouse again to see the operation options shown in the picture below. If the TF card has been mounted, you first need to Umount the rootfs partition of the TF card.</p>
<p>[[File:media/image89zero2w-img89.png|436x298px]]</p></li>
<li><p>Then select the rootfs partition again, right-click, and select '''Resize/Move''' to start expanding the size of the rootfs partition.</p>
<p>[[File:media/image90zero2w-img90.png|444x302px]]</p></li>
<li><p>After the '''Resize/Move''' option is turned on, the following setting interface will pop up.</p>
<p>[[File:media/image91zero2w-img91.png|315x193px]]</p></li>
<li><p>Then you can directly drag the position shown in the figure below to set the size of the capacity, or you can set the size of the rootfs partition by setting the number in '''New size(MiB)'''</p>
<p>[[File:media/image92zero2w-img92.png|320x191px]]</p></li>
<li><p>After setting the capacity, click '''Resize/Move''' in the lower right corner.</p>
<p>[[File:media/image93zero2w-img93.png|327x196px]]</p></li><li><p>After final confirmation, click the green '''<span style="color:green">√</span>''' shown in the picture below.</p><p>[[File:media/image94zero2w-img94.png|392x270px]]</p></li>
<li><p>Then select '''Apply''', and the capacity expansion of the rootfs partition will officially begin.</p>
<p>[[File:media/image95zero2w-img95.png|399x116px]]</p></li>
<li><p>After the expansion is completed, click '''Close''' to close it.</p>
<p>[[File:media/image96zero2w-img96.png|399x172px]]</p></li>
<li><p>Then you can unplug the TF card and insert it into the development board to start. After entering the Linux system of the development board, if you use the '''df -h''' command to see that the size of the rootfs partition is consistent with the size set previously, it means manual Expansion successful</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''df -h'''</p>
<pspan style="margin-right: 80px;">Filesystem </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 30px;">Used </span><span style="margin-right: 30px;">Avail </span><span style="margin-right: 50px;">Use% Mounted on</pspan><br><pspan style="margin-right: 110px;">udev </span><span style="margin-right: 60px;">925M </span><span style="margin-right: 50px;">0 </span><span style="margin-right: 70px;">925M </span><span style="margin-right: 90px;">0% /dev</pspan><br><pspan style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">199M </span><span style="margin-right: 30px;">3.2M </span><span style="margin-right: 70px;">196M </span><span style="margin-right: 90px;">2% /run</pspan><br><pspan style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1 '''</span><span style="margin-right: 50px;color:#FF0000">'''7.7G '''</span><span style="margin-right: 35px;color:#FF0000">'''3.2G '''</span><span style="margin-right: 80px;color:#FF0000">'''4.4G '''</span><span style="margin-right: 90px;color:#FF0000">'''42% /'''</pspan><br>|}</li></ol>
<span id="method-to-reduce-the-capacity-of-rootfs-partition-in-tf-card"></span>
=== Method to reduce the capacity of rootfs partition in TF card ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''After configuring the application or other development environment in the Linux system of the TF card, if you want to back up the Linux system in the TF card, you can use the method in this section to reduce the size of the rootfs partition first, and then start the backup.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First, insert the TF card you want to operate on your '''<span style="color:#FF0000">Ubuntu computer</span>''' (not Windows)</p></li>
<li><p>Then install the gparted software on your Ubuntu computer</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y gparted'''</p>|}</li>
<li><p>Then open gparted</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo gparted'''</p>|}</li>
<li><p>After opening gparted, you can select the TF card in the upper right corner, and then you can see the usage of the TF card capacity.</p>
<p>[[File:media/image97zero2w-img97.png|575x217px]]</p></li>
<li><p>Then select the rootfs partition (/dev/sdc1)</p>
<p>[[File:media/image98zero2w-img98.png|575x217px]]</p></li>
<li><p>Right-click the mouse again to see the operation options shown in the picture below. If the TF card is already mounted, you first need to Umount the rootfs partition of the TF card.</p>
<p>[[File:media/image99zero2w-img99.png|400x274px]]</p></li>
<li><p>Then select the rootfs partition again, right-click the mouse, and select '''Resize/Move''' to start setting the size of the rootfs partition.</p>
<p>[[File:media/image100zero2w-img100.png|399x273px]]</p></li>
<li><p>After the '''Resize/Move''' option is turned on, the following setting interface will pop up.</p>
<p>[[File:media/image101zero2w-img101.png|315x188px]]</p></li>
<li><p>Then you can directly drag the position shown in the figure below to set the size of the capacity, or you can set the size of the rootfs partition by setting the number in '''New sieze(MiB)'''</p>
<p>[[File:media/image92zero2w-img92.png|318x190px]]</p></li>
<li><p>After setting the capacity, click '''Resize/Move''' in the lower right corner.</p>
<p>[[File:media/image93zero2w-img93.png|327x196px]]</p></li><li><p>After final confirmation, click the green '''<span style="color:green">√</span>''' as shown in the picture below.</p><p>[[File:media/image94zero2w-img94.png|392x270px]]</p></li>
<li><p>Then select '''Apply''', and the capacity expansion of the rootfs partition will officially begin.</p>
<p>[[File:media/image95zero2w-img95.png|365x106px]]</p></li>
<li><p>After the expansion is completed, click '''Close''' to close it.</p>
<p>[[File:media/image96zero2w-img96.png|379x164px]]</p></li>
<li><p>Then you can unplug the TF card and insert it into the development board to start. After entering the Linux system of the development board, if you use the '''df -h''' command, you can see that the size of the rootfs partition is consistent with the size set previously, which means it has been reduced capacity success</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''df -h'''</p>
<pspan style="margin-right: 80px;">Filesystem </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 30px;">Used </span><span style="margin-right: 30px;">Avail </span><span style="margin-right: 50px;">Use% Mounted on</pspan><br><pspan style="margin-right: 110px;">udev </span><span style="margin-right: 60px;">925M </span><span style="margin-right: 50px;">0 </span><span style="margin-right: 70px;">925M </span><span style="margin-right: 90px;">0% /dev</pspan><br><pspan style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">199M </span><span style="margin-right: 30px;">3.2M </span><span style="margin-right: 70px;">196M </span><span style="margin-right: 90px;">2% /run</pspan><br><pspan style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1 '''</span><span style="margin-right: 50px;color:#FF0000">'''7.7G '''</span><span style="margin-right: 35px;color:#FF0000">'''3.2G '''</span><span style="margin-right: 80px;color:#FF0000">'''4.4G '''</span><span style="margin-right: 90px;color:#FF0000">'''42% /'''</pspan><br>|}</li></ol>
<span id="pin-expansion-board-interface-pin-description"></span>
== 24Pin expansion board interface pin description ==
<div class="figure">
[[File:media/image102zero2w-img102.png|263x86px|002]]
</div></li>
<li><p>The schematic diagram of the 24pin expansion board interface of the development board is as follows</p>
<p>[[File:media/image103zero2w-img103.png|337x230px]]</p></li>
<li><p>The way to connect the expansion board to the development board is as follows. Please pay attention to the forward and reverse directions of the cable and do not plug it in backwards.</p>
<div class="figure">
[[File:media/image104zero2w-img104.png|357x207px|_MG_2148]]
</div></li>
<div class="figure">
[[File:media/image105zero2w-img105.png|403x223px|1695354662277]]
</div></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| style="width:50px;" | 1| style="width:200px;" | 100M network port
| Used to connect to a wired network to access the Internet
|-
| The default settings of the Linux system are KEY_1 (Number 1 key) and KEY_ENTER (Enter key), which can be customized as other function keys by modifying the dts configuration.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The adaptation of Linux5.4 and Linux6.1 systems to expansion boards is shown in the following table</li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin expansion board function'''
|-
| '''TV-OUT'''
| '''<span style="color:#FF0000">NO</span>'''| '''<span style="color:#FF0000">NO</span>'''
|}
</ol>
<span id="how-to-use-the-two-lradc-buttons-on-the-24pin-expansion-board"></span>
== How to use the two LRADC buttons on the 24pin expansion board ==
<ol style="list-style-type: decimal;">
<li><p>There are two LRADC buttons on the 24pin expansion board, and their locations are as shown in the figure below:</p>
<p>[[File:media/image106zero2w-img106.png|346x182px]]</p></li><li><p>In the Linux system, the default key values of KEY1 and KEY2 are</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Linux kernel'''
| '''KEY_ENTER, the enter key'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Through the '''evtest''' command, we can check the key values reported after KEY1 and KEY2 are pressed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>linux5.4</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepizero2w:~$ '''evtest'''</p>
<p>No device specified, trying to scan all of /dev/input/event*</p>
<p>Not running as root, no devices may be available.</p>
<p>Available devices:</p>
<p>'''/dev/input/event0event<span style="color: #FF0000">0</span>: <span style="color:#FF0000">sunxi-keyboard</span>'''</p>
<p>/dev/input/event1: sunxi-ir</p>
<p>/dev/input/event2: axp2101-pek</p>
<p>/dev/input/event6: PixArt USB Optical Mouse</p>
<p>/dev/input/event7: BRLTTY 6.3 Linux Screen Driver Keyboard</p>
<p>Select the device event number [0-7]: '''<span style="color:#FF0000">0 </span> #You need to enter the serial number corresponding to sunxi-keyboard'''</p>
<p>Input driver version is 1.0.1</p>
<p>Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100</p>
<p>Input device name: "sunxi-keyboard"</p>
<p>Supported events:</p>
:<p>Event type 0 (EV_SYN)</p>:<p>Event type 1 (EV_KEY)</p>::<p>Event code 2 (KEY_1)</p>::<p>Event code 28 (KEY_ENTER)</p>
<p>Properties:</p>
<p>Testing ... (interrupt to exit)</p>
<p>'''#The following are the key values reported after pressing KEY1 and KEY2'''</p>
<p>Event: time 1693555298.132314, type 1 (EV_KEY), code 2 (KEY_1), value 1</p>
<p>Event: time 1693555298.132314, -------------- SYN_REPORT ------------</p>
<p>Event: time 1693555298.601042, -------------- SYN_REPORT ------------</p>
<p>Event: time 1693555298.710415, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0</p>
<p>Event: time 1693555298.710415, -------------- SYN_REPORT ------------</p>|}</li>
<li><p>linux6.1</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepizero2w:~$ evtest</p>
<p>No device specified, trying to scan all of /dev/input/event*</p>
<p>Available devices:</p>
<p>/dev/input/event0: axp20x-pek</p>
<p>'''/dev/input/event1event<span style="color: #FF0000">1</span>: <span style="color:#FF0000">5070800.lradc</span>'''</p>
<p>/dev/input/event2: SONiX USB Keyboard</p>
<p>/dev/input/event3: SONiX USB Keyboard Consumer Control</p>
<p>/dev/input/event5: PixArt USB Optical Mouse</p>
<p>/dev/input/event6: sunxi-ir</p>
<p>Select the device event number [0-6]: '''<span style="color:#FF0000">1 </span> #You need to enter the serial number corresponding to 5070800.lradc'''</p>
<p>Input driver version is 1.0.1</p>
<p>Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100</p>
<p>Input device name: "5070800.lradc"</p>
<p>Supported events:</p>
:<p>Event type 0 (EV_SYN)</p>:<p>Event type 1 (EV_KEY)</p>::<p>Event code 2 (KEY_1)</p>::<p>Event code 28 (KEY_ENTER)</p>
<p>Properties:</p>
<p>Testing ... (interrupt to exit)</p>
<p>'''#The following are the key values reported after pressing KEY1 and KEY2'''</p>
<p>Event: time 1694075818.810877, type 1 (EV_KEY), code 2 (KEY_1), value 1</p>
<p>Event: time 1694075818.810877, -------------- SYN_REPORT ------------</p>
<p>Event: time 1694075819.536128, -------------- SYN_REPORT ------------</p>
<p>Event: time 1694075819.705009, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0</p>
<p>Event: time 1694075819.705009, -------------- SYN_REPORT ------------</p>|}</li></ol>
</li>
<li><p>If you need to modify the key values reported after KEY1 and KEY2 are pressed, you can use the following method:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>There is a '''sun50i-h618-lradc-keys.dts''' file under the > '''/usr/src/''' path, through which we can define KEY1 and KEY2 > as the desired key values.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepizero2w:~$ '''cd /usr/src/'''</p>
<p>orangepi@orangepizero2w:/usr/src$ '''ls *.dts'''</p>
<p>sun50i-h618-lradc-keys.dts</p>|}</li><li><p>The contents of the '''sun50i-h618-lradc-keys.dts''' file in the > linux5.4 system are as follows:</p><ol style="list-style-type: lower-alphanone;"><li><p>a) KEY1 correspondence: modify '''key0 = <600 2>;''' where 2 is > the number corresponding to the desired key value</p></li><li><p>b) KEY2 correspondence: modify '''key1 = <800 28>;''' where 28 > is the number corresponding to the desired key value</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepizero2w:/usr/src$ '''sudo vim sun50i-h618-lradc-keys.dts'''</p>
<p>/dts-v1/;</p>
<p>/plugin/;</p>
<p>/ {</p>
:<p>fragment@0 {</p>::<p>target = <&keyboard>;</p> ::<p>__overlay__ {</p>:::<p>status = "okay";</p> :::<p>'''key0 = <600 <span style="color:#FF0000">2</span>>;'''</p>:::<p>'''key1 = <800 <span style="color:#FF0000">28</span>>;'''</p>::<p>};</p>:<p>};</p>
<p>};</p>
</li>
<li><p>The contents of the c.linux6.1 system > '''sun50i-h618-lradc-keys.dts''' file are as follows:</p><ol style="list-style-type: lower-alphanone;"><li><p>a) KEY1 corresponding: modify '''linux,code = <2>;''' the 2 in > it is the number corresponding to the desired key value</p></li><li><p>b) KEY2 correspondence: modify '''linux,code = <28>;''' the 28 > in it is the number corresponding to the desired key value</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepizero2w:/usr/src$ '''sudo ''' '''vim ''' '''sun50i-h618-lradc-keys.dts'''</p>
<p>/dts-v1/;</p>
<p>/plugin/;</p>
<p>/ {</p>
:<p>fragment@0 {</p>::<p>target = <&r_lradc>;</p> ::<p>__overlay__ {</p>:::<p>status = "okay";</p> :::<p>button-500 {</p>::::<p>label = "KEY_1";</p>::::<p>'''linux,code = <<span style="color:#FF0000">2</span>>;'''</p>:::<p>};</p> :::<p>button-800 {</p>::::<p>label = "KEY_ENTER";</p>::::<p>'''linux,code = <<span style="color:#FF0000">28</span>>;'''</p>:::<p>};</p>::<p>};</p>:<p>};</p>
<p>};</p>
</li>
<li><p>For the key values that can be set, please refer to the macro > definition in the '''input-event-codes.h''' header file. Its > path in the kernel source code is:</p>{| class="wikitable" style="width:800px;" |-|
<p>orange-pi-5.4-sun50iw9/include/uapi/linux/input-event-codes.h</p>
<p>orange-pi-6.1-sun50iw9/include/uapi/linux/input-event-codes.h</p>|}</li><li><p>After modification, use the '''orangepi-add-overlay''' command to > add the sun50i-h618-lradc-keys.dts configuration to the > system.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepizero2w:/usr/src$ '''sudo orangepi-add-overlay sun50i-h618-lradc-keys.dts'''</p>
<p>Compiling the overlay</p>
<p>Copying the compiled overlay file to /boot/overlay-user/</p>
<p>Reboot is required to apply the changes</p>|}</li><li><p>Then restart the system and the customized key values will take > effect.</p></li></ol>
</li></ol>
<span id="network-connection-test"></span>
== Network connection test ==
<ol style="list-style-type: decimal;">
<li><p>There is no wired network interface on the main board of the development board. We can expand the 100M wired network interface through a 24pin expansion board.</p>
<p>[[File:media/image107zero2w-img107.png|338x229px]]</p></li>
<li><p>Then plug one end of the network cable into the Ethernet interface of the expansion board, and the other end of the network cable into the router, and make sure the network is smooth.</p></li>
<li><p>After the system starts, it will automatically assign an IP address to the Ethernet card through '''DHCP''', '''<span style="color:#FF0000">and no other configuration is required.</span>'''</p></li>
<li><p>The command to view the IP address in the Linux system of the development board is as follows:</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Please do not copy the following commands. For example, the network node name in debian12 is end0, and the following command needs to be modified to ip a s end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ip a s eth0'''</p>
<p>3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 5e:ac:14:a5:93:b3 brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.16</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0</p>::<p>valid_lft 259174sec preferred_lft 259174sec</p>:<p>inet6 240e:3b7:3240:c3a0:e269:8305:dc08:135e/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259176sec preferred_lft 172776sec</p>:<p>inet6 fe80::957d:bbbd:4928:3604/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''There are three ways to check the IP address after the development board is started:'''</p>
<p>'''1. Connect the HDMI display, then log in to the system and use the ip a s eth0 command to check the IP address.'''</p>
<p>'''2. Enter the ip a s eth0 command in the debugging serial terminal to view the IP address.'''</p>
<p>'''3. If there is no debugging serial port or HDMI display, you can also check the IP address of the development board's network port through the router's management interface. However, with this method, people often fail to see the IP address of the development board. If you can't see it, here's how to debug it:'''</p>
:<p>'''A) First check whether the Linux system has started normally. If the green light of the development board flashes, it usually means that it has started normally. If only the red light is on, or the red and green lights are not on, it means that the system has not started normally;'''</p>:<p>'''B) Check whether the network cable is plugged in tightly, or try another network cable;'''</p>:<p>'''C) Try another router (I have encountered many problems with routers, such as the router being unable to assign an IP address normally, or the IP address being assigned normally but not being visible in the router);'''</p>:<p>'''D) If there is no router to replace, you can only connect an HDMI display or use the debugging serial port to check the IP address.'''</p> <p>'''In addition, it should be noted that the development board's DHCP automatic allocation of IP addresses does not require any settings.'''</p></big>|}</li>
<li><p>The command to test network connectivity is as follows. The '''ping''' command can be interrupted by pressing the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Please do not copy the following commands. For example, the network node name in debian12 is end0. The following command needs to be modified to ping www.baidu.com -I end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ping www.baidu.com -I eth0'''</p>
<p>PING www.a.shifen.com (14.215.177.38) from 192.168.1.12 eth0: 56(84) bytes of data.</p>
<p>--- www.a.shifen.com ping statistics ---</p>
<p>4 packets transmitted, 4 received, 0% packet loss, time 3002ms</p>
<p>rtt min/avg/max/mdev = 6.260/6.770/7.275/0.373 ms</p>|}</li></ol>
<span id="wifi-connection-test"></span>
=== WIFI connection test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please do not connect to WIFI by modifying the /etc/network/interfaces configuration file. There will be problems in connecting to the WIFI network in this way.'''</big>|}
<span id="server-version-image-connects-to-wifi-through-commands"></span>
==== Server version image connects to WIFI through commands ====
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When the development board is not connected to Ethernet or HDMI display, but only to the serial port, it is recommended to use the commands demonstrated in this section to connect to the WIFI network. Because nmtui can only display characters in some serial port software (such as minicom) and cannot display the graphical interface normally. Of course, if the development board is connected to an Ethernet or HDMI display, you can also use the commands demonstrated in this section to connect to the WIFI network.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First log in to the Linux system, there are three ways:</p>
<p>a. If the development board is connected to a network cable, you can remotely log in to '''[[\lOrange Pi Zero 2W#SSH remote login development board|the Linux system through ssh]].'''</p>
<p>b. If the development board is connected to the debugging serial port, you can use the serial port terminal to log in to the Linux system.</p>
<p>c. If the development board is connected to an HDMI display, you can log in to the Linux system through the HDMI display terminal.</p></li></ol>
<li><p>First use the '''nmcli dev wifi''' command to scan the surrounding WIFI hotspots</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''nmcli dev wifi'''</p>
|}
<div class="figure">
[[File:media/image108zero2w-img108.png|575x250px|选区_011]]
</div></li>
<li><p>Then use the '''nmcli''' command to connect to the scanned WIFI hotspot, where:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''wifi_name''' needs to be replaced with the name of the WIFI > hotspot you want to connect to</p></li><li><p>'''wifi_passwd''' needs to be replaced with the password of the > WIFI hotspot you want to connect to.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nmcli dev wifi connect <span style="color:#FF0000">wifi_name </span> password <span style="color:#FF0000">wifi_passwd</span>'''</p><p>Device 'wlan0' successfully activated with 'cf937f88-ca1e-4411-bb50-61f402eef293'.</p>|}</li></ol>
</li>
<li><p>You can check the IP address of the wifi through the '''ip addr show wlan0''' command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ip a s wlan0'''</p>
<p>11: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 23:8c:d6:ae:76:bb brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.11</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0</p>::<p>valid_lft 259192sec preferred_lft 259192sec</p>:<p>inet6 240e:3b7:3240:c3a0:c401:a445:5002:ccdd/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259192sec preferred_lft 172792sec</p>:<p>inet6 fe80::42f1:6019:a80e:4c31/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li>
<li><p>Use the '''ping''' command to test the connectivity of the wifi network. The '''ping''' command can be interrupted by pressing the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ping www.orangepi.org -I wlan0'''</p>
<p>PING www.orangepi.org (182.92.236.130) from 192.168.1.49 wlan0: 56(84) bytes of data.</p>
<p>--- www.orangepi.org ping statistics ---</p>
<p>5 packets transmitted, 5 received, 0% packet loss, time 4006ms</p>
<p>rtt min/avg/max/mdev = 41.321/44.864/48.834/2.484 ms</p>|}</li></ol>
<span id="server-version-image-connects-to-wifi-graphically"></span>
==== Server version image connects to WIFI graphically ====
<ol style="list-style-type: decimal;">
<li><p>First log in to the Linux system, there are three ways:</p>
<p>a. If the development board is connected to a network cable, you can remotely log in to '''[[\lOrange Pi Zero 2W#SSH remote login development board|the Linux system through ssh]].'''</p>
<p>b. If the development board is connected to the debugging serial port, you can use the serial port terminal to log in to the Linux system (please use MobaXterm for the serial port software, the graphical interface cannot be displayed using minicom)</p>
<p>c. If the development board is connected to an HDMI display, you can log in to the Linux system through the HDMI display terminal.</p></li>
<li><p>Then enter the nmtui command in the command line to open the wifi connection interface</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nmtui'''</p>|}</li>
<li><p>Enter the nmtui command to open the interface as shown below</p>
<p>[[File:media/image109zero2w-img109.png|345x215px]]</p></li>
<li><p>Select '''Activate a connect''' and press Enter</p>
<p>[[File:media/image110zero2w-img110.png|349x216px]]</p></li>
<li><p>Then you can see all the searched WIFI hotspots</p>
<div class="figure">
[[File:media/image111zero2w-img111.png|426x270px|16]]
</div></li>
<div class="figure">
[[File:media/image112zero2w-img112.png|474x298px|17]]
</div></li>
<div class="figure">
[[File:media/image113zero2w-img113.png|480x308px|18]]
</div></li>
<div class="figure">
[[File:media/image114zero2w-img114.png|443x283px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-9.jpg未标题-9]]
</div></li>
<li><p>You can check the IP address of the wifi through the '''ip a s wlan0''' command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ip a s wlan0'''</p>
<p>11: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 24:8c:d3:aa:76:bb brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.11</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0</p>::<p>valid_lft 259069sec preferred_lft 259069sec</p>:<p>inet6 240e:3b7:3240:c4a0:c401:a445:5002:ccdd/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259071sec preferred_lft 172671sec</p>:<p>inet6 fe80::42f1:6019:a80e:4c31/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li>
<li><p>Use the '''ping''' command to test the connectivity of the wifi network. The '''ping''' command can be interrupted by pressing the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ping www.orangepi.org -I wlan0'''</p>
<p>PING www.orangepi.org (182.92.236.130) from 192.168.1.49 wlan0: 56(84) bytes of data.</p>
<p>--- www.orangepi.org ping statistics ---</p>
<p>5 packets transmitted, 5 received, 0% packet loss, time 4006ms</p>
<p>rtt min/avg/max/mdev = 41.321/44.864/48.834/2.484 ms</p>|}</li></ol>
<span id="test-method-for-desktop-image"></span>
==== Test method for desktop image ====
<ol style="list-style-type: decimal;">
<li><p>Click the network configuration icon in the upper right corner of the desktop (please do not connect the network cable when testing WIFI)</p>
<p>[[File:media/image115zero2w-img115.png|275x121px]]</p></li>
<li><p>Click '''More networks''' in the pop-up drop-down box to see all scanned WIFI hotspots, and then select the WIFI hotspot you want to connect to.</p>
<p>[[File:media/image116zero2w-img116.png|576x353px]]</p></li>
<li><p>Then enter the password of the WIFI hotspot and click '''Connect''' to start connecting to WIFI</p>
<p>[[File:media/image117zero2w-img117.png|288x147px]]</p></li>
<li><p>After connecting to WIFI, you can open the browser to check whether you can access the Internet. The browser entrance is as shown below</p>
<p>[[File:media/image118zero2w-img118.png|465x249px]]</p></li>
<li><p>If you can open other web pages after opening the browser, it means the WIFI connection is normal.</p>
<p>[[File:media/image119zero2w-img119.png|575x172px]]</p></li></ol>
<span id="method-to-create-wifi-hotspot-through-create_ap"></span>
=== Method to create WIFI hotspot through create_ap ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''create_ap is a script that helps quickly create WIFI hotspots on Linux, and supports bridge and NAT modes. It can automatically combine hostapd, dnsmasq and iptables to complete the setting of WIFI hotspots, avoiding users from complicated configurations. The github address is as follows: '''
[https://github.com/oblique/create_ap '''https://github.com/oblique/create_ap''']</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The Linux image released by OPi has been pre-installed with the create_ap script. You can use the create_ap command to create a WIFI hotspot. The basic command format of create_ap is as follows: '''
'''create_ap [options] <wifi-interface> [<interface-with-internet>] [<access-point-name> [<passphrase>]]'''
'''* options: You can use this parameter to specify the encryption method, frequency band of WIFI hotspot, bandwidth mode, network sharing method, etc. You can get the options through create_ap -h.'''
'''* access-point-name: Hotspot name'''
'''* passphrase: hotspot password'''</big>|}
<span id="create_ap-method-to-create-wifi-hotspot-in-nat-mode"></span>
<ol style="list-style-type: decimal;">
<li><p>Enter the following command to create a WIFI hotspot with the name '''orangepi''' and password '''orangepi''' in NAT mode</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --no-virt'''
|}
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>If the following information is output, it means that the WIFI hotspot is successfully created.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --no-virt'''</p>
<p>Config dir: /tmp/create_ap.wlan0.conf.TQkJtsz1</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 RADIUS: starting accounting session D4FBF7E5C604F169</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 WPA: pairwise key handshake completed (RSN)</p>
<p>wlan0: EAPOL-4WAY-HS-COMPLETED ce:bd:9a:dd:a5:86</p>|}</li>
<li><p>At this time, take out your mobile phone and find the WIFI hotspot named '''orangepi''' created by the development board in the searched WIFI list. Then you can click '''orangepi''' to connect to the hotspot. The password is '''orangepi''' set above.</p>
<div class="figure">
[[File:media/image120zero2w-img120.png|230x171px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-10.jpg未标题-10]]
</div></li>
<div class="figure">
[[File:media/image121zero2w-img121.png|224x111px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-11.jpg未标题-11]]
</div></li>
<li><p>In NAT mode, the wireless device connected to the development board's hotspot requests an IP address from the development board's DHCP service, so there will be two different network segments. For example, the development board's IP here is 192.168.1.X</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo ifconfig eth0'''</p>
<p>eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500</p>
::<p>inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255</p>::<p>inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link></p>::<p>ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet)</p>::<p>RX packets 25370 bytes 2709590 (2.7 MB)</p>::<p>RX errors 0 dropped 50 overruns 0 frame 0</p>::<p>TX packets 3798 bytes 1519493 (1.5 MB)</p>::<p>TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>::<p>device interrupt 83</p>|}
<p>The DHCP service of the development board will assign the IP address of '''192.168.12.0/24''' to the device connected to the hotspot by default. At this time, click on the connected WIFI hotspot '''orangepi''', and then you can see that the IP address of the mobile phone is '''192.168.12.X'''.</p>
<div class="figure">
[[File:media/image121zero2w-img121.png|272x135px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-11.jpg未标题-11]]
</div>
<div class="figure">
[[File:media/image122zero2w-img122.png|274x155px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-12.jpg未标题-12]]
</div></li>
<li><p>If you want to specify a different network segment for the connected device, you can specify it through the -g parameter. For example, use the -g parameter to specify the network segment of the access point AP as 192.168.2.1.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </li></olbig> '''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</big>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi -g 192.168.2.1 --no-virt'''
|}
At this time, after connecting to the hotspot through the mobile phone, click on the connected WIFI hotspot '''orangepi''', and then you can see that the IP address of the mobile phone is '''192.168.2.X'''
<div class="figure">
[[File:media/image121zero2w-img121.png|295x147px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-11.jpg未标题-11]]
</div>
<div class="figure">
[[File:media/image122zero2w-img122.png|296x167px|未标题-12]]
</div>
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Without specifying the '''--freq-band''' parameter, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify it through the '''--freq-band 5''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --freq-band 5 --no-virt'''
|}
</li></ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>If you need to hide the SSID, you can specify the '''--hidden''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --hidden --no-virt'''
|}
At this time, the mobile phone cannot search for WIFI hotspots. You need to manually specify the WIFI hotspot name and enter the password to connect to the WIFI hotspot.
<div class="figure">
[[File:media/image123zero2w-img123.png|254x197px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-14.jpg未标题-14]]
</div>
</li></ol>
<span id="create_ap-method-to-create-wifi-hotspot-in-bridge-mode"></span>
==== create_ap method to create WIFI hotspot in bridge mode ====
<ol style="list-style-type: decimal;">
<li><p>Enter the following command to create a WIFI hotspot with the name '''orangepi''' and password '''orangepi''' in bridge mode</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --no-virt'''
|}
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>If the following information is output, it means that the WIFI hotspot is successfully created.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --no-virt'''</p>
<p>Config dir: /tmp/create_ap.wlan0.conf.zAcFlYTx</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 RADIUS: starting accounting session 937BF40E51897A7B</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 WPA: pairwise key handshake completed (RSN)</p>
<p>wlan0: EAPOL-4WAY-HS-COMPLETED ce:bd:9a:dd:a5:86</p>|}</li>
<li><p>At this time, take out your mobile phone and find the WIFI hotspot named '''orangepi''' created by the development board in the searched WIFI list. Then you can click '''orangepi''' to connect to the hotspot. The password is '''orangepi''' set above.</p>
<div class="figure">
[[File:media/image120zero2w-img120.png|265x198px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-10.jpg未标题-10]]
</div></li>
<div class="figure">
[[File:media/image121zero2w-img121.png|262x130px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-11.jpg未标题-11]]
</div></li>
<li><p>In bridge mode, the wireless device connected to the hotspot of the development board also requests an IP address from the DHCP service of the main router (the router to which the development board is connected). For example, the IP of the development board here is '''192.168.1.X'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo ifconfig eth0'''</p>
<p>eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500</p>
::<p>inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255</p>::<p>inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link></p>::<p>ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet)</p>::<p>RX packets 25370 bytes 2709590 (2.7 MB)</p>::<p>RX errors 0 dropped 50 overruns 0 frame 0</p>::<p>TX packets 3798 bytes 1519493 (1.5 MB)</p>::<p>TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>::<p>device interrupt 83</p>|}
<p>The IP of the device connected to the WIFI hotspot is also assigned by the main router, so the mobile phone connected to the WIFI hotspot and the development board are in the same network segment. At this time, click on the connected WIFI hotspot '''orangepi''', and then you can see the IP address of the mobile phone. Also '''192.168.1.X'''.</p>
<div class="figure">
[[File:media/image121zero2w-img121.png|283x140px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-11.jpg未标题-11]]
</div>
<div class="figure">
[[File:media/image122zero2w-img122.png|281x159px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-12.jpg未标题-12]]
</div></li>
<li><p>Without specifying the '''--freq-band''' parameter, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify it through the '''--freq-band''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --freq-band 5 --no-virt'''
|}
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>If you need to hide the SSID, you can specify the '''--hidden''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --hidden --no-virt'''|}
At this time, the mobile phone cannot search for WIFI hotspots. You need to manually specify the WIFI hotspot name and enter the password to connect to the WIFI hotspot.
<div class="figure">
[[File:media/image123zero2w-img123.png|228x177px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-14.jpg未标题-14]]
</div>
</li></ol>
<span id="how-to-set-a-static-ip-address"></span>
=== How to set a static IP address ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please do not set a static IP address by modifying the /etc/network/interfaces configuration file.'''</big>|}
<span id="use-the-nmtui-command-to-set-a-static-ip-address"></span>
<ol style="list-style-type: decimal;">
<li><p>First run the '''nmtui''' command</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nmtui'''</p>|}</li>
<li><p>Then select '''Edit a connection''' and press the Enter key</p>
<p>[[File:media/image124zero2w-img124.png|227x247px]]</p></li>
<li><p>Then select the network interface for which a static IP address needs to be set. For example, to set the static IP address of the '''Ethernet''' interface, select '''Wired connection 1'''.</p>
<p>[[File:media/image125zero2w-img125.png|310x149px]]</p></li>
<li><p>Then select '''Edit''' via the '''Tab''' key and press the Enter key</p>
<p>[[File:media/image126zero2w-img126.png|316x144px]]</p></li>
<li><p>Then use the Tab key to move the cursor to the '''<Automatic>''' position shown in the figure below to configure IPv4</p>
<p>[[File:media/image127zero2w-img127.png|575x240px]]</p></li>
<li><p>Then press Enter, select '''Manual''' through the up and down arrow keys, and then press Enter to confirm.</p>
<p>[[File:media/image128zero2w-img128.png|576x237px]]</p></li>
<li><p>The display after selection is as shown below</p>
<p>[[File:media/image129zero2w-img129.png|575x240px]]</p></li>
<li><p>Then move the cursor to '''<Show>''' via the Tab key</p>
<p>[[File:media/image130zero2w-img130.png|576x241px]]</p></li>
<li><p>Then press Enter. After pressing Enter, the following setting interface will pop up.</p>
<p>[[File:media/image131zero2w-img131.png|575x450px]]</p></li><li><p>Then you can set the IP address (Addresses), gateway (Gateway) and DNS server address as shown in the figure below (there are many other setting options, please explore by yourself), <span style="color:#FF0000">please set according to your specific needs. The values set in the image below are just an example</span></p><p>[[File:media/image132zero2w-img132.png|576x233px]]</p></li>
<li><p>After setting, move the cursor to '''<OK>''' in the lower right corner, and then press Enter to confirm.</p>
<p>[[File:media/image133zero2w-img133.png|576x116px]]</p></li>
<li><p>Then click '''<Back>''' to return to the previous level selection interface</p>
<p>[[File:media/image134zero2w-img134.png|330x325px]]</p></li>
<li><p>Then select '''Activate a connection''', then move the cursor to '''<OK>''', and finally click Enter</p>
<p>[[File:media/image135zero2w-img135.png|331x248px]]</p></li>
<li><p>Then select the network interface that needs to be set, such as '''Wired connection 1''', then move the cursor to '''<Deactivate>''', and then press the Enter key to disable '''Wired connection 1'''</p>
<p>[[File:media/image136zero2w-img136.png|576x224px]]</p></li>
<li><p>Then please do not move the cursor, and then press the Enter key to re-enable '''Wired connection 1''', so that the static IP address set previously will take effect.</p>
<p>[[File:media/image137zero2w-img137.png|576x224px]]</p></li>
<li><p>Then you can exit nmtui through the '''<Back>''' and '''Quit''' buttons</p>
<p>[[File:media/image138zero2w-img138.png|300x253px]] [[File:media/image139zero2w-img139.png|227x252px]]</p></li>
<li><p>Then through '''ip a s eth0''' you can see that the IP address of the network port has become the static IP address set previously.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ip a s eth0'''</p>
<p>3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 5e:ac:14:a5:92:b3 brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.177</span>'''/24 brd 192.168.1.255 scope global noprefixroute eth0</p>::<p>valid_lft forever preferred_lft forever</p>:<p>inet6 241e:3b8:3240:c3a0:e269:8305:dc08:135e/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259149sec preferred_lft 172749sec</p>:<p>inet6 fe80::957d:bbbe:4928:3604/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li>
<li><p>Then you can test the network connectivity to check whether the IP address is configured OK. The '''ping''' command can be interrupted by using the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ping 192.168.1.177 -I eth0'''</p>
<p>PING 192.168.1.47 (192.168.1.47) from 192.168.1.188 eth0: 56(84) bytes of data.</p>
<p>--- 192.168.1.47 ping statistics ---</p>
<p>5 packets transmitted, 5 received, 0% packet loss, time 4042ms</p>
<p>rtt min/avg/max/mdev = 0.233/0.262/0.275/0.015 ms</p>|}</li></ol>
<span id="use-nmcli-command-to-set-static-ip-address"></span>
==== Use nmcli command to set static IP address ====
<li><p>Then you can view the name of the network device through the '''nmcli con show''' command, as shown below</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''orangepi''' is the name of the WIFI network interface (the > names are not necessarily the same)</p></li>
<li><p>'''Wired connection 1''' is the name of the Ethernet interface</p>
</li>
<li><p>中Then enter the following command, where</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''"Wired connection 1"''' means setting the static IP address > of the Ethernet port. If you need to set the static IP address > of WIFI, please change it to the name corresponding to the > WIFI network interface (can be obtained through the '''nmcli > con show''' command)</p></li><li><p>'''ipv4.addresses''' is followed by the static IP address to be > set, which can be modified to the value you want to set.</p></li>
<li><p>'''ipv4.gateway''' represents the address of the gateway</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo nmcli con mod "Wired connection 1" \<br />
ipv4.addresses "192.168.1.110" \'''</p>
<p>'''ipv4.gateway "192.168.1.1" \'''</p>
<p>'''ipv4.dns "8.8.8.8" \'''</p>
<p>'''ipv4.method "manual"'''</p>|}</li></ol>
</li>
<li><p>Then restart the linux system</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo reboot'''</p>|}</li>
<li><p>Then re-enter the Linux system and use the '''ip addr show eth0''' command to see that the IP address has been set to the desired value.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ip addr show eth0'''</p>
<p>3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 5e:ae:14:a5:91:b3 brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.110</span>'''/32 brd 192.168.1.110 scope global noprefixroute eth0</p>::<p>valid_lft forever preferred_lft forever</p>:<p>inet6 240e:3b7:3240:c3a0:97de:1d01:b290:fe3a/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259183sec preferred_lft 172783sec</p>:<p>inet6 fe80::3312:861a:a589:d3c/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li></ol>
<span id="how-to-set-up-the-linux-system-to-automatically-connect-to-the-network-for-the-first-time"></span>
=== How to set up the Linux system to automatically connect to the network for the first time ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The development board has an Ethernet port. If you want to remotely log in to the Linux system of the development board through the Ethernet port, you only need to plug in a network cable that can access the Internet normally. After starting the Linux system, it will automatically connect to the Ethernet port through DHCP. Assign an IP address, and then we can obtain the IP address of the Ethernet port through the HDMI screen, serial port, or view the router's background, and then log in to the Linux system remotely.'''
'''The development board also has wireless WIFI. If you want to remotely log in to the Linux system of the development board through WIFI, you need to remotely log in to the Linux system through ssh through the IP address of the Ethernet port and then use commands to connect to WIFI, or use commands on the HDMI screen or serial port. Connect to WIFI.'''
'''But if there is no HDMI screen and serial port module, although there is a network cable, the IP address of the development board cannot be viewed through the router background. Or if there is no HDMI screen, serial port module and network cable, and only WIFI can be connected, you can use the method introduced in this section to automatically connect to WIFI and set the static IP address of WIFI or automatically set the static IP address of the Ethernet port.'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''To use the method in this section, you first need to prepare a Linux system machine. For example, a computer or virtual machine with Ubuntu system installed.'''
'''To use the method in this section, Why do you first need to prepare a Linux system machine? Because the root file system of the Linux system of the development board burned in the TF card is in ext4 format. For example, The Linux system machine can mount it normally and then modify the configuration file in it.'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If you want to modify it in a computer or virtual machine with Ubuntu Windows system installed, you can use the software Paragon ExtFS for Windows. Since this software requires payment, and there is currently no similar free software that is easy to use, I will not demonstrate it in detail here.'''
<ol style="list-style-type: decimal;">
<li><p>First burn the Linux image of the development board you want to use into a TF card, and then use a card reader to insert the TF card with the Linux image of the development board into a machine with a Linux system (such as a machine with Ubuntu system Computer, the following uses Ubuntu computer as an example for demonstration)</p></li>
<li><p>When the TF card is inserted into the Ubuntu computer, the Ubuntu computer will generally automatically mount the Linux root file system partition in the TF card. From the following command, we can know that '''/media/test/opi_root''' is the Linux root file in the TF card. System mounting path</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''df -h | grep "media"'''</p>
<p>/dev/sdd1 1.4G 1.2G 167M 88% '''<span style="color:#FF0000">/media/test/opi_root</span>'''</p>
<p>test@test:~$ '''ls /media/test/opi_root'''</p>
<p>bin boot dev etc home lib lost+found media mnt opt proc root run <br> sbin selinux srv sys tmp usr var</p>|}</li>
<li><p>Then enter the '''/boot''' directory of the Linux system burned in the TF card</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd /media/test/opi_root/boot/'''</p>|}</li>
<li><p>Then copy the '''orangepi_first_run.txt.template''' to '''orangepi_first_run.txt'''. Through the orangepi_first_run.txt configuration file, you can set the development board to automatically connect to a WIFI hotspot when the Linux system starts for the first time. You can also set the WIFI or Ethernet port Static IP address.</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:/media/test/opi_root/boot$ '''sudo cp orangepi_first_run.txt.template orangepi_first_run.txt'''</p>|}</li>
<li><p>You can open the orangepi_first_run.txt file through the following command, and then you can view and modify the contents.</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:/media/test/opi_root/boot$ '''sudo vim orangepi_first_run.txt'''</p>|}</li>
<li><p>Variable usage instructions in the orangepi_first_run.txt file</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''FR_general_delete_this_file_after_completion''' The variable is > used to set whether to delete the orangepi_first_run.txt file > after the first startup. The default is 1, which means > deletion. If set to 0, orangepi_first_run.txt will be renamed > after the first startup.orangepi_first_run.txt.old, Generally, > just keep the default value</p></li><li><p>'''FR_net_change_defaults''' The variable is used to set whether > to change the default network settings. This must be set to 1, > otherwise all network settings will not take effect.</p></li><li><p>'''FR_net_ethernet_enabled''' The variable is used to control > whether to enable the configuration of the Ethernet port. If > you need to set the static IP address of the Ethernet port, > please set it to 1</p></li><li><p>'''FR_net_wifi_enabled''' The variable is used to control whether > to enable WIFI configuration. If you need to set the > development board to automatically connect to WIFI hotspots, > you must set it to 1. Also please note that if this variable > is set to 1, the Ethernet port settings will be invalid. That > is to say, the WIFI and Ethernet ports cannot be set at the > same time (why, because it is not necessary...)</p></li><li><p>'''FR_net_wifi_ssid''' Variable is used to set the name of the > WIFI hotspot you want to connect to</p></li><li><p>'''FR_net_wifi_key''' Variable is used to set the password of the > WIFI hotspot you want to connect to</p></li><li><p>'''FR_net_use_static''' Variables are used to set whether the > static IP address of the WIFI or Ethernet port needs to be > set.</p></li><li><p>'''FR_net_static_ip''' The variable is used to set the static IP > address. Please set it according to your actual situation.</p></li><li><p>'''FR_net_static_gateway''' Variables are used to set the gateway. > Please set according to your actual situation.</p></li></ol>
</li>
<li><p>Here are some specific setting examples:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>For example, if you want the Linux system of the development > board to automatically connect to the WIFI hotspot after it is > started for the first time, you can set it like this: </p><ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_defaults''' to 1</p></li><li><p>b) Set '''FR_net_wifi_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_wifi_ssid''' to the name of the WIFI hotspot you > want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot > you want to connect to</p></li></ol>
</li>
<li><p>For example, you want the Linux system of the development board > to automatically connect to the WIFI hotspot after the first > startup, and set the WIFI IP address to a specific static IP > address (so that when the Linux system starts, you can > directly use the set static IP address to ssh remotely Log in > to the development board, there is no need to check the IP > address of the development board through the router > background), you can set it like this:</p><ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_defaults''' to '''1'''</p></li><li><p>b) Set '''FR_net_wifi_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_wifi_ssid''' to the name of the WIFI hotspot you > want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot > you want to connect to</p></li><li><p>e) Set '''FR_net_use_static''' to '''1'''</p></li><li><p>f) Set '''FR_net_static_ip''' to the desired IP address</p></li><li><p>g) Set '''R_net_static_gateway''' to the corresponding gateway > address</p></li></ol>
</li>
<li><p>For example, if you want the development board's Linux system > to automatically set the IP address of the Ethernet port to > the desired static IP address after it is started for the > first time, you can set it like this</p><ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_default''' to '''1'''</p></li><li><p>b) Set '''FR_net_ethernet_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_use_static''' to '''1'''</p></li><li><p>d) Set '''FR_net_static_ip''' to the desired IP address</p></li><li><p>e) Set '''FR_net_static_gateway''' to the corresponding gateway > address</p></li></ol>
</li></ol>
</li>
<li><p>After modifying the orangepi_first_run.txt file, you can exit the /boot directory of the development board Linux system in the TF card, uninstall the TF card, and then insert the TF card into the development board to start.</p></li>
<li><p>If a static IP address is not set, you still need to check the IP address through the router background. If a static IP address is set, you can ping the set static IP address on the computer. If you can ping, it means that the system has started normally, and The network has been set up correctly, and then you can use the set IP address to ssh to remotely log in to the Linux system of the development board.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </libig></ol> '''After the development board's Linux system is started for the first time, orangepi_first_run.txt will be deleted or renamed to orangepi_first_run.txt.old. At this time, even if the orangepi_first_run.txt configuration file is reset, and then the development board's Linux system is restarted, orangepi_first_run. The configuration in txt will not take effect again, because this configuration will only take effect when the Linux system is started for the first time after burning it. Please pay special attention to this point.'''</big>|}</li></ol><span id="ssh-remote-login-development-board"></span>
== SSH remote login development board ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Linux systems enable ssh remote login by default and allow root users to log in to the system. Before ssh login, you first need to ensure that the Ethernet or wifi network is connected, and then use the ip addr command or obtain the IP address of the development board by checking the router'''</big>|}
<span id="ssh-remote-login-development-board-under-ubuntu"></span>
# Then you can remotely log in to the Linux system through the ssh command
::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''ssh [mailto:root@192.168.1.36 orangepi@192.168.1.]xxx''' (Need to be replaced with the IP address of the development board)
orangepi@192.168.1.xx's password: (iEnter (Enter your password here, the default password is orangepi)|}::{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when entering a password, <span style="color:#FF0000">the specific content of the entered password will not be displayed on the screen</span>. Please do not think that there is something wrong. Just press Enter after entering it.'''
'''Note that when entering a password, the specific content of the entered password will not be displayed on the screen. Please do not think that there is something wrong. Just press Enter after entering it.''' '''f If you are prompted to refuse the connection, as long as you are using the image provided by Orange Pi, <span style="color:#FF0000">please do not doubt whether the orangepi password is incorrect</span>, but look for other reasons.'''</big>|}
<ol start="3" style="list-style-type: decimal;">
<li><p>After successfully logging into the system, the display is as shown below</p>
<p>[[File:media/image140zero2w-img140.png|575x273px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''If ssh cannot log in to the Linux system normally, first check whether the IP address of the development board can be pinged. If there is no problem with pinging, you can log in to the Linux system through the serial port or HDMI display and enter the following command on the development board before trying again. Can it be connected?: '''</p></li></ol>
root@orangepi:~# '''reset_ssh.sh'''
'''If it still doesn't work, please try restarting the system.'''</big>
|}
</li></ol>
<span id="ssh-remote-login-development-board-under-windows"></span>
=== SSH remote login development board under Windows ===
<li><p>Open '''Session'''</p></li>
<li><p>Then select '''SSH''' in '''Session Setting'''</p></li>
<li><p>Then enter the IP address of the development board in '''Remote > host'''</p></li><li><p>Then enter the username '''root''' or '''orangepi''' of the linux > system in '''Specify username'''.</p></li>
<li><p>Finally click '''OK'''</p>
<div class="figure">
[[File:media/image141zero2w-img141.png|553x280px|14]]
</div></li></ol>
</li>
<li><p>You will then be prompted to enter a password. The default passwords for both root and orangepi users are orangepi.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that when entering a password, <span style="color:#FF0000">the specific content of the entered password will not be displayed on the screen</span>. Please do not think that there is any malfunction. Just press Enter after entering the password.'''</p></big>|}
<div class="figure">
[[File:media/image142zero2w-img142.png|553x151px|15]]
</div></li>
<li><p>After successfully logging into the system, the display is as shown below</p>
<p>[[File:media/image143zero2w-img143.png|450x313px]]</p></li></ol>
<span id="hdmi-test"></span>
== HDMI test ==
<div class="figure">
[[File:media/image14zero2w-img14.png|148x132px|IMG_256]]
</div></li>
<li><p>After starting the Linux system, if there is image output on the HDMI display, it means that the HDMI interface is working normally.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </li></olbig>'''Note that although many laptops have HDMI interfaces, the HDMI interface of the laptop generally only has the output function and does not have the HDMI in function, which means that the HDMI output of other devices cannot be displayed on the laptop screen'''
=== HDMI to VGA display test ===
<ol style="list-style-type: lower-alpha;">
<li><p>HDMI to VGA converter</p>
<p>[[File:media/image144zero2w-img144.png|155x104px]]</p></li>
<li><p>A VGA cable and a Mini HDMI male to HDMI female adapter</p>
<p>[[File:media/image145zero2w-img145.png|145x131px]] [[File:media/image146zero2w-img146.png|225x128px]]</p></li>
<li><p>A monitor or TV that supports VGA interface</p></li></ol>
</li>
<li><p>HDMI to VGA display test is as follows</p>
<p>[[File:media/image147zero2w-img147.png|574x337px]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When using HDMI to VGA display, the development board and the Linux system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</p></big>|}</li></ol>
<span id="how-to-set-hdmi-resolution-in-linux5.4-system"></span>
=== How to set HDMI resolution in Linux5.4 system ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: This method is only applicable to systems with Linux 5.4 kernel.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>There is a disp_mode variable in '''/boot/orangepiEnv.txt''' of the Linux system, which can be used to set the resolution of HDMI output. The default resolution of the Linux system is 1080p60</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>console=both</p>
<p>disp_mode='''<span style="color:#FF0000">1080p60</span>'''</p>
<p>fb0_width=1920</p>
<p>fb0_height=1080</p>|}</li><li><p>The disp_mode variable supports setting values as shown in the table below</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''disp_mode supported values'''
| '''60'''
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: Linux systems currently do not support 4K resolution.'''</big>|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Change the value of the disp_mode variable to the resolution you want to output, then restart the system, and HDMI will output the set resolution.</p></li>
<li><p>The method of checking the HDMI output resolution is as follows. If the displayed resolution is the same as the set resolution, it means that the settings on the development board are correct.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo cat /sys/class/disp/disp/attr/sys'''</p>
|}<p>[[File:media/image148zero2w-img148.png|575x84px]]</p></li></ol>
<span id="how-to-modify-the-width-and-height-of-framebuffer-in-linux5.4-system"></span>
=== How to modify the width and height of Framebuffer in Linux5.4 system ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: This method is only applicable to systems with Linux 5.4 kernel.'''</big>|}
There are two variables, fb0_width and fb0_height, in '''/boot/orangepiEnv.txt''' of the Linux system. You can use them to set the width and height of the Framebuffer. The Linux system defaults to fb0_width=1920 and fb0_height=1080.
{| class="wikitable" style="width:800px;"
|-
|
orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''
disp_mode=1080p60
'''<span style="color:#FF0000">fb0_width=1920</span>'''
'''<span style="color:#FF0000">fb0_height=1080</span>'''|}
The reference values corresponding to different resolutions of fb0_width and fb0_height are as follows::
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''HDMI resolution'''
<span id="framebuffer-cursor-setting"></span>
=== Framebuffer cursor setting ===
<ol style="list-style-type: decimal;">
<li><p>The softcursor used by Framebuffer, the method to set the cursor to blink or not to blink is as follows</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''echo <span style="color:#FF0000">1 </span> > /sys/class/graphics/fbcon/cursor_blink #Cursor flashes'''</p><p>root@orangepi:~# '''echo <span style="color:#FF0000">0 </span> > /sys/class/graphics/fbcon/cursor_blink #Cursor does not flash'''</p>|}</li>
<li><p>If you need to hide the cursor, you can add vt.global_cursor_default=0 to the '''extraargs''' variable in '''/boot/orangepiEnv.txt''' (the value of extraargs will be assigned to the '''bootargs''' environment variable and eventually passed to the kernel) (if '''<span class="mark">vt.global_cursor_default=1</span>''', it will be displayed cursor), then restart the system and you will see that the cursor has disappeared.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>fb0_width=1920</p>
<p>fb0_height=1080</p>
<p>'''<span style="color:#FF0000">extraargs=vt.global_cursor_default=0</span>'''</p>|}</li></ol>
<span id="how-to-use-bluetooth"></span>
== How to use Bluetooth ==
<ol style="list-style-type: decimal;">
<li><p>Click the Bluetooth icon in the upper right corner of the desktop</p>
<p>[[File:media/image149zero2w-img149.png|314x122px]]</p></li>
<li><p>Then select the adapter</p>
<p>[[File:media/image150zero2w-img150.png|318x140px]]</p></li>
<li><p>If prompted with the following interface, please select '''Yes'''.</p>
<p>[[File:media/image151zero2w-img151.png|248x85px]]</p></li>
<li><p>Then set the '''Visibility Setting''' to '''Always visible''' in the Bluetooth adapter setting interface, and then turn it off.</p>
<p>[[File:media/image152zero2w-img152.png|196x183px]]</p></li>
<li><p>Then open the configuration interface of the Bluetooth device</p>
<p>[[File:media/image153zero2w-img153.png|438x179px]]</p></li>
<li><p>Click '''Search''' to start scanning for surrounding Bluetooth devices</p>
<p>[[File:media/image154zero2w-img154.png|311x210px]]</p></li>
<li><p>Then select the Bluetooth device you want to connect, and then right-click the mouse to pop up the operation interface for the Bluetooth device. Select '''Pair''' to start pairing. The demonstration here is pairing with an Android phone.</p>
<p>[[File:media/image155zero2w-img155.png|311x242px]]</p></li>
<li><p>When pairing, a pairing confirmation box will pop up in the upper right corner of the desktop. Just select '''Confirm''' to confirm. At this time, you also need to confirm on the mobile phone.</p>
<p>[[File:media/image156zero2w-img156.png|411x150px]]</p></li>
<li><p>After pairing with the mobile phone, you can select the paired Bluetooth device, then right-click and select '''Send a File''' to start sending a picture to the mobile phone.</p>
<p>[[File:media/image157zero2w-img157.png|405x239px]]</p></li>
<li><p>The interface for sending pictures is as follows</p>
<p>[[File:media/image158zero2w-img158.png|399x231px]]</p></li></ol>
<span id="how-to-use-server-version-image"></span>
<ol style="list-style-type: decimal;">
<li><p>After entering the system, you can first check whether there is a Bluetooth device node through the '''hciconfig''' command. If it exists, it means that the Bluetooth initialization is normal.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt update && sudo apt install -y bluez'''</p>
<p>orangepi@orangepi:~$ '''hciconfig -a'''</p>
<p>hci0: Type: Primary Bus: UART</p>
:<p>BD Address: 3E:61:3D:19:0E:52 ACL MTU: 1021:8 SCO MTU: 240:3</p>:<p>UP RUNNING</p>:<p>RX bytes:925 acl:0 sco:0 events:72 errors:0</p>:<p>TX bytes:5498 acl:0 sco:0 commands:72 errors:0</p>:<p>Features: 0xbf 0xff 0x8d 0xfe 0xdb 0x3d 0x7b 0xc7</p>:<p>Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3</p>:<p>Link policy: RSWITCH SNIFF</p>:<p>Link mode: SLAVE ACCEPT</p>:<p>Name: 'orangepi'</p>:<p>Class: 0x3c0000</p>:<p>Service Classes: Rendering, Capturing, Object Transfer, Audio</p>:<p>Device Class: Miscellaneous,</p>:<p>HCI Version: 5.0 (0x9) Revision: 0x400</p>:<p>LMP Version: 5.0 (0x9) Subversion: 0x400</p>:<p>Manufacturer: Spreadtrum Communications Shanghai Ltd (492)</p>|}</li>
<li><p>Use '''bluetoothctl''' to scan for Bluetooth devices</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo bluetoothctl'''</p>
<p>[NEW] Controller 10:11:12:13:14:15 orangepizero2w [default]</p>
<p>Discovery stopped</p>
<p>[CHG] Controller 10:11:12:13:14:15 Discovering: no</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF RSSI is nil</p>|}</li>
<li><p>After scanning the device you want to pair, you can pair it. For pairing, you need to use the MAC address of the device.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>[bluetooth]# '''pair DC:72:9B:4C:F4:CF''' '''#Pair using the MAC address of the scanned Bluetooth device'''</p>
<p>Attempting to pair with DC:72:9B:4C:F4:CF</p>
<p>'''Pairing successful #Prompt pairing successful'''</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF ServicesResolved: no</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF Connected: no</p>|}</li>
<li><p>After successful pairing, the Bluetooth interface of the mobile phone will appear as follows:</p>
<div class="figure">
[[File:media/image159zero2w-img159.png|241x136px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-15.jpg未标题-15]]
</div></li>
<li><p>To connect to a Bluetooth device, you need to install the '''pulseaudio-module-bluetooth''' software package, and then start the '''pulseaudio''' service</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo''' '''apt -y install pulseaudio-module-bluetooth'''</p>
<p>orangepi@orangepi:~$ '''pulseaudio --start'''</p>|}</li>
<li><p>How to connect Bluetooth devices</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo bluetoothctl'''</p>
<p>Agent registered</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF ServicesResolved: yes</p>
<p>[CHG] Controller 10:11:12:13:14:15 Discoverable: no</p>
<p>'''[orangepi]# #If this prompt appears, the connection is successful.'''</p>|}</li>
<li><p>After connecting the Bluetooth device, you can see the prompt that the audio for calls and media has been '''connected in the Bluetooth configuration interface of the Android phone'''.</p>
<div class="figure">
[[File:media/image159zero2w-img159.png|294x166px|未标题-15]]
</div></li></ol>
<span id="usb-interface-test"></span>
== USB interface test ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The USB interface can be connected to a USB hub to expand the number of USB interfaces.'''</big>|}
<span id="usb-interface-extension-description"></span>
As shown in the figure below, there are only two Type-C USB2.0 interfaces on the main board of the development board, which cannot directly connect USB Type-A mice, keyboards and other USB devices.
[[File:media/image160zero2w-img160.png|383x190px]]
If you only purchased the motherboard and not the 24pin expansion board, you can prepare a Type-C to USB cable as shown in the figure below, plug one end of the Type-C interface into the Type-C interface of the motherboard, and then plug the other end into You can connect USB devices such as mouse and keyboard. If you feel that one USB interface is not enough, you can also expand multiple USB interfaces through USB Hub.
[[File:media/image24zero2w-img24.png|193x127px]]
If you purchase a 24pin expansion board, you do not need a Type-C to USB cable, because the 24pin expansion board can expand two USB2.0 interfaces.
[[File:media/image107zero2w-img107.png|338x229px]]
<span id="how-to-set-usb0-to-host-mode"></span>
As shown in the figure below, there are two Type-C interfaces on the main board of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode
[[File:media/image160zero2w-img160.png|346x171px]]
USB0 of the Linux system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode, it is recommended to use USB0 for power supply, so that USB1 can be used directly to connect USB devices
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:media/image80zero2w-img80.png|397x196px]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:media/image81zero2w-img81.png|393x202px]]</p></li><li><p>Then use the keyboard’s keyboard's arrow keys to locate the location shown in > the picture below, and then use the space to select '''usb0-host'''</p><p>[[File:media/image161zero2w-img161.png|400x58px]]</p></li>
<li><p>Then select '''<Save>'''to save</p>
<p>[[File:media/image83zero2w-img83.png|397x92px]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:media/image84zero2w-img84.png|395x91px]]</p></li><li><p>Then select '''<Reboot>'''to restart the system to make the > configuration take effect.</p><p>[[File:media/image85zero2w-img85.png|281x140px]]</p></li><li><p>After restarting, USB0 can use USB devices such as mouse and > keyboard normally.</p></li></ol>
<span id="connect-usb-mouse-or-keyboard-to-test"></span>
=== Connect USB mouse or keyboard to test ===
# Execute the following command. If you can see the output of sdX, it means the USB disk is successfully recognized.
::{| class="wikitable" style="width:800px;"|-|orangepi@orangepi:~$ '''cat /proc/partitions | grep "sd*"'''<br> <span style="margin-right: 30px;">major </span><span style="margin-right: 40px;">minor </span><span style="margin-right: 30px;">#blocks </span><span style="margin-right: 50px;">name</span><br> <span style="margin-right: 70px;">8 </span><span style="margin-right: 60px;">0 </span><span style="margin-right: 50px;">30044160 </span><span style="margin-right: 50px;color:#FF0000">'''sda'''</span><br> <span style="margin-right: 70px;">8 </span><span style="margin-right: 60px;">1 </span><span style="margin-right: 50px;">30043119 </span><span style="margin-right: 50px;color:#FF0000">'''sda1'''</span><br>|}
<ol start="3" style="list-style-type: decimal;">
<li>Use the mount command to mount the U disk to '''/mnt''', and then you can view the files in the U disk</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo mount /dev/sda1 /mnt/'''
test.txt
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After mounting, you can check the capacity usage and mount point of the U disk through the '''df -h''' command.</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''df -h | grep "sd"'''
/dev/sda1 29G 208K 29G 1% /mnt|}</ol><span id="usb-ethernet-card-test"></span>
=== USB Ethernet card test ===
# The '''currently tested''' and usable USB Ethernet cards are as follows. Among them, the RTL8153 USB Gigabit network card can be used normally when inserted into the USB 2.0 Host interface of the development board for testing, but the speed cannot reach Gigabit. Please note this.
::{| class="wikitable" style="width:800px;text-align: center;"
|-
| serial number
<ol start="2" style="list-style-type: decimal;">
<li><p>First insert the USB network card into the USB interface of the development board, and then insert the network cable into the USB network card to ensure that the network cable can access the Internet normally. If you can see the following log information through the '''dmesg''' command, it means that the USB network card is recognized normally.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''dmesg | tail'''</p>
<p>[ 121.985016] usb 3-1: USB disconnect, device number 2</p>
<p>[ 127.763031] IPv6: ADDRCONF(NETDEV_UP): enx00e04c362017: link is not ready</p>
<p>[ 129.892465] r8152 3-1:1.0 enx00e04c362017: carrier on</p>
<p>[ 129.892583] IPv6: ADDRCONF(NETDEV_CHANGE): enx00e04c362017: link becomes ready</p>|}</li>
<li><p>Then you can see the device node of the USB network card and the automatically assigned IP address through the ifconfig command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo ifconfig'''</p>
<p>'''enx00e04c362017''': flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500</p>
::<p>inet '''192.168.1.177''' netmask 255.255.255.0 broadcast 192.168.1.255</p>::<p>inet6 fe80::681f:d293:4bc5:e9fd prefixlen 64 scopeid 0x20<link></p>::<p>ether 00:e0:4c:36:20:17 txqueuelen 1000 (Ethernet)</p>::<p>RX packets 1849 bytes 134590 (134.5 KB)</p>::<p>RX errors 0 dropped 125 overruns 0 frame 0</p>::<p>TX packets 33 bytes 2834 (2.8 KB)</p>::<p>TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>|}</li>
<li><p>The command to test network connectivity is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ping www.baidu.com -I enx00e04c362017'''</p>
<p>PING www.a.shifen.com (14.215.177.38) from 192.168.1.12 eth0: 56(84) bytes of data.</p>
<p>--- www.a.shifen.com ping statistics ---</p>
<p>4 packets transmitted, 4 received, 0% packet loss, time 3002ms</p>
<p>rtt min/avg/max/mdev = 6.260/6.770/7.275/0.373 ms</p>|}</li></ol>
<span id="usb-camera-test"></span>
=== USB camera test ===
<li><p>First insert the USB camera into the USB interface of the Orange Pi development board</p></li>
<li><p>Then you can see through the lsmod command that the kernel automatically loads the following modules</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''lsmod'''</p>
<pspan style="margin-right: 100px;">Module </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 45px;">Used by</pspan><br><pspan style="margin-right: 100px;">'''uvcvideo </span><span style="margin-right: 50px;">106496 </span><span style="margin-right: 50px;">0'''</pspan><br>|}</li>
<li><p>Through the v4l2-ctl command, you can see that the device node information of the USB camera is/dev/video0</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo''' '''apt install -y v4l-utils'''</p>
<p>orangepi@orangepi:~$ '''v4l2-ctl --list-devices'''</p>
<p>USB 2.0 Camera (usb-sunxi-ehci-1):</p>
::<p>/dev/video0</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the l in v4l2 is the lowercase letter l, not the number 1.'''</p><p>'''In addition, the serial number of the video may not always be video0, please refer to what you actually see.'''</p></big>|}</li>
<li><p>Use fswebcam to test the USB camera</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Install fswebcam</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo''' '''apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y fswebcam'''</p>|}</li><li><p>After installing fswebcam, you can use the following command to > take pictures</p><ol style="list-style-type: lower-alphanone;"><li><p>a) -d Option to specify the device node of the USB camera</p></li><li><p>b) --no-banner Used to remove watermarks from photos</p></li><li><p>c) -r option is used to specify the resolution of the photo</p></li><li><p>d) -S Option to skip previous frames</p></li><li><p>e) ./image.jpg Used to set the name and path of the generated > photo</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''sudo''' '''fswebcam -d /dev/video0 \'''</p>
<p>'''--no-banner -r 1280x720 -S 5 ./image.jpg'''</p>|}</li></ol></li><li><p>In the server version of Linux system, after taking the picture, > you can use the scp command to transfer the taken picture to > the Ubuntu PC for mirror viewing.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''scp image.jpg [mailto:test@192.168.1.55:/home/test test@192.168.1.55:/home/test] (Modify the IP address and path according to the actual situation)'''</p>|}</li><li><p>In the desktop version of Linux system, you can directly view > the captured pictures through the HDMI display</p></li></ol>
</li>
<li><p>Use mjpg-streamer to test the USB camera</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Download mjpg-streamer</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Github download address:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''git clone https://github.com/jacksonliam/mjpg-streamer'''</p>|}</li><li><p>b) The image download address of Gitee is:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''git clone https://gitee.com/leeboby/mjpg-streamer'''</p>|}</li></ol>
</li>
<li><p>Install dependent software packages</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Ubuntu system</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get install -y cmake libjpeg8-dev'''</p>|}</li><li><p>b) Debian system</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get install -y cmake libjpeg62-turbo-dev'''</p>|}</li></ol>
</li>
<li><p>Compile and install mjpg-streamer</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''cd mjpg-streamer/mjpg-streamer-experimental'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''make -j4'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''sudo make install'''</p>|}</li>
<li><p>Then enter the following command to start mjpg_streamer</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the serial number of the video is not always video0, please refer to what you actually see.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''export LD_LIBRARY_PATH=.'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''sudo ./mjpg_streamer -i "./input_uvc.so -d \'''</p>
<p>'''/dev/video0 -u -f 30" -o "./output_http.so -w ./www"'''</p>|}</li><li><p>Then enter ['''the IP address of the development board: 8080'''] > in the Ubuntu PC or Windows PC or mobile phone browser on the > same LAN as the development board to see the video output by > the camera.</p>
<div class="figure">
[[File:media/image162zero2w-img162.png|575x278px|图片9]]
</div></li></ol>
<span id="audio-test"></span>
== Audio test ==
<ol style="list-style-type: decimal;">
<li><p>There is no headphone interface on the main board of the development board. We can expand it through a 24pin expansion board.</p>
<p>[[File:media/image107zero2w-img107.png|338x229px]]</p></li>
<li><p>Use the '''aplay -l''' command to view the sound card devices supported by the Linux system</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The output of the linux5.4 system is as follows, where '''card 0: > audiocodec''' is the sound card device required for headphone > playback</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''aplay -l'''</p>
<p>**** List of PLAYBACK Hardware Devices ****</p>
<p>'''card 0: audiocodec [audiocodec], device 0: soc@3000000:codec_plat-5096000.codec 5096000.codec-0 []'''</p>
:<p>'''Subdevices: 1/1'''</p>:<p>'''Subdevice #0: subdevice #0'''</p>|}</li><li><p>The output of the b.linux6.1 system is as follows, where > '''audiocodec''' is the sound card device required for headphone > playback.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''aplay -l'''</p>
<p>**** List of PLAYBACK Hardware Devices ****</p>
<p>'''card 0: audiocodec [audiocodec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]'''</p>
:<p>'''Subdevices: 1/1'''</p>:<p>'''Subdevice #0: subdevice #0'''</p>|}</li></ol>
</li>
<li><p>Then use the '''aplay''' command to play the audio, and the sound can be heard through the headphones</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''aplay -D hw:0,0 /usr/share/sounds/alsa/audio.wav'''</p>
<p>Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </libig></ol> '''If there is noise during the headphone test, please pull out some of the headphones and do not plug them all the way in.'''</big>|}</li></ol><span id="hdmi-audio-playback-test"></span>
==== HDMI audio playback test ====
<li><p>First use the Mini HDMI to HDMI cable to connect the Orange Pi development board to the TV (other HDMI displays need to ensure that they can play audio)</p></li>
<li><p>HDMI audio playback does not require other settings, just use the '''aplay''' command to play directly</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''aplay -D hw:2,0 /usr/share/sounds/alsa/audio.wav'''</p>|}</li></ol>
<span id="test-audio-methods-on-desktop-systems"></span>
=== Test audio methods on desktop systems ===
<ol style="list-style-type: decimal;">
<li><p>First open the file manager</p>
<p>[[File:media/image163zero2w-img163.png|257x126px]]</p></li>
<li><p>Then find the following file (if there is no such audio file in the system, you can upload an audio file to the system yourself)</p>
<div class="figure">
[[File:media/image164zero2w-img164.png|236x186px|图片10]]
</div></li>
<li><p>Then select the audio.wav file, right-click and select open with vlc to start playing.</p>
<p>[[File:media/image165zero2w-img165.png|241x195px]]</p></li>
<li><p>How to switch between different audio devices such as HDMI playback and headphone playback</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First open the volume control interface</p>
<p>[[File:media/image166zero2w-img166.png|294x161px]]</p></li><li><p>When playing audio, the audio device options that can be used by > the '''Playback''' software will be displayed in '''Playback''', > as shown in the figure below. Here you can set which audio > device needs to be played.</p>
<div class="figure">
[[File:media/image167zero2w-img167.png|576x324px|4]]
</div></li></ol>
<span id="infrared-reception-test"></span>
== Infrared reception test ==
<ol style="list-style-type: decimal;">
<li><p>There is no infrared receiver on the main board of the development board. We can expand it through a 24pin expansion board.</p>
<p>[[File:media/image107zero2w-img107.png|338x226px]]</p></li><li><p>Install ir-keytable infrared test software</p></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo''' '''apt update'''
orangepi@orangepi:~$ '''sudo''' '''apt-get install -y ir-keytable'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Then execute ir-keytable to view the information of the infrared device</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5.4 system output is as follows</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''ir-keytable'''
Found /sys/class/rc/rc0/ with:
::Name: sunxi-ir
::Driver: sunxi-rc-recv
::Default keymap: rc_map_sunxi
::Input device: /dev/input/event1
::LIRC device: /dev/lirc0
::Attached BPF protocols: Operation not permitted
::Supported kernel protocols: lirc nec
::Enabled kernel protocols: lirc nec
::bus: 25, vendor/product: 0001:0001, version: 0x0100 Repeat delay = 500 ms, repeat period = 125 ms
::Repeat delay = 500 ms, repeat period = 125 ms
|}
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>The output of the linux6.1 system is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ir-keytable'''</p>
<p>Found /sys/class/rc/rc0/ with:</p>
::<p>Name: sunxi-ir</p>::<p>Driver: sunxi-ir</p>::<p>Default keymap: rc-empty</p>::<p>Input device: /dev/input/event5</p>::<p>LIRC device: /dev/lirc0</p>::<p>Attached BPF protocols: Operation not permitted</p>::<p>Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm</p>::<p>Enabled kernel protocols: lirc</p>::<p>bus: 25, vendor/product: 0001:0001, version: 0x0100</p>::<p>Repeat delay = 500 ms, repeat period = 125 ms</p>|}</li></ol> <!-- --/li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Before testing the infrared reception function, you need to prepare an Orange Pi-specific infrared remote control. '''<span classstyle="markcolor:#FF0000">Other remote controls do not support it</span>'''.</p>
<div class="figure">
[[File:media/image168zero2w-img168.png|140x131px|IMG_256]]
</div></li>
<li><p>Then enter the '''ir-keytable -t''' command in the terminal, and then use the infrared remote control to press the button against the infrared receiver of the Orange Pi development board to see the received key code in the terminal.</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5.4 system output is as follows</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo ir-keytable -t'''
1598339152.914715: event type EV_MSC(0x04): scancode = 0xfb0410
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>linux6.1 system output is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo ir-keytable -c -p NEC -t'''</p>
<p>Old keytable cleared</p>
<p>202.063219: lirc protocol(nec): scancode = 0x45c</p>
<p>202.063249: event type EV_MSC(0x04): scancode = 0x45c</p>
<p>202.063249: event type EV_SYN(0x00).</p>|}</li></ol></li></ol><span id="temperature-sensor"></span>
== Temperature sensor ==
H618 has a total of 4 temperature sensors. The command to view the temperature is as follows:
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The displayed temperature value needs to be divided by 1000, and the unit is Celsius.'''</big>|}
<ol style="list-style-type: lower-alpha;">
<li>sensor0: CPU temperature sensor, the first command is used to view > the type of temperature sensor, the second command is used to view > the value of the temperature sensor</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone0/type'''
'''57734'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>sensor1: DDR temperature sensor, the first command is used to view > the type of temperature sensor, the second command is used to view > the value of the temperature sensor</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone1/type'''</p>
<p>'''ddr'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone1/temp'''</p>
<p>'''57410'''</p>|}</li><li><p>sensor2: GPU temperature sensor, the first command is used to view > the type of temperature sensor, the second command is used to view > the value of the temperature sensor</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone2/type'''</p>
<p>'''gpu'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone2/temp'''</p>
<p>'''59273'''</p>|}</li><li><p>sensor3: VE’s VE's temperature sensor. The first command is used to view > the type of temperature sensor, and the second command is used to > view the value of the temperature sensor.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone3/type'''</p>
<p>'''ve'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone3/temp'''</p>
<p>'''58949'''</p>|}</li></ol>
<span id="how-to-check-the-temperature-in-linux6.1-system"></span>
=== How to check the temperature in linux6.1 system ===
{| class="wikitable" style="width:800px;"
|-
|
orangepi@orangepi:~$ '''sensors'''
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.4°C</span>''' (crit = +110.0°C)
gpu_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">48.7°C</span>''' (crit = +110.0°C)
ddr_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.8°C</span>''' (crit = +110.0°C)
ve_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.2°C</span>''' (crit = +110.0°C)|}
<span id="pin-interface-pin-description"></span>
== 40 Pin Interface pin description ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<ol style="list-style-type: decimal;">
<div class="figure">
[[File:media/image169zero2w-img169.png|283x147px|004]]
</div></li>
<li><p>The functions of the 40 Pin interface pins on the development board are as shown in the table below</p></li></ol>
<div style="display: flex;">{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
| '''Function'''
| '''GPIO'''
| '''GPIO序号GPIO NO.'''
|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports in the 40pin interface. The high-level voltage of all GPIO ports is '''<span style="color:#FF0000">3.3v</span>'''</li></ol>
<ol stylespan id="listhow-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-style-type: lowerinstall-alpha;wiringop"><li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</pspan><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:media/image80.png|402x199px]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:media/image81.png|393x202px]]</p></li><li><p>Then use the keyboard's arrow keys == How to locate the position shown > in the figure below, and then use the '''space''' to select the > dtbo configuration of the SPI you want to open.</p></li></ol></li></ol>install wiringOP ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''dtbo configuration'''| '''illustrate<big>'''|Note that wiringOP is already pre-| '''spi1-cs0installed in the linux image released by Orange Pi. Unless the wiringOP code is updated, there is no need to re-cs1-spidev'''| '''Open cs0 download, compile and cs1 of spi1 at the same timeinstall, you can just use it directly.'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 The storage path of spi1'''|-| '''spi1the compiled wiringOP deb package in orangepi-cs1-spidev'''| 'build is: ''Only open cs1 of spi1'''|}
<ol style="list-style-type: decimal;"><li><p>Download the code of wiringOP</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''GPIO序号sudo apt update'''</p>| <p>orangepi@orangepi:~$ '''GPIOsudo apt install -y git'''</p>| <p>orangepi@orangepi:~$ '''Functiongit clone https://github.com/orangepi-xunlong/wiringOP.git -b next'''</p>| '''pin'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''pinNote that the source code needs to download the code of wiringOP next branch. Please don't miss the -b next parameter.'''</p>| <p>'''FunctionIf there is a problem downloading the code from GitHub, you can directly use the wiringOP source code that comes with the Linux image. The storage location is: /usr/src/wiringOP.'''</p></big>| '''GPIO'''}</li><li><p>Compile and install wiringOP</p>{| '''GPIO NO.'''class="wikitable" style="width:800px;"
|-
|-
| '''264'''| <p>root@orangepi:~/wiringOP# '''PI8'''| '''TWI1-SDA'''| '''3gpio mode <span style="color:#FF0000">2</span> out'''</p>|}| '''4'''</li>| '''5V'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''263'''| <p>root@orangepi:~/wiringOP# '''PI7'''| '''TWI1-SCL'''| '''5gpio write 2 <span style="color:#FF0000">0</span>'''</p>|}| '''6'''</li>| '''GND'''<li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP# '''269gpio write 2 <span style="color:#FF0000">1</span>'''</p>| '''PI13'''}</li><li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol> | '''PWM3<span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></UART4_TX'''span> === How to set the pull-down resistor of 40 Pin GPIO port ===| '''7'''|<ol style="list-style-type: decimal;">| '''8'''<li><p>The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the pull-up and pull-down resistors of the GPIO port.</p>| '''UART0_TX'''<p>[[File:zero2w-img171.png]]</p></li>| '''PH0'''<li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>{| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| ~/wiringOP# '''gpio mode <span style="text-aligncolor: left;#FF0000"|| '''GND>2</span> in'''</p>| '''9'''}|</li>| '''10'''<li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>{| '''UART0_RX'''| '''PH1'''| '''225'''class="wikitable" style="width:800px;"
|-
| '''226'''| <p>root@orangepi:~/wiringOP# '''PH2gpio mode <span style="color:#FF0000">2</span> up'''</p>| '''UART5_TX'''}| '''11'''</li>|| '''12'''<li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI1'''| '''257'''
|-
| '''227'''| <p>root@orangepi:~/wiringOP# '''PH3gpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''UART5_RX<span style="color:#FF0000">1</span>'''</p>| '''13'''}|</li>| '''14'''<li><p>Then execute the following command to set the GPIO port to pull-down mode</p>{| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP# '''261gpio mode <span style="color:#FF0000">2</span> down'''</p>| }</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''PI5gpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''TWI0_SCL<span style="color:#FF0000">0</UART2_TXspan>'''</p>| '''15'''}</li></ol> <span id="pin-spi-test"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''16GPIO NO.'''| '''PWM4/UART4_RXGPIO'''| '''PI14Function'''| '''270pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''171'''|-| '''264'''| '''18PI8'''| style="text'''TWI1-align: left;"SDA'''|'''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PH4PWM3/UART4_TX'''| '''2287'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''232226'''| '''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'''|-| '''<span style="color:#FF0000">231</span>'''| '''PH8<span style="color:#FF0000">PH7</span>'''| '''SPI1_MISO<span style="color:#FF0000">SPI1_MOSI</span>'''| '''21<span style="color:#FF0000">19</span>'''|-| '''22<span style="color:#FF0000">232</span>'''| '''TWI0_SDA<span style="color:#FF0000">PH8</UART2_RXspan>'''| '''PI6<span style="color:#FF0000">SPI1_MISO</span>'''| '''262<span style="color:#FF0000">21</span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''Multiplexing function in 40pinpin'''| '''Corresponding dtbo configurationFunction'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - i2c02'''| '''pi-i2c05V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c14'''| '''pi-i2c15V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c26'''| '''pi-i2c2GND'''|} [[File:media/image173.png|393x60px]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:media/image83.png|395x91px]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:media/image84.png|395x91px]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:media/image85.png|374x187px]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol style="list-styletext-typealign: lower-alphaleft;"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li><li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p><div class="figure"> [[File:media/image174.png|383x151px|选区_460]] </div></li></ol> <span id="pin-uart-test"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.8'''| '''GPIOUART0_TX'''| '''FunctionPH0'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.224'''
|-
| '''PH1'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''
|-
| '''<span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''>26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, uart spi1 is turned off by default and needs to be turned on manually before it can be used. 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 > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:media/image80zero2w-img80.png|396x195px]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:media/image81zero2w-img81.png|393x202px]]</p></li><li><p>Then use the keyboard’s keyboard's arrow keys to locate the position shown > in the picture figure below, and then use the '''space''' to select the > serial port dtbo configuration of the SPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- uart2cs0-cs1-spidev'''| '''pi-uart2Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- uart3cs0-spidev'''| '''pi-uart3Only open cs0 of spi1'''
|-
| '''40pin spi1- uart4'''| '''pics1-uart4spidev'''|-| '''40pin - uart5'''| '''ph-uart5Only open cs1 of spi1'''
|}
[[File:media/image175zero2w-img172.png|395x216px]]</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:media/image83zero2w-img83.png|397x92px]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:media/image84zero2w-img84.png|395x91px]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:media/image85zero2w-img85.png|374x187px]]</p></li></ol> <!-- --/li></ol><ol start="32" style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm Then check whether there is a uart5 device node under '''/devspidev1.x'''</p><p>'''Note device node in the Linux system. If it exists, it means that the linux5SPI1 configuration has taken effect.4 system is /dev/ttyASx.'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttySspidev1*'''</p><p>/dev/ttySxspidev1.0 /dev/spidev1.1</p></li>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Then start testing the uart interface. First use Dupont wire to short'''Note that only when you open spi1-cs0-cs1-circuit spidev, you will see the rx and tx pins device nodes of the uart interface to be testedtwo spi.'''</p></big>|}</li><li><p>Use Next, start the '''gpio''' command in wiringOP to spi loopback test . Do not short-circuit the loopback function mosi and miso pins of SPI1 first. The output result of the serial port running spidev_test is as shown belowfollows. If you You can see that the following print, it means the serial port communication is normaldata of TX and RX are inconsistent.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Note that the last x in the gpio serial sudo spidev_test -v -D /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device nodespidev1.0'''</p><p>orangepispi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@orangepi.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''<span style="color:~$ #FF0000">FF FF FF FF FF FF</span>'''gpio serial FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</devp>|}</ttySx # linuxli><li><p>Then short-6circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows.1 You can see the sending and receiving The data is the same, indicating that the loopback test command'''passed.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial sudo spidev_test -v -D /dev/ttyASx # linux-5spidev1.4 test command0'''</p><p>Outspi mode: 00x0</p><p>bits per word: -> 08</p><p>Out: 1max speed: -> 1500000 Hz (500 KHz)</p><p>OutTX | FF FF FF FF FF FF '''<span style="color: 2: -> 2#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>OutRX | FF FF FF FF FF FF '''<span style="color: 3: -> 3^C#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>|}</li></ol> <span id="pin-i2c-test"></span>
# As can be seen from the following tablebelow, the i2c available pwm for the 40pin interface are pwm1, pwm2i2c0, pwm3 i2c1 and pwm4.i2c2
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-| '''2<span style="color:#FF0000">264</span>'''| '''5V<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-| '''14<span style="color:#FF0000">261</span>'''| '''GND<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15</span>'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL</UART3_TX'''| '''PI9'''| '''265span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'40''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-| '''PI36'''| '''259GND'''|} <ol start="2" style="list-styletext-typealign: decimalleft;">|<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-styletext-typealign: lower-alphaleft;">||-<li><p>First run | '''orangepi-config8'''. Ordinary users remember to add > | '''sudoUART0_TX''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPH0'''</p></li><li><p>Then select | '''System224'''</p><p>[[File:media/image80.png|393x194px]]</p></li>-<li><p>Then select | '''Hardware10'''</p><p>[[File:media/image81.png|393x202px]]</p></li>'''UART0_RX'''<li><p>Then use the keyboard| '''PH1'''s arrow keys to locate the position shown > in the figure below, and then use the | '''space225''' to select the > configuration corresponding to the pwm you want to open.</p><p>[[File:media/image176.png|384x79px]]</p></li>-<li><p>Then select | '''<Save>12''' to save</p><p>[[File| style="text-align:media/image83.pngleft;"||397x92px]]</p></li>'''PI1'''<li><p>Then select | '''<Back>257'''</p><p>[[File:media/image84.png|395x91px]]</p></li>-| '''14'''<li><p>Then select | '''GND'''<| style="text-align: left;Reboot>"|| style="text-align: left;"||-| '''16''' to restart the system to make the > configuration take effect.<| '''PWM4/p>UART4_RX'''<p>[[File:media/image85.png|374x187px]]</p></li></ol>'''PI14'''</li>| '''270'''<li><p>After restarting, you can start the PWM test</p>|-<p>| '''Please execute the following commands under the root user.18'''</p><ol | style="listtext-style-typealign: lower-alphaleft;">|<li><p>Enter the following command on the command line to make pwm1 > output a 50Hz square wave</p><p>root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/exportPH4'''</p><p>root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period228'''</p><p>root@orangepi:~# |-| '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle20'''</p><p>root@orangepi:~# | '''GND'''echo 1 >| style="text-align: left; /sys/class/pwm/pwmchip0/pwm1/enable"|| style="text-align: left;"||-| '''</pspan style="color:#FF0000">22</lispan>'''| '''<lispan style="color:#FF0000">TWI0_SDA<p/span>Enter the following command on the command line to make pwm2 > output a 50Hz square wave</p>UART2_RX'''| '''</lispan style="color:#FF0000">PI6</olspan>'''| '''</lispan style="color:#FF0000">262</olspan>'''|-root@orangepi:~# | '''24'''| '''echo 2 > /sys/class/pwm/pwmchip0/exportSPI1_CS0'''| '''PH5'''root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period229'''|-| '''26'''root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycleSPI1_CS1'''| '''PH9'''root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable233'''|-| '''<ol startspan style="3color:#FF0000" >28</span>'''| '''<span style="listcolor:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<span style-type="color: lower-alpha;#FF0000">PI9<li/span>Enter the following command on the command line to make pwm3 output > a 50Hz square wave'''| '''</lispan style="color:#FF0000">265</olspan>'''|-root@orangepi:~# | '''echo 3 > /sys/class/pwm/pwmchip0/export30'''| '''GND'''root@orangepi| style="text-align:~# left;"|| style="text-align: left;"||-| '''32'''| '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/periodPWM1'''| '''PI11'''root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle267'''|-root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable34'''| '''GND'''<ol start| style="4text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: lower-alphaleft;">|| '''PC12'''<li>Enter the following command on the command line to make pwm4 output > a 50Hz square wave</li></ol>| '''76'''|-root@orangepi:~# | '''echo 4 > /sys/class/pwm/pwmchip0/export38'''| style="text-align: left;"|root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm4/periodPI4''' root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle260'''|-root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm4/enable40''' <div class| style="figuretext-align: left;">|| '''PI3'''[[File:media/image177.png|574x344px'''259'''|69D96433378187B10005CDD2A52881B0]]}
</div>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'wiringOP''|-Python is the Python language version of wiringOP library, used to operate the development board| 's GPIO, I2C, SPI, UART and other hardware resources in the Python program''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|}
[[File:zero2w-img173.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>'Also please note '' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that all there is an open i2c device node under /dev</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Sometimes the following commands are operated i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the root user.i2c bus is: '''</p></big>
<ol style="list-style-type: decimallower-alpha;"><li><p>'''First install dependency packagesrun the following command to check the corresponding relationship of i2c'''</p><p>rootorangepi@orangepiorangepizero2w:~# $ '''sudo aptls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-get update9]"'''</p><p>root@orangepi/sys/devices/platform/soc/5002000.i2c/i2c-0:~# '''sudo apt</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-get -y install git swig python3-dev python3-setuptools'''3:</p><p>/sys/devices/platform/lisoc/5002800.i2c/i2c-4:</p><lip>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>Then use the following command to download the source code of wiringOP/sys/devices/platform/soc/6000000.hdmi/i2c-Python2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</lip></olli>
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''117'''|-| '''231'''| '''PH7'''| '''2SPI1_MOSI'''| '''5V19'''| style="text-align: left;"| '''232'''| '''PH8'''|'''SPI1_MISO'''| '''21'''| style="text-align: left;"| '''230'''|'''PH6'''| '''SPI1_CLK'''| '''23'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''263256'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GNDPI0'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|-
| '''269268'''| '''PI13PI12'''| '''PWM3/UART4_TXPWM2'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''22433'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''939'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 uart is turned off by default and needs to be turned on manually before it can be used. 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 > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:media/image80zero2w-img80.png|389x192px]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:media/image81zero2w-img81.png|393x202px]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown > in the figure picture below, and then use the '''space''' to select the > dtbo configuration of the SPI serial port you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''illustratepi-uart2'''
|-
| '''spi140pin -cs0-cs1-spidevuart3'''| '''Open cs0 and cs1 of spi1 at the same timepi-uart3'''
|-
| '''spi140pin -cs0-spidevuart4'''| '''Only open cs0 of spi1pi-uart4'''
|-
| '''spi140pin -cs1-spidevuart5'''| '''Only open cs1 of spi1ph-uart5'''
|}
[[File:zero2w-img175.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:media/image83zero2w-img83.png|397x92px]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:media/image84zero2w-img84.png|395x91px]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:media/image85zero2w-img85.png|374x187px]]</p></li></ol></li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>Then check After entering the Linux system, first confirm whether there is a '''spidev1.x''' uart5 device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ under '''ls /dev/spidev1*'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <p>/dev/spidev1.0 /dev/spidev1.1</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spilinux5.4 system is /dev/ttyASx.'''</p></libig><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p>|}<ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''--channells /dev/ttyS*''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p><dev/li>ttySx</olp>|}
</li>
<li><p>Without shorting Then start testing the mosi uart interface. First use Dupont wire to short-circuit the rx and miso tx pins of SPI1, the output result uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of running spidev_test.py is the serial port as followsshown below. You If you can see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the data last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of TX and RX are inconsistentthe corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>rootorangepi@orangepi:~/wiringOP-Python# $ '''cd examplesgpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /li>dev/ttyASx # linux-5.4 test command'''</olp>
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-| '''6<span style="color:#FF0000">269</span>'''| '''GND<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'''
|-
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>33</span>'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''Multiplexing function in 40pinPin'''| '''Corresponding dtbo configurationFunction'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin 2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text- i2c0align: left;"|| style="text-align: left;"||-| '''8'''| '''piUART0_TX'''| '''PH0'''| '''224'''|-i2c0| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- i2c1align: left;"|| '''PI1'''| '''pi-i2c1257'''
|-
| '''40pin - i2c214'''| '''pi-i2c2GND'''|} [[File:media/image173.png|393x60px]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:media/image83.png|395x91px]]</p></li><li><p>Then select <span class="mark"><Back></span></p><p>[[File:media/image84.png|395x91px]]</p></li><li><p>Then select <span class="mark"><Reboot></span> to restart the system to make the > configuration take effect.</p><p>[[File:media/image85.png|374x187px]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol> <!-- --><ol start="3" style="listtext-style-typealign: lower-alphaleft;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol start="4" style="list-style-type: lower-alpha;"><li><p>002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:media/image178.png|180x153px]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></li></ol> [[File:media/image179.png|388x203px]] <ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''"/dev/i2c-x"'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.<span style="color:#FF0000">16</span>'''| '''GPIO<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''Function<span style="color:#FF0000">PI14</span>'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.<span style="color:#FF0000">270</span>'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-SDA| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''3229'''|-| '''426'''| '''5VSPI1_CS1'''| '''PH9'''| '''233'''| style="text-align: left;"|'''28'''| style="text'''TWI2-align: left;"SCL/UART3_TX'''|'''PI9'''| '''265'''
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269<span style="color:#FF0000">32</span>'''| '''PI13<span style="color:#FF0000">PWM1</span>'''| '''PWM3<span style="color:#FF0000">PI11</UART4_TXspan>'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224<span style="color:#FF0000">267</span>'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''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 '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''TWI0_SCL/UART2_TXHardware'''</p><p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''15space'''to select the configuration corresponding to the pwm you want to open.</p>|<p>[[File:zero2w-img176.png]]</p></li>| <li><p>Then select '''16<Save>'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''PWM4/UART4_RX<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''PI14<Reboot>'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li><li><p>After restarting, you can start the PWM test</p>{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|-
| <p>root@orangepi:~# '''231echo 1 > /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''PH7echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p>| <p>root@orangepi:~# '''SPI1_MOSIecho 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''19echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}| '''20'''</li>| '''GND'''<li><p>Enter the following command on the command line to make pwm2 output a 50Hz square wave</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''232echo 2 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH8echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period'''| '''SPI1_MISO'''| root@orangepi:~# '''21echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''|| root@orangepi:~# '''22echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable'''| '''TWI0_SDA}</UART2_RX'''ol><ol start="3" style="list-style-type: lower-alpha;">| '''PI6'''<li>Enter the following command on the command line to make pwm3 output a 50Hz square wave</li>{| '''262'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''230echo 3 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH6echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period'''| root@orangepi:~# '''SPI1_CLKecho 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''| root@orangepi:~# '''23echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable'''|}| '''24'''</ol>| '''SPI1_CS0'''<ol start="4" style="list-style-type: lower-alpha;">| '''PH5'''<li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</li>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| '''266'''| ''<big>'PI10''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'| '''TWI2-SDA</UART3_RX'''| '''27'''big>|}{| '''28'''| '''TWI2class="wikitable" style="background-SCL/UART3_TX'''| '''PI9'''| '''265'''color:#ffffdc;width:800px;"
|-
| <big>'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board'256s GPIO, I2C, SPI, UART and other hardware resources in the Python program'''| '''PI0Also please note that all the following commands are operated under the root user.'''</big>| style} <span id="texthow-to-install-align: left;wiringop-python"|></span>| '''29'''=== How to install wiringOP-Python ===|| '''30'''| '''GND'''| <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>First install dependency packages</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~# '''271sudo apt-get update'''</p>| <p>root@orangepi:~# '''PI15sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| '''268'''| <big>'''PI12Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.'''| '''PWM2'''| '''33'''|| '''34If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''258'''| '''PI2'''| style="text-alignroot@orangepi: left;"|| '''35~# '''|| '''36'''| style="textgit clone -align: left;"|| '''PC12'''| '''76'''|-| '''272'''| '''PI16'''| style="text-alignrecursive https: left;"|| '''37'''|| '''38'''| style="text//github.com/orangepi-align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="textxunlong/wiringOP-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="textPython -align: left;"|| '''PI3'''| '''259b next'''|}
root@orangepi:~/wiringOP-Python# '''git submodule update --init --remote'''|}</ol><ol start="3" style="list-style-type: decimal;"><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''cd wiringOP-Python'''</p><p>root@orangepi:~/wiringOP-Python# ''Multiplexing function in 40pin'python3 generate-bindings.py > bindings.i'''</p><p>root@orangepi:~/wiringOP-Python# '''sudo python3 setup.py install'''</p>| }</li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''Corresponding dtbo configurationq'''key to exit the help information interface.</p></li>{| class="wikitable" style="width:800px;"
|-
| '''40pin - uart2'''| '''piroot@orangepi:~/wiringOP-uart2Python# '''|python3 -| '''40pin - uart3c "import wiringpi; help(wiringpi)"'''| '''pi-uart3'''|-| '''40pin - uart4'''Help on module wiringpi:| '''pi-uart4'''|-| '''40pin - uart5'''NAME| '''ph-uart5'''|}:wiringpi
: # the SWIG interface file instead.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The second parameter 10 represents First use the python3 command to enter the counting time command line mode of the watchdog. If the dog is not fed within this time, the system will restart.</p>> python3</li><li><p>We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line "{| class="wikitable" style="width:800px;keep alive" to indicate that the dog feeding is successful.</p>" |-| <p>orangepiroot@orangepi:~$ # '''sudo watchdog_test 10python3'''</p><p>open success|}</pol><p>options is 33152,identity is sunxiol start="2" style="list-style-type: lower-wdt</palpha;"><pli>put_usr return,if 0,success:0Then import the python module of wiringpi</pli><p>The old reset time is{| class="wikitable" style="width: 16800px;" |-| >>> '''import wiringpi;'''|}</pol><p>return ENOTTY,if ol start="3" style="list-style-1,successtype:0</plower-alpha;"><pli>return ENOTTYFinally,if enter the following command to view the help information of > wiringOP-1,success:0Python. Press the q key to exit the help information > interface.</pli><p>put_user return,if 0,success{| class="wikitable" style="width:0</p>800px;" |-| >>> '''help(wiringpi)''' <p>put_usr return,if 0,successHelp on module wiringpi:0</p><p>keep alive</p><p>keep alive</p><p>keep alive</p></li></ol>NAME
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Hello from Docker!Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big>
<ol style="list-style-type: decimal;">
<li><p>First, please install docker and ensure that docker can run normallyThe following uses pin No. For 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the installation steps high and low levels of docker, please refer to the instructions in the GPIO port.</p><p>[[\l|'''How to Install Docker'''File:zero2w-img171.png]] section.</p></li><li><p>Then you can search The steps for the docker image of Home Assistanttesting directly with commands are as follows:</p><p>orangepi@orangepiol style="list-style-type:~$ '''docker search homeassistant'''</p></lilower-alpha;"><li><p>Then use First set the following command GPIO port to download output mode, where the Docker image first parameter of Home Assistant the '''pinMode''' function is the serial number of the wPi corresponding to your local computer. The image size is about 1GBthe pin, and the download time will be relatively long. Please be patient and wait for second parameter is the download to completeGPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''docker pull homeassistant/homepython3 -assistantc "import wiringpi; \'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''from wiringpi import GPIO; wiringpi...... wiringPiSetup(Omit some output); \'''</p><p>3cc6a1510c9f'''wiringpi.pinMode(<span style="color: Pull complete</p#FF0000"><p>7a4e4d5b979f: Pull complete2, GPIO.OUTPUT</pspan><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb) ; "'''</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p>|}<p>docker.io/homeassistant/home-assistant:latest</p></li><li><p>Then set the GPIO port to output a low level. After setting, you can use the following command a multimeter to view measure the docker image voltage value of Home Assistant you just downloadedthe pin. If it is 0v, it means the low level is set successfully.</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''docker images homeassistant/home-assistant'''</p>800px;" <p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home|-assistant latest bfa0ab9e1cf5 2 months ago '''1.17GB'''</p></li><li><p>At this point you can run the Home Assistant docker container</p>| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''docker run python3 -d c "import wiringpi; \'''</p><p>'''--name homeassistant from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p><p>'''--privileged \'''</p>wiringpi.digitalWrite(2, <p>'''--restartspan style=unless-stopped \'''</p"color:#FF0000"><p>'''-e TZ=Asia/Shanghai \'''GPIO.LOW</pspan><p>'''-v /home/orangepi/home-assistant:/config \)"'''</p><p>'''--network=host \'''</p>|}<p>'''homeassistant/home-assistant:latest'''</p></li><li><p>Then enter【the IP address of the development board: 8123】in set the browser GPIO port to see the Home Assistant interface</p><p>'''It takes output a while for the Home Assistant container to starthigh level. If the interface below does not display normallyAfter setting, please wait you can use a few seconds before refreshing itmultimeter to measure the voltage value of the pin. If the following interface it is not displayed normally after waiting for more than a minute3.3v, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there setting of the high level is a problem with the previous installation and setting processsuccessful.'''</p><div {| class="figurewikitable" style="width:800px;"> [[File:media/image180.png|576x210px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-18.jpg未标题-18]]| </divp><root@orangepi:~/li><li><p>Then enter your wiringOP-Python# '''name, username''' and '''password''' and click '''Create Accountpython3 -c "import wiringpi; \'''</p><div class="figure"p> [[File:media/image181'''from wiringpi import GPIO; wiringpi.png|251x330px|IMG_256]] wiringPiSetup() ;\'''</div></lip><li><p>Then follow the interface prompts to set according to your own preferences'''wiringpi.digitalWrite(2, and then click Next</p><div classspan style="figurecolor:#FF0000"> [[File:media/image182.png|575x297px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-19GPIO.png未标题-19]] HIGH</divspan></li><li><p>Then click Next)"'''</p><div class="figure"> [[File:media/image183.png|576x185px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-24.jpg未标题-24]]}</div></li><li><p>Then click Finish</p><div class="figure"ol> [[File:media/image184.png|577x157px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-20.jpg未标题-20]] </div></li><li><p>The main interface finally displayed by Home Assistant is steps for testing in the command line of python3 are as shown below</p><p>[[Filefollows:media/image185.png|576x264px]]</p></li><li><p>Method to stop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The First use the python3 command to view enter the docker container is as followscommand line mode of python3</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ # '''python3'docker ps ''</p>|}</li><li><p>Then import the python module of wiringpi</p>{| class="wikitable" style="width:800px;" |-a| <p>>>> '''import wiringpi'''</p><p>>>> '''from wiringpi import GPIO'''</p>|}</li><li><p>The command Then set the GPIO port to output mode, where the first parameter of the '''pinMode'''function is the serial number of the wPi corresponding to stop the Home Assistant container pin, and the second parameter is as followsthe GPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>>>> '''wiringpi.wiringPiSetup()'''</p><p>0</p><p>>>> '''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''</p>|}</li><li><p>orangepi@orangepiThen set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:~$ 800px;" |-| <p>>>> '''docker stop homeassistantwiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li><li><p>The command Then set the GPIO port to output a high level. After setting, you can use a multimeter to delete measure the voltage value of the Home Assistant container pin. If it is as follows3.3v, it means the setting of the high level is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>>>> '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p>|}</li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''blink.py''' test program in the examples. The '''blink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~$ /wiringOP-Python/examples# '''docker rm homeassistantls blink.py'''</p><p>'''blink.py'''</lip><p>root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py'''</olp>|}
</li></ol>
<span id="installationpin-viaspi-pythontest-1"></span> === Installation via python 40pin SPI test ===
<ol div style="list-style-typedisplay: decimalflex;"><li><p>First install dependency packages</p><p>orangepi@orangepi:~$ '''sudo apt:{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-get update'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \GPIO NO.'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \GPIO'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdataFunction'''</p><p>| '''If it is debian12, please use the following command:Pin'''</p><p>orangepi@orangepi:~$ '''sudo apt|-get update'''</p><p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ left;"|| '''sudo apt-get install -y python3 python3-dev python3-venv \3.3V'''</p><p>| '''1'''python3|-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \| '''264'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPI8'''</p></li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[\l|'''Python source code compilation and installation methodTWI1-SDA''']] section.</p><p>| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.3'''</p><p>|-| '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.263'''</p><p>| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.PI7'''</p></li><li><p>Then create a Python virtual environment</p><p>| '''Debian Bookworm is python3.11, please remember to replace the corresponding command.TWI1-SCL'''</p><p>orangepi@orangepi:~$ | '''sudo mkdir /srv/homeassistant5'''</p><p>orangepi@orangepi:~$ |-| '''sudo chown orangepi:orangepi /srv/homeassistant269'''</p><p>orangepi@orangepi:~$ | '''cd /srv/homeassistantPI13'''</p><p>orangepi@orangepi:~$ | '''python3.9 -m venv .PWM3/UART4_TX'''</p><p>orangepi@orangepi:~$ | '''source bin/activate7'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p></li>|-| style="text-align: left;"|<li><p>Then install the required Python packages</p><p>(homeassistant) orangepi@orangepi| style="text-align:/srv/homeassistant$ left;"|| '''python3 -m pip install wheelGND'''</p></li><li><p>Then you can install Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''pip3 install homeassistant9'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ |-| '''hass226'''</p></li><li><p>Then enter【| '''development board IP address: 8123PH2'''】 in the browser to see the Home Assistant interface</p><p>| '''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.UART5_TX'''</p><div class="figure">| '''11'''|-[[File:media/image180.png|571x208px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-18.jpg未标题-18]]'''227'''| '''PH3'''| '''UART5_RX'''</div></li></ol>| '''13''' <span id="opencv-installation|-method"></span>== OpenCV installation method ==| '''261'''| '''PI5'''<span id| '''TWI0_SCL/UART2_TX'''| '''15'''|-| style="usetext-apt-to-install-opencvalign: left;"></span>|=== Use apt to install OpenCV === <ol | style="list-styletext-typealign: decimalleft;">|<li><p>The installation command is as follows</p>| '''3.3V'''<p>orangepi@orangepi:~$ | '''17'''sudo apt|-get update| '''</pspan style="color:#FF0000">231<p/span>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv| '''</pspan style="color:#FF0000">PH7</lispan>'''| '''<li><pspan style="color:#FF0000">Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.SPI1_MOSI</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:19</p><pspan>orangepi@orangepi:~$ '''python3 |-c "import cv2; print(cv2.__version__)"| '''</pspan style="color:#FF0000">232<p/span>'''4.5.4| '''</pspan style="color:#FF0000">PH8</lispan>'''| '''<li><pspan style="color:#FF0000">The version of OpenCV in Ubuntu20.04 is as follows:SPI1_MISO</p><pspan>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"| '''</pspan style="color:#FF0000">21<p/span>'''4.2.0|-| '''</pspan style="color:#FF0000">230</li><li><p>The version of OpenCV in Debian11 is as follows:</p><pspan>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"| '''</pspan style="color:#FF0000">PH6<p/span>'''4.5.1| '''</pspan style="color:#FF0000">SPI1_CLK</lispan><li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"| '''</pspan style="color:#FF0000">23<p/span>'''4.6.0'''</p></li></ol></li></ol> <span id|-| style="settext-up-the-chinese-environment-and-install-the-chinese-input-methodalign: left;"></span>|| style== Set up the Chinese environment and install the Chinese input method =="text-align: left;"|| '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.GND''' <span id="debian-system-installation| '''25'''|-method"></span>=== Debian system installation method ===| '''266'''| '''PI10'''<ol style="list| '''TWI2-style-type: decimal;">SDA/UART3_RX'''<li><p>First set the default | '''locale27''' to Chinese</p><ol style="list|-style-type: lower-alpha;"><li><p>Enter the following command to start configuring | '''locale256'''</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure localesPI0'''</p></li><li><p>Then select | style="text-align: left;"|| '''zh_CN.UTF-8 UTF-829''' in the pop|-up interface (use > the up and down keys on the keyboard to move up and down, use > the space bar to select, and finally use the Tab key to move > the cursor to | '''<OK>271''', and then return Car can be used)</p><p>[[File| '''PI15'''| style="text-align:media/image186.pngleft;"|575x296px]]</p></li><li><p>Then set the default | '''locale31''' to |-| '''zh_CN.UTF-8268'''</p><p>[[File:media/image187.png|575x160px]]</p></li><li><p>After exiting the interface, the '''localePI12''' setting will begin. > The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure localesPWM2'''</p><p>Generating locales (this might take a while)...</p>| '''33'''<p>en_US.UTF|-8... done</p><p>zh_CN.UTF-8... done</p><p>Generation complete.</p></li></ol></li><li><p>Then open | '''258'Input Method''| '''PI2'''</p><p>[[File| style="text-align:media/image188.pngleft;"|575x361px]]</p></li><li><p>Then select | '''OK35'''</p><p>[[File:media/image189.png|295x212px]]</p></li><li><p>Then select -| '''Yes272'''</p><p>[[File:media/image190.png|303x192px]]</p></li>'''PI16'''| style="text-align: left;"|<li><p>Then select | '''fcitx37'''</p><p>[[File:media/image191.png|307x220px]]</p></li>-| style="text-align: left;"|| style="text-align: left;"|<li><p>Then select | '''OKGND'''</p><p>[[File:media/image192.png|305x216px]]</p></li><li><p>'''Then restart the Linux system to make the configuration take effect.39'''</p></li><li><p>Then open |}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Fcitx configurationPin'''</p><p>[[File:media/image193.png|575x376px]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:media/image194.png|280x187px]]</p></li><li><p>Then search '''Google PinyinFunction'''| '' and click 'GPIO''OK'| '''GPIO NO.'''</p><div class="figure"> [[File:media/image195.png|291x196px|C:\Users\orangepi\Desktop\用户手册插图\Pi5 Plus\未标题-10.jpg未标题-10]]| '''2'''</div></li><li><p>Then put | '''Google Pinyin5V''' on top</p><p>[[File| style="text-align:media/image196.pngleft;"|| style="text-align: left;"|299x202px]]</p><p>[[File:media/image197.png|300x202px]]</p></li>-<li><p>Then open the | '''Geany4''' editor to test the Chinese input method</p><p>[[File| '''5V'''| style="text-align:media/image198.pngleft;"|349x212px]]</p></li><li><p>The Chinese input method test is as follows</p>| style="text-align: left;"|<p>[[File:media/image199.png|575x325px]]</p></li>-<li><p>You can switch between Chinese and English input methods through the | '''6'Ctrl+Space''| ' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in ''GND'/etc/default/locale''' to '''zh_CN.UTF| style="text-8'''</p><p>orangepi@orangepialign:~$ left;"|| style="text-align: left;"||-| '''sudo vim /etc/default/locale8'''</p><p># File generated by update-locale</p>| '''UART0_TX'''<p>LC_MESSAGES=| '''zh_CN.UTF-8PH0'''</p><p>LANG=| '''zh_CN.UTF-8224'''</p><p>LANGUAGE=|-| '''10'''| '''zh_CN.UTF-8UART0_RX'''</p></li><li><p>Then | '''restart the systemPH1''' and you will see that the system is displayed in Chinese.</p><p>[[File:media/image200.png|576x356px]]</p></li></ol>'''225'''|-| '''12'''<span id| style="installationtext-method-of-ubuntu-20.04-systemalign: left;"></span>|=== Installation method of Ubuntu 20.04 system ===| '''PI1'''| '''257'''<ol style="list|-style-type: decimal;"><li><p>First open | '''Language Support14'''</p><p>[[File:media/image201.png|575x351px]]</p></li>'''GND'''| style="text-align: left;"|| style="text-align: left;"||-<li><p>Then find the | '''Chinese (China)16''' option</p><p>[[File:media/image202.png|318x311px]]<'''PWM4/p></li>UART4_RX'''<li><p>Then please use the left button of the mouse to select | '''Chinese (China)PI14'''| '''270''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:media/image203.png|324x320px]]</p></li></ol>-| '''Note that this step is not easy to drag, please be patient and try it a few times.18''' <ol start="4" | style="listtext-style-type: decimalalign: left;">|<li><p>Then select | '''Apply System-WidePH4''' to apply the Chinese settings to the entire system</p><p>[[File:media/image204.png|321x316px]]</p></li><li><p>Then set the '''Keyboard input method system228''' system to '|-| ''fcitx'20'''</p><p>[[File:media/image205.png|327x320px]]</p></li><li><p>'''Then restart the Linux system to make the configuration take effectGND'''</p></li><li><p>After re| style="text-align: left;"|| style="text-align: left;"||-entering the system, please select | '''Do not ask me again22''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:media| '''TWI0_SDA/image206.pngUART2_RX'''|303x247px]]</p></li>'''PI6'''<li><p>Then you can see that the desktop is displayed in Chinese</p>| '''262'''|-| '''<p>[[Filespan style="color:media/image207.png|575x383px]]</p#FF0000">24</li><li><pspan>Then we can open '''Geany| ''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[Filespan style="color:media/image208.png|576x292px]]</p#FF0000">SPI1_CS0</lispan>'''| '''<lispan style="color:#FF0000">PH5<p/span>After opening '''Geany| ''', the English input method is still the default. We can switch to the Chinese input method through the <span style="color:#FF0000">229</span>'''Ctrl+Space|-| ''' shortcut key, and then we can input Chinese.</pspan style="color:#FF0000">26<p/span>[[File:media/image209.png'''|575x308px]]</p></li></ol> '''<span idstyle="installation-method-of-ubuntu-22.04-systemcolor:#FF0000">SPI1_CS1</span>'''=== Installation method of Ubuntu 22.04 system === | '''<ol span style="list-style-typecolor: decimal;#FF0000">PH9<li><p/span>First open '''Language Support| '''</p><p>[[Filespan style="color:media/image201.png|575x351px]]</p#FF0000">233</lispan>'''|-<li><p>Then find the | '''Chinese (China)28''' option</p><p>[[File:media/image210.png|249x242px]]<'''TWI2-SCL/p></li>UART3_TX'''<li><p>Then please use the left button of the mouse to select | '''Chinese (China)PI9''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:media/image211.png|267x262px]]</p></li></ol>'''265'''|-| '''Note that this step is not easy to drag, please be patient and try it a few times.30'''| '''GND'''<ol start| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">||-<li><p>Then select | '''Apply System-Wide32''' to apply the Chinese settings to the entire system</p><p>[[File:media/image212.png|287x282px]]</p></li><li><p>'''Then restart the Linux system to make the configuration take effectPWM1'''| '''PI11'''</p></li><li><p>After re-entering the system, please select | '''Do not ask me again267''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p><p>[[File:media/image206.png|303x247px]]</p></li>-<li><p>Then you can see that the desktop is displayed in Chinese</p>| '''34'''<p>[[File:media/image207.png|575x383px]]</p></li>'''GND'''<li><p>Then open the Fcitx5 configuration program</p>| style="text-align: left;"|<p>[[File| style="text-align:media/image213.pngleft;"|575x349px]]</p></li><li><p>Then choose to use Pinyin input method</p>|-| '''36'''<div class| style="figuretext-align: left;">|| '''PC12'''| '''76'''[[File:media/image214.png|338x267px|C:\Users\orangepi\Desktop\用户手册插图\Pi5 Plus\未标题-11.jpg未标题-11]]| '''38'''</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File| style="text-align:media/image215.pngleft;"|366x290px]]</p></li><li><p>Then we can open | '''GeanyPI4''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:media/image208.png|576x292px]]</p></li><li><p>After opening '''Geany260''', the English input method is still the default. We can switch to the Chinese input method through the |-| '''Ctrl+Space40''' shortcut key, and then we can enter Chinese.</p><p>[[File| style="text-align:media/image216.pngleft;"|434x308px]]</p></li></ol>| '''PI3'''<span id="how-to-remotely-log-in-to-the-linux-system-desktop"></span>== How to remotely log in to the Linux system desktop ==| '''259'''|}<span id="remote-login-using-nomachine"></span>=== Remote login using NoMachine === '''Please ensure that the Ubuntu or Debian system installed on the development board is a desktop version of the system. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:''' '''https://knowledgebase.nomachine.com/DT10R00166''' '''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine’s official documentation.''' '''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.''' <ol style="list-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux '''arm64''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style-type: lower-alpha;"><li>Since H618 is an ARMv8 architecture SOC and the system we use is > Ubuntu or Debian, we need to download the '''NoMachine for ARM > ARMv8 DEB''' installation package. The download link is as > follows:</li></ol></li></ol> '''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.''' [https://www.nomachine.com/download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/?id=118&distro=ARM'''] [[File:media/image217.png|575x227px]] <ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation > package from the official tool.</p><p>[[File:media/image218.png|66x102px]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:media/image219.png|271x43px]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:media/image220.png|180x109px]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the > Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux > system of the development board</p><p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p></li></ol> <!-- --><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li></ol> '''Note that this download link may change.''' '''https://downloads.nomachine.com/download/?id=9''' [[File:media/image221.png|575x163px]] <ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:media/image222.png|76x66px]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:media/image223.png|321x92px]]</p></li><li><p>Then click '''OK'''</p><p>[[File:media/image224.png|318x217px]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:media/image225.png|303x204px]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:media/image226.png|411x246px]]</p></li></oldiv>
<span idol start="remote2" style="list-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-loginstyle-usingtype: lower-vncalpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</spanp>{| class="wikitable" style== Remote login using VNC ==="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 in the figure below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''dtbo configuration'''| '''Before operating, please make sure that the Windwos computer illustrate'''|-| '''spi1-cs0-cs1-spidev'''| '''Open cs0 and the development board are in cs1 of spi1 at the same LAN, and that you can log in to the Ubuntu or Debian system time'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 of the development board through ssh normally.spi1'''|-| '''spi1-cs1-spidev'There are many problems with VNC testing in Ubuntu20.04, please do not use this method.''| '''Only open cs1 of spi1'''|}</ol><ol start="5" style="list-style-type: decimallower-alpha;"><li><p>First run the Then select '''set_vnc.sh''' script to set up vnc, <Save>'''remember to add sudo permission'''ssave</p><p>orangepi@orangepi[[File:~$ '''sudo set_vnczero2w-img83.sh'''png]]</p><p/li>You will require a password to access your desktops.</pli><p>Password: Then select '''#Set the vnc password here, 8 characters<Back>'''</p><p>Verify[[File: '''#Set the vnc password here, 8 characters'''zero2w-img84.png]]</p></li><li><p>Would you like to enter a view-only password (y/n)? Then select '''n<Reboot>'''to restart the system to make the configuration take effect.</p><p>xauth[[File: file /root/zero2w-img85.Xauthority does not existpng]]</p><p/li>New 'X' desktop is orangepi:1</pol><p/li>Creating default startup script /root/.vnc/xstartup</pol><p!-- -->Starting applications specified in /root/.vnc/xstartup</pol start="3" style="list-style-type: decimal;"><li><p>Log file Then check whether there is /root/a '''spidev1.x''' device node in the Linux system.vnc/orangepi:1If it exists, it means that the SPI1 configuration has taken effect.log</p>{| class="wikitable" style="width:800px;" |-| <p>Killing Xtightvnc process ID 3047<orangepi@orangepi:~$ '''ls /dev/p><p>New spidev1*''X' desktop is orangepi:1</p><p>Starting applications specified in /rootdev/spidev1.vnc0 /xstartupdev/spidev1.1</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>Log file is /root/'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.vnc'''</orangepi:1.logp></pbig>|}</li><li><p>The steps to Then you can use MobaXterm software the '''spidev_test.py''' program in examples to connect test the SPI loopback function. The '''spidev_test.py''' program needs to specify the development board Linux system desktop are as followsfollowing two parameters:</p>
<ol style="list-style-type: lower-alpha;">
<li>First click Session, then select VNC, then fill in <p>'''--channel''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the IP > address and port number of the development board, and finally click > OK to confirm.SPI</p></li></ol></li><li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/olwiringOP-Python# '''cd examples'''</p>
RX | FF FF FF FF FF FF '''<span idstyle="ros-installation-methodcolor:#FF0000">FF FF FF FF FF FF</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….||}</li></ol><ol start="6" style= ROS installation method "list-style-type: decimal;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
TX | FF FF FF FF FF FF '''https<span style="color:#FF0000">40 00 00 00 00 95<//wiki.ros.org/Distributionsspan>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…|
RX | FF FF FF FF FF FF '''<ol start="2" span style="list-style-typecolor: decimal;#FF0000">40 00 00 00 00 95<li><p/span>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p><p>[http://wikiFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |..ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p></li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''Ubuntu20@.04 desktop system'''.</p><p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:media/image247.png…|312x176px]]</p></li><li><p>Then use the script below to install ros1</p>|}<p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</pli></liol><lispan id="pin-i2c-test-1"><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li></olspan>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ First run '''python3orangepi-config'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key Ordinary users remember to exit pythonadd 's interactive mode.''sudo'</p></li><li><p>Write the '''hello_worldpermissions.py''' program in Python language</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''vim hello_world.py'''</p>800px;" <p>print('Hello World!')</p></li>|-<li><p>The result of running '''hello_world.py''' is as follows</p>| <p>orangepi@orangepi:~$ '''python3 hello_world.pysudo orangepi-config'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.Then select '''System'''</p><ol style="list-style-typep>[[File: lowerzero2w-alpha;"img80.png]]</p></li><li><p>You can use the following command to install openjdk. The latest > version in Debian Bullseye is openjdk-17Then select '''Hardware'''</p><p>orangepi@orangepi[[File:~$ '''sudo apt install zero2w-y openjdk-17-jdk'''img81.png]]</p></li><li><p>After installationThen use the keyboard's arrow keys to locate the position shown in the picture below, you can check and then use the '''space''' to select the corresponding i2c configuration in the Java versionpicture below.</p><p/li>orangepi@orangepi {| class="wikitable" style="width:~$ 800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''java 40pin -i2c0'''| '''pi-versioni2c0'''</p></li><li><p>Write the Java version of |-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''hello_world.java40pin - i2c2'''</p><p>orangepi@orangepi:~$ | '''vim hello_world.javapi-i2c2'''|} [[File:zero2w-img173.png]]</pol><ol start="5" style="list-style-type: lower-alpha;"><li><p>public Then select <span class hello_world="mark"><Save></pspan><p>{to save</p><p>public static void main(String[[File:zero2w-img83.png]] args)</p></li><pli>{</p>Then select <pspan class="mark">System.out.println("lt;Hello World!Back")gt;</p><pspan>}</p><p>}[[File:zero2w-img84.png]]</p></li><li><p>Then compile and run '''hello_world.java'''select </pspan class="mark"><Reboot><p/span>orangepi@orangepi:~$ '''javac hello_worldto restart the system to make the configuration take effect.java'''</p><p>orangepi@orangepi[[File:~$ '''java hello_world'''</p><p>Hello World!zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p>
<p>'''/dev/i2c-*'''</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'''</big>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p>
<p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>
<ol style="list-style-type: lower-alpha;">
<li><p>The version '''First run the following command to check the corresponding relationship of a.gcc is as followsi2c'''</p><p>orangepi@orangepiorangepizero2w:~$ '''gcc ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-version[0-9]"'''</p><p>gcc (Debian 12/sys/devices/platform/soc/5002000.2.0i2c/i2c-14) 12.2.0:</p><p>Copyright (C) 2022 Free Software Foundation, Inc/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>This is free software; see the source for copying conditions/sys/devices/platform/soc/5002800. There is NOi2c/i2c-4:</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</lip><lip>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p>Write the '''hello_world.c''' program in C language</pli> <li><p>orangepi@orangepi:~$ '''vim hello_world.cIn the above output'''</p><pol style="list-style-type: none;">#include <stdio.h></pli><p>int main(voida)5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>{b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>printf("Hello World!\n"c);5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p><p/li>return 0;</pol><p/li></ol>|}</pli></liol><ol start="4" style="list-style-type: decimal;"><li><p>Then compile and run '''hello_world.c'''start testing i2c, first install i2c-tools</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc sudo apt-o hello_world hello_world.cget update'''</p><p>orangepi@orangepi:~$ '''./hello_worldsudo''' '''apt-get install -y i2c-tools'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bookworm has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version Then connect an i2c device to the i2c pin of Python is the 40pin connector. Here we take the DS1307 RTC module as followsan example.</p><p>orangepi@orangepi[[File:~$ '''python3'''</p><p>Python 3zero2w-img178.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0png]] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write Then use the '''hello_world.pyi2cdetect -y x''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_worldcommand.py'''</p><p>print('Hello World!')</p></li><li><p>The result If the address of running '''hello_world.py''' the connected i2c device can be detected, it means that the i2c device is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_worldconnected correctly.py'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest > version in Debian Bookworm is openjdk|-17</p>| <pbig>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java Note that x in the i2cdetect --version'''</p></li><li><p>Write y x command needs to be replaced with the Java version serial number of '''hello_worldthe device node corresponding to the i2c bus.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</pbig><p>public class hello_world</p>|}<p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("Hello World!");</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi[File:~$ '''javac hello_worldzero2w-img179.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol>png]]
</li></ol>
<span idol start="ubuntu-focal-system7"></span>=== Ubuntu Focal system === <ol style="list-style-type: decimal;"><li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which Then you can directly compile C language programs in run the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 9ds1307.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.cpy''' test program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.cexamples'''to read the RTC time</p><p>{| class="wikitable" style="background-color:#include <ffffdc;stdio.h>width:800px;</p>" <p>int main(void)</p>|-<p>{</p>| <pbig>printf("Hello World!\n");</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc Note that the x in i2c-o hello_world hello_worldx in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</pbig><p>Hello World!</p></li></ol>|}</li><li><p>Ubuntu Focal has Python3 installed by default</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python3 is as follows</p>|-| <p>orangepiroot@orangepi:~$ '''python3'''</p><p>wiringOP-Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p># '''Use the Ctrl+D shortcut key to exit python's interactive mode.cd examples'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepiroot@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')<wiringOP-Python/p></li><li><p>The result of running examples# '''hello_worldpython3 ds1307.py--device \''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!<"/p><dev/li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="listi2c-style-type: lower-alphax""><li><p>You can use the following command to install openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java Thu 2022-06-version'''16 04:35:46</p><p>openjdk 17.0.2 Thu 2022-0106-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.16 04):35:47</p><p>OpenJDK 64Thu 2022-Bit Server VM (build 17.0.2+806-Ubuntu-120.16 04, mixed mode, sharing)</p></li><li><p>Write the Java version of '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''35:48</p><p>public class hello_world^C</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("Hello World!");exit</p><p>|}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol>
</li></ol>
<span id="ubuntupin-jammyuart-systemtest-1"></span> === Ubuntu Jammy system 40pin UART test ===
<span iddiv style="method-of-uploading-files-to-the-development-board-linux-systemdisplay: flex;"></span>::{| class="wikitable" style= Method of uploading files to the development board Linux system == <span id="method"width:390px;margin-toright: 20px;text-uploadalign: center;"|-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC ===| '''GPIO NO.'''| '''GPIO'''<span id="how-to-upload| '''Function'''| '''Pin'''|-files| style="text-using-scp-commandalign: left;"></span>|==== How to upload files using scp command ==== <ol style| style="listtext-style-typealign: decimalleft;">|<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC| '''3. The specific command is as follows</p>3V'''<ol style="list-style-type: lower-alpha;"><li><p>| '''file_path: 1'''Needs to be replaced with the path of the file to > be uploaded</p></li><li><p>|-| '''264'orangepi: ''| 'This is the user name of the development board's > Linux system. It can also be replaced with something else, > such as root.</p></li><li><p>'PI8''192.168.xx.xx:'| '''TWI1-SDA''' This is the IP address of the development > board. Please modify it according to the actual situation.</p></li><li><p>| '''/home/orangepi:3''' The path in the development board Linux > system can also be modified to other paths.</p><p>test@test:~$ |-| '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/263'''</p></li></ol></li>| '''PI7'''<li><p>If you want to upload a folder, you need to add the -r parameter</p><p>test@test:~$ | '''scp TWI1-r dir_path orangepi@192.168.xx.xx:/home/orangepi/SCL'''</p></li><li><p>There are more usages of scp, please use the following command to view the man manual</p></li></ol> test@test:~$ | '''man scp5'''|-<span id="how-to-upload-files-using-filezilla"></span>| '''269'''==== How to upload files using filezilla ====| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-<ol | style="listtext-style-typealign: decimalleft;">|<li><p>First install filezilla in Ubuntu PC</p>| style="text-align: left;"|<p>test@test:~$ | '''GND'sudo apt install -y filezilla''| '''9'''</p></li><li><p>Then use the following command to open filezilla</p>|-<p>test@test:~$ | '''filezilla226'''</p></li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</p><div class="figure">| '''PH2''' [[File:media/image255.png|576x453px'''UART5_TX'''| '''11'''|截图 2022-12-03 19-04-40]]| '''227'''</div></li>| '''PH3'''| '''UART5_RX'''<li><p>The method of connecting the development board is as shown in the figure below</p></li></ol>| '''13'''|-<div class="figure"> [[File:media/image256.png|575x128px|图片565]] </div><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password261'''| '' and click 'PI5''OK'''</p><p>[[File:media/image257.png|249x181px]]</p></li><li><p>Then select '''Always trust this hostTWI0_SCL/UART2_TX''' and click | '''OK15'''</p></li></ol> <div class|-| style="figuretext-align: left;">| [[File:media/image258.png|278x150px|IMG_256]] </div><ol start="7" style="list-style-typestyle="text-align: decimalleft;">|<li>After the connection is successful, you can see the directory structure of the development board| '''s Linux file system on the right side of the filezilla software3.</li></ol>3V'''| '''17'''<div class="figure">|-[[File:media/image259.png|533x330px|IMG_256]]'''231'''| '''PH7'''</div>| '''SPI1_MOSI'''<ol start="8" style="list| '''19'''|-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol>| '''232'''| '''PH8'''<div class="figure"> [[File:media/image260.png|529x414px'''SPI1_MISO'''|IMG_256]]'''21'''|-</div>| '''230'''<ol start| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="9text-align: left;" || style="listtext-style-typealign: decimalleft;">|| '''GND'''<li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li>| '''25'''<li><p>The method of uploading a folder is the same as the method of uploading a file, so I won’t go into details here.</p></li></ol>|- <span id="method| '''266'''| '''PI10'''| '''TWI2-to-upload-files-from-windows-pc-to-development-board-linux-system"></span>SDA/UART3_RX'''=== Method to upload files from Windows PC to development board Linux system ===| '''27'''|-<span id=| '''256'''| '''PI0'''| style="howtext-to-upload-files-using-filezilla-1align: left;"></span>==== How to upload files using filezilla ==== # First download the installation file of the Windows version of the filezilla software. The download link is as follows [https://filezilla-project.org/download.php?type=client || '''29'''https://filezilla|-project.org/download.php?type=client| '''271'''][[File:media/image261.png|472x171px'''PI15'''|Cstyle="text-align:\Users\orangepi\Desktop\用户手册插图\Pi5 Plus\未标题-15.jpg未标题-15]] <div class=left;"figure">|| '''31'''[[File:media/image262.png|384x276px-|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-21.jpg未标题-21]]'''268'''| '''PI12'''</div>| '''PWM2'''<ol start="2" style="list-style-type: decimal;"><li><p>The downloaded installation package is as shown below, then double-click to install it directly</p><p>| ''''FileZilla_Server_1.5.1_win64-setup.exe33'''</p></li></ol>|-During the installation process, please select | '''Decline258''' on the following installation interface, and then select | '''Next>PI2''' <div class| style="figure"> [[Filetext-align:media/image263.pngleft;"|355x279px|IMG_256]]'''35'''|-</div>| '''272'''<ol start="3" | '''PI16'''| style="listtext-style-typealign: decimalleft;">|<li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li></ol>| '''37'''|-<div class| style="figuretext-align: left;">| [[File:media/image264.png|451x357px|IMG_256]]style="text-align: left;"|| '''GND'''</div>| '''39'''|}<ol start{| class="4wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li>The method of connecting the development board is as shown in the figure below:</li></ol>|-| '''Pin'''<div class="figure">| '''Function'''| '''GPIO'''[[File:media/image256| '''GPIO NO.png'''|575x128px-|图片565]] </div><ol start="5" style="list-style-type: decimal;"><li>Then choose to '''save the password2''' and click | '''OK5V'''</li></ol> <div class| style="figuretext-align: left;">| [[File| style="text-align:media/image265.png|207x146px|IMG_256]]left;"| </div><ol start="6" style="list|-style-type: decimal;"><li>Then select | '''Always trust this host4''' and click | '''OK5V'''</li></ol> <div class| style="figuretext-align: left;">| [[File:media/image266.png|221x109px|IMG_256]] </div><ol start="7" style="list-style-typestyle="text-align: decimalleft;">||-<li>After the connection is successful, you can see the directory structure of the development board| '''6'''s Linux file system on the right side of the filezilla software.</li></ol>| '''GND'''<div class| style="figuretext-align: left;">|[[File:media/image267.png|446x329px|图片3]] </div><ol start="8" style="listtext-style-typealign: decimalleft;">|<li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right|-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol>| '''8'''<div class="figure"> [[File:media/image268.png|461x340px|IMG_256]]'''UART0_TX'''| '''PH0'''</div>| '''224'''|-<ol start="9" style="list-style-type: decimal;">| '''10'''<li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li>| '''UART0_RX'''<li><p>The method of uploading a folder is the same as the method of uploading a file, so I won’t go into details here.</p></li></ol>| '''PH1'''| '''225'''<span id|-| '''12'''| style="instructionstext-for-using-the-logo-on-and-off-the-machine"></span>align: left;"|== Instructions for using the logo on and off the machine ==| '''PI1'''| '''257'''<ol |-| '''14'''| '''GND'''| style="list-styletext-typealign: decimalleft;">|<li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li>| style="text-align: left;"||-<li><p>Set the | '''bootlogo16''' variable to | '''falsePWM4/UART4_RX''' in | '''/boot/orangepiEnv.txtPI14''' to turn off the switch logo.</p><p>orangepi@orangepi:~$ | '''sudo vim /boot/orangepiEnv.txt270'''</p><p>verbosity=1</p>|-<p>| '''bootlogo=false18'''</p></li><li><p>Set the | style="text-align: left;"|| '''bootlogoPH4''' variable to | '''true228''' in |-| '''/boot/orangepiEnv.txt20''' to enable the power on/off logo.</p><p>orangepi@orangepi:~$ | '''sudo vim /boot/orangepiEnv.txtGND'''</p><p>verbosity| style=1</p>"text-align: left;"|| style="text-align: left;"||-<p>| '''bootlogo=true22'''<| '''TWI0_SDA/p></li>UART2_RX'''<li><p>The location of the boot logo picture in the Linux system is</p><p>| '''/usr/share/plymouth/themes/orangepi/watermark.pngPI6'''</p></li><li><p>After replacing the boot logo image, you need to run the following command to take effect</p><p>orangepi@orangepi:~$ | '''262'''sudo update|-initramfs -u| '''24'''</p></li></ol>| '''SPI1_CS0'''<span id="how-to-turn-on-the-power-button-in-linux5.4"></span>| '''PH5'''== How to turn on the power button in Linux5.4 ==| '''229'''|-There is no power on/off button on the main board of the development board. We can expand it through a 24pin expansion board. The location of the power on/off button on the expansion board is as follows:| '''26'''| '''SPI1_CS1'''[[File:media/image269.png|190x98px]]'''PH9''' The power on/off button of the Linux 6.1 image is turned on by default, but the power on/off button of the Linux 5.4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows: <ol style="list-style-type: decimal;"><li><p>First run | '''233'orangepi-config'''. Ordinary users remember to add |-| '''sudo28''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepiTWI2-configSCL/UART3_TX'''</p></li><li><p>Then select | '''SystemPI9'''| '''265'''</p><p>[[File:media/image80.png|402x199px]]</p></li>-<li><p>Then select | '''Hardware30'''</p><p>[[File:media/image81.png|393x202px]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''spaceGND''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:media/image270.png|399x76px]]</p></li>style="text-align: left;"|<li><p>Then select '''<| style="text-align: left;Save>''' to save</p>"|<p>[[File:media/image83.png|397x92px]]</p></li>-<li><p>Then select | '''<Back>32'''</p><p>[[File:media/image84.png|395x91px]]</p></li><li><p>Then select | '''<Reboot>PWM1''' to restart the system to make the configuration take effect.</p><p>[[File:media/image85.png|298x149px]]</p></li></ol>'''PI11'''| '''267'''<span id="how|-to-shut-down-and-restart-the-development-board"></span>| '''34'''| '''GND'''| style== How to shut down and restart the development board =="text-align: left;"| <ol | style="list-styletext-typealign: decimalleft;">||-<li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the | '''poweroff36''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p><p>orangepi@orangepi| style="text-align:~$ left;"|| '''sudo poweroffPC12'''</p><p>| '''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.76'''</p></li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p>|-<p>[[File:media/image269.png|190x98px]]</p><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to the method of opening the power button in Linux5.4.38'''</p></li><li><p>Use the | style="text-align: left;"|| '''rebootPI4''' command to restart the Linux system in the development board</p><p>orangepi@orangepi:~$ | '''sudo'260'' '|-| '''reboot40'''</p></li></ol> <span id| style="linuxtext-sdkorangepi-build-usage-instructionsalign: left;"></span>| = | '''Linux SDK——orangepi-build usage instructionsPI3''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, | '''orangepi-build259''', only supports running on X64 computers with '''Ubuntu 22.04''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''22.04''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. test@test:~$ '''lsb_release -a''' No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''22.04''' Codename: '''jammy''' If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox''' or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is: [https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso'''] After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows:|}</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:: </p>
<ol style="list-style-type: lower-alpha;">
<li>For <p>First run '''orangepi-config'''. Ordinary users remember to add '''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 in the method of replacing Tsinghua Sourcepicture below, please refer and then use the '''space''' to select the instructions on this pageserial port you want to open.</lip></olli>
[[File:zero2w-img175.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''注意, linux5.4系统为/dev/ttyASx.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p>|}</li><li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to testthe loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 testcommand'''</p><p>orangepi@orangepi:~$ '''sudo vim /etcgpio serial /aptdev/sourcesttyASx # linux-5.list4 test command'''</p>
<ol startspan id="5" style="listpython-stylerelated-type: lower-alpha;instructions"><li>'''In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.'''</li></olspan>
<span id="downloadhow-orangepito-buildcompile-fromand-githubinstall-python-source-code"></span>=== Download orangepi-build from github How to compile and install Python source code ===
|-
| <p>orangepi@orangepi:~$ '''branchmake -j4'''</p>| <p>orangepi@orangepi:~$ '''u-boot Versionsudo make altinstall'''</p>| '''linux Kernel }</li><li><p>After installation, you can use the following command to check the version'''number of the Python you just installed.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''currentpython3.9 --version'''</p>| <p>'''u-boot v2018Python 3.9.0510'''</p>|}</li><li><p>Then update pip</p>{| '''linux5.4'''class="wikitable" style="width:800px;"
|-
| '''next'''| <p>orangepi@orangepi:~$ '''u/usr/local/bin/python3.9 -m pip install --boot v2021.07'''| '''linux6.1upgrade pip'''</p>
|}
</li></ol>
<ol style="list-style-type: decimal;">
<li><p>First install '''python3-pip'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p>
|}
</li>
<li><p>How to permanently change the pip source under Linux</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First create a new '''build~/.shpip'''directory, then add the '''pip.conf''' configuration file, and set the pip source in it to Tsinghua source.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: Compile startup script~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat <<EOF > ~/.pip/lipip.conf'''</p><lip>'''[global]'''</p><p>'''externaltimeout = 6000'''</p><p>'''index-url = https: Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc//pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-host = pypi.tuna.tsinghua.edu.cn'''</lip><li><p>'''LICENSEEOF''': GPL 2 license file</p>|}</li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol></li><li><p>How to temporarily change the pip source under Linux, where '''README.md<packagename>'''needs to be replaced with a specific package name</p>{| class="wikitable" style="width: orangepi800px;" |-build documentation| </p>orangepi@orangepi:~$ '''pip3 install <packagename> -i \'''</lip><li><p>'''scriptshttps://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn''': Common script for compiling linux images</p>|}</li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''gcc-arm-11Note: You need to log out and log in again to the system to take effect.2-2022You can also restart the system.02-x86_64'''</big>|} <span id="how-aarch64to-noneinstall-linuxhome-gnu'''assistant"></span>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''gcc-arm-11Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems.2-2022For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.02-x86_64-aarch64-none-linux-gnu'''</big>|}
<ol style="list-style-type: lowerdecimal;"><li><p>First, please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[Orange Pi Zero 2W#How to install Docker|'''How to Install Docker''']] section.</p></li><li><p>Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-alpha| <p>orangepi@orangepi:~$ '''docker search homeassistant'''</p>|}</li><li><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p>{| class="wikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p>|}</li><li>v2018<p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''<span style="color:#FF0000">1.0517GB</span>'''</p>|}</li><li><p>At this point you can run the Home Assistant docker container</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker run -d \'''</p>:<p>'''--name homeassistant \'''</p>:<p>'''--privileged \'''</p>:<p>'''--restart=unless-stopped \'''</p>:<p>'''-e TZ=Asia/Shanghai \'''</p>:<p>'''-v /home/orangepi/home-assistant:/config \'''</p>:<p>'''--network=host \'''</p>:<p>'''homeassistant/home-assistant:latest'''</p>|}</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.'''</p></big>|}<div class="figure">
<ol start="2" style="list-style-type: lower-alpha;"/div></li><li>v2021.07<p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</lip></oldiv class="figure">
<span id="orangepi-build-complete-directory-structure-description"/div></li><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</spanp><div class=== orangepi"figure"> [[File:zero2w-build complete directory structure description ===img182.png]]
<ol style="list-style-type: decimal;"/div></li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse.</p><ol style="list-style-type: lower-alpha;"><li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched toThen click Next</p><ol stylediv class="list-style-type: lower-alpha;figure"><li>Linux5.4</li></ol></li></ol></li></ol>
<ol start="2" style="list-style-type: lower-alpha;"/div></li><li>Linux6.1<p>Then click Finish</lip></oldiv class="figure">
<ol start="2" style="list-style-type: lower-alpha;"/div></li><li><p>The git warehouse where the u-boot source code is stored main interface finally displayed by Home Assistant is as followsshown below</p><p>[[File:zero2w-img185. Please note that the branch of the u-boot-orangepi warehouse is switched png]]</p></li><li><p>Method tostop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li>v2018.05<p>The command to view the docker container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker ps -a'''</p>|}</li><li><p>The command to stop the Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker stop homeassistant'''</p>|}</li><li><p>The command to delete the Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker rm homeassistant'''</p>|}</li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:First install dependency packages</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''build.shsudo apt-get update''': Compile startup script</p></li><li><p>orangepi@orangepi:~$ '''externalsudo apt-get install -y python3 python3-dev python3-venv \''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''kernelpython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \''': Store the source code of the linux kernel</p></li><li><p>'''LICENSElibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata''': GPL 2 license file</p></li>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>'''README.mdIf it is debian12, please use the following command:''': orangepi-build documentation</p></libig><li><p>orangepi@orangepi:~$ '''outputsudo apt-get update''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>orangepi@orangepi:~$ '''scriptssudo apt-get install -y python3 python3-dev python3-venv \''': Common script for compiling linux images</p></li><li><p>'''toolchainspython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \''': Store cross-compilation tool chain</p></li><li><p>'''ulibopenjp2-7 libturbojpeg0-bootdev tzdata''': Store the source code of u-boot</p>|}</li><li><p>'''userpatches''': Store the configuration files needed Then you need to compile the script</p></li></ol></li></ol> test@test:~/orangepi-build$ '''ls''' '''buildand install Python3.sh external kernel LICENSE output README9.md scripts toolchains u-boot userpatches''' <span id="compile-u-boot"></span>== Compile u-boot == # Run For the build.sh scriptmethod, remember please refer to add sudo permissions test@test:~/orangepi-build$ the [[Orange Pi Zero 2W#Python related instructions|'''sudo ./build.shPython source code compilation and installation method''' <ol start="2" style="list-style-type: decimal;"><li>Select '''U-boot package''' and press Enter</li></ol> <div class="figure"> [[File:media/image274.png|576x132px|选区_238]] section.</divp><ol start{| class="3wikitable" style="listbackground-style-typecolor: decimal#ffffdc;"><li>Then select the model of the development board</li></ol> [[File:media/image275.png|576x266px]] <ol start="4" style="list-style-typewidth: decimal800px;"><li><p>Then select the branch type of u|-boot</p><ol style="list-style-type: lower-alpha;">| <libig><p>'''The current branch will compile the u-boot v2018default Python version of Debian Bullseye is Python3.05 version code that needs 9, so there is no need to be used by the linux5.4 imagecompile and install it.'''</p></li><li><p>'''The next branch will compile the u-boot v2021default Python version of Ubuntu Jammy is Python3.07 version code that needs 10, so there is no need to be used by the linux6.1 imagecompile and install it.'''</p><p>[[File:media/image276'''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.png|576x77px]]'''</p></li></olbig>|}
</li>
<li><p>If you select the next branchThen create a Python virtual environment</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian Bookworm is python3.11, you will also be prompted to select the memory size, and you do not need please remember to select replace the current branchcorresponding command.'''</p></libig>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistant'''</olp><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant'''</p><blockquotep>orangepi@orangepi:~$ '''cd /srv/homeassistant'''</p>a. If the development board you purchased has a memory size of 1.5GB, please select the first option. b<p>orangepi@orangepi:~$ '''python3. If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option9 -m venv .'''</p><p>orangepi@orangepi:~$ '''source bin/activate'''</blockquotep>[[File<p>(homeassistant) orangepi@orangepi:media/image277.pngsrv/homeassistant$</p>|575x72px]]}</li><ol startli><p>Then install the required Python packages</p>{| class="6wikitable" style="listwidth:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 -m pip install wheel'''</p>|}</li><li><p>Then you can install Home Assistant Core</p>{| class="wikitable" style-type="width: decimal800px;"|-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''pip3 install homeassistant'''</p>|}</li><li><p>Then it will start enter the following command to compile u-boot. Some of the information prompted when compiling the next branch is as follows:run Home Assistant Core</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''hass'''</p>|}</li>Version of u-boot source code</li><p>Then enter【'''development board IP address: 8123'''】 in the browser to see the Home Assistant interface</olp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.'''</lip></olbig>|}<div class="figure">
[ o.k[File:zero2w-img180. png] Compiling u-boot [ '''v2021.07''' ]
<ol start="2" style="list-style-type: lower-alpha;"/div><li>Version of the cross-compilation tool chain</li></ol>
<ol start="4" style="list-style-type: lower-alphadecimal;"><li>The package name of the compiled u-boot deb package</lip>The installation command is as follows</olp> [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ] <ol start{| class="5wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Compilation time</li></ol> [ o.k. ] Runtime [ '''1 min''' ]|-| <ol start="6" style="list-style-typep>orangepi@orangepi: lower-alpha;"><li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li></ol> [ o.k. ] Repeat Build Options [ ~$ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=uapt-bootget update''' ] <ol start="7" style="list-style-type: decimal;"/p><lip>View the compiled u-boot deb package</li></ol> testorangepi@testorangepi:~/orangepi-build$ '''ls output/debs/usudo apt-boot/''' '''linuxget install -uy libopencv-bootdev python3-next-orangepizero2w_x.x.x_arm64.deb''' <ol start="8" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('opencv''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li></olp>|}<blockquote>Set the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to "yes"</blockquote>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf''' ...... IGNORE_UPDATES="'''yes'''" ...... <ol start="9" style="list-style-type: decimal;"li><li><p>When debugging u-boot code, you can Then use the following method command to update u-boot in print the version number of OpenCV. The output is normal, indicating that the linux image for testingOpenCV installation is successful.</p>
<ol style="list-style-type: lower-alpha;">
<li>First upload the compiled deb package <p>The version of uOpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.5.4'''</p>|}</li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.2.0'''</p>|}</li><li><p>The version of OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -boot to the Linux system c "import cv2; print(cv2.__version__)"'''</p><p>'''4.5.1'''</p>|}</li><li><p>The version of the development boardOpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.6.0'''</p>|}</li></ol>
</li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.xxx:/root root@192.168.1.xxx:/root]'''</big>|}
<ol startspan id="2" style="listdebian-stylesystem-type: lowerinstallation-alpha;method"><li>Install the new u-boot deb package just uploaded</li></olspan>=== Debian system installation method ===
<ol style="list-style-type: decimal;"><li><p>First set the default '''locale''' to Chinese</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the Tab key to move the cursor to '''<OK>''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. The output displayed on the command line is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -ireconfigure locales''' </p><p>Generating locales (this might take a while)...</p>:<p>en_US.UTF-8... done</p>:<p>zh_CN.UTF-8... done</p><p>Generation complete.</p>|}</li></ol></li><li><p>Then open '''linuxInput Method'''</p><p>[[File:zero2w-uimg188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-bootimg189.png]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-nextimg190.png]]</p></li><li><p>Then select '''fcitx'''</p><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-orangepizero2w_ximg192.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect.x</span>'''</p></li><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img193.x_arm64png]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.debpng]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">
</div></li><li><p>Then put '''Google Pinyin''' on top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany''' editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p><p>[[File:zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/default/locale''' to '''zh_CN.UTF-8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nandvim /etc/default/locale'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-sata8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.UTF-install8</span>'''</p>|}</li><li><p>Then '''<span style="color:#FF0000">restart the system</span>''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
<ol startspan id="4" style="listinstallation-method-of-styleubuntu-type: lower20.04-alpha;system"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li></olspan>
<ol style="list-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.png]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>|}</ol><ol start="54" style="list-style-type: lowerdecimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-alpha;img205.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After pressing opening '''Geany''', the Enter English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, a Warning will pop up firstand then we can input Chinese.</p><p>[[File:zero2w-img209.png]]</p></li></ol>
<ol style="list-style-type: decimal;">
<li><p>First open '''Language Support'''</p>
<p>[[File:zero2w-img201.png]]</p></li>
<li><p>Then find the '''Chinese (China)''' option</p>
<p>[[File:zero2w-img210.png]]</p></li>
<li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p>
<p>[[File:zero2w-img211.png]]</p></li>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p>
<p>[[File:zero2w-img212.png]]</p></li>
<li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li>
<li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p>
<p>[[File:zero2w-img206.png]]</p></li>
<li><p>Then you can see that the desktop is displayed in Chinese</p>
<p>[[File:zero2w-img207.png]]</p></li>
<li><p>Then open the Fcitx5 configuration program</p>
<p>[[File:zero2w-img213.png]]</p></li>
<li><p>Then choose to use Pinyin input method</p>
<div class="figure">
[[File:media/image281zero2w-img214.png|575x116px|选区_240]]
</div></li><ol start="3" style="listli><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-style-type: decimal;"img215.png]]</p></li><li><p>Then you will be prompted whether you need we can open '''Geany''' to display test the kernel configuration interfaceChinese input method. If you do not need to modify The opening method is as shown in the kernel configurationfigure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''Geany''', select the first oneEnglish input method is still the default. If you need We can switch to modify the kernel configurationChinese input method through the '''Ctrl+Space''' shortcut key, select the second oneand then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
<ol style="list-style-type: decimal;">
<li><p>First download the installation package of the NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, and then install it into the Linux system of the development board</p>
<ol style="list-style-type: lower-alpha;">
<li>If you do not Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to modify download the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURENoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows:</li>{| class="wikitable" style=no"background-color:#ffffdc;width:800px;" |-| <big>''' to temporarily block Note that this download link may change, please look for the pop-up Armv8/Arm64 version of the kernel configuration interfacedeb package.'''</li></olbig>|}{| class="wikitable" style="width:800px;" |-| test@test[https:~/orangepi-build$ /www.nomachine.com/download/download&id=112&s=ARM '''sudo https://downloads.nomachine.com/build.sh KERNEL_CONFIGUREdownload/?id=118&distro=noARM''']|}
[[File:zero2w-img217.png]]
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>b. You In addition, you can also set download the '''KERNEL_CONFIGURE=noNoMachine''' in installation package from the orangepiofficial tool.</p><p>[[File:zero2w-buildimg218.png]]</userpatchesp><p>First enter the '''remote login software-NoMachine''' folder</configp><p>[[File:zero2w-defaultimg219.confconfiguration file to permanently disable this functionpng]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>If Then upload the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayeddownloaded '''nomachine_x.x.x_x_arm64. Please increase the Ubuntu PC terminal deb''' to the maximum size, and then rerun Linux system of the build.sh script.development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</olp> [[File:media/image284.png{|574x234px]] <ol startclass="7wikitable" style="list-style-typewidth: decimal800px;"><li>|-| <p>Part of the information prompted when compiling the next branch kernel source code is explained as followsorangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p><ol style="list-style-type: lower-alpha;">|}<li>Version of the linux kernel source code</li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that this download link may change.'''</big>
|}
{| class="wikitable" style="width:800px;"
|-
|
'''https://downloads.nomachine.com/download/?id=9'''
|}
[ o[File:zero2w-img221.png]]</ol><ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows.k'''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222. png] Compiling current kernel ]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[ File:zero2w-img223.png]]</p></li><li><p>Then click '''6.1.31OK''' </p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>
<ol startspan id="2" style="listremote-stylelogin-type: lowerusing-alpha;vnc"><li>The version of the cross-compilation tool chain used</li></olspan>
<ol start="4" style="list-style-type: lower-alphadecimal;"><li>The path <p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to the kerneladd sudo permission'''s</p>{| class="wikitable" style="width:800px;" |-related deb package generated by compilation| <p>orangepi@orangepi:~$ '''sudo set_vnc.sh'''</lip><p>You will require a password to access your desktops.</olp>
<ol startp>Password: '''<span style="5color:#FF0000" >#Set the vnc password here, 8 characters</span>'''</p><p>Verify: '''<span style="listcolor:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Would you like to enter a view-only password (y/n)? '''<span style-type="color: lower-alpha;#FF0000">n<li/span>The package name of the kernel image deb package generated by compilation'''</lip><p>xauth: file /root/.Xauthority does not exist</olp>
<ol start="6" style="list-style-typep>New 'X' desktop is orangepi: lower-alpha;"><li>Compilation time</li>1</olp>
<ol start="7" style="list-style-type: lower-alpha;"p>Creating default startup script /root/.vnc/xstartup</p><lip>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source codeStarting applications specified in /root/.vnc/xstartup</lip><p>Log file is /root/.vnc/orangepi:1.log</olp>
<ol style="list-style-type: lower-alpha;">
<li>Upload First click Session, then select VNC, then fill in the compiled deb package of the Linux kernel to the Linux system IP address and port of the development board, and finally click OK to confirm.</li></ol></li></ol>
</div></ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Install <p>Then enter the VNC password set earlier</p><p>[[File:zero2w-img228.png]]</p></li><li><p>After successful login, the interface is displayed as shown below, and then you can remotely operate the deb package desktop of the new linux kernel just uploadeddevelopment board Linux system.</lip></olli>
<ol style="list-style-type: decimal;"><li><p>Use the following script to install QT5 and QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo''' '''rebootinstall_qt.sh'''</p>|}</li><span idli><p>After installation, the QT version number will be automatically printed.</p><ol style="compilelist-rootfsstyle-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</spanp>{| class="wikitable" style= Compile rootfs =="width:800px;" |-# Run the build.sh script, remember to add sudo permissions| test<p>orangepi@testorangepi:~/orangepi-build$ '''sudo install_qt.sh'''</buildp><p>..sh....</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.12.8</span>'''in /usr/lib/aarch64-linux-gnu</p>|}</li><ol startli><p>The QT version that comes with Ubuntu22.04 is '''5.15.3'''</p>{| class="2wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Select orangepi@orangepi:~$ '''Rootfs and all deb packagesinstall_qt.sh''' and press Enter</lip><p>......</olp><p>QMake version 3.1</p><div classp>Using Qt version '''<span style="figurecolor:#FF0000">5.15.3</span>''' in /usr/lib/aarch64-linux-gnu</p>|}[[File:media</image285li><li><p>The QT version that comes with Debian11 is '''5.15.png|576x119px|选区_241]] 2'''</divp><ol start{| class="3wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Then select the model of the development boardorangepi@orangepi:~$ '''install_qt.sh'''</lip><p>......</olp> [[File:media<p>QMake version 3.1</image275.png|576x266px]]p><ol startp>Using Qt version '''<span style="4color:#FF0000" style="list>5.15.2</span>''' in /usr/lib/aarch64-stylelinux-type: decimal;"gnu</p>|}</li><li><p>Then select the branch type of the kernel source codeThe QT version that comes with Debian12 is '''5. Different versions of the kernel source code maintain different rootfs types15.8'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''install_qt.sh'''<li/p><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04....</p><p>QMake version 3.1</lip><lip>Using Qt version '''<pspan style="color:#FF0000">In the next branch, you can see three options: debian11, debian12, and ubuntu225.0415.8</pspan><''' in /usr/lib/li>aarch64-linux-gnu</olp>|}
</li></ol>
</li><li><p>Then you can see the QT Creator startup icon in '''Applications'''</p><p>[[File:media/image276zero2w-img230.png|576x77px]]</p><p>You can also use the following command to open QT Creator</p><ol start{| class="5wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>|}</li>Then select the type of rootfs</li><p>The interface after QT Creator is opened is as follows</olp> <p>[[File:media/image286zero2w-img231.png|576x79px]]</p></li><li><p>The version of QT Creator is as follows</p><ol start="6" style="list-style-type: decimallower-alpha;"><li><p>The default version of QT Creator in '''Ubuntu20.04''' is as follows</p><p>[[File:zero2w-img232.png]]</p></li><li><p>The default version of QT Creator in '''Ubuntu22.04''' is as follows</p><p>[[File:zero2w-img233.png]]</p></li><li><p>The default version of QT Creator in '''Debian11''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''Debian12''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol></li><li><p>Then select the type of imageset up QT</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First open '''Image with console interface (server)Help'''->'''About Plugins...''' Represents .</p><p>[[File:zero2w-img236.png]]</p></li><li><p>Then remove the image check mark of '''ClangCodeModel'''</p><p>[[File:zero2w-img237.png]]</p></li><li><p>'''<span style="color:#FF0000">After setting up, you need to restart QT Creator</span>'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian12 please skip this step.'''</p></big>|}<p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-img240.png]]</p></li><li><p>After clicking on the server versionsample code, which is relatively small in sizethe corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File:zero2w-img241.png]]</p></li><li><p>Then click '''Image with desktop environmentConfigure Project''' Represents an image with </p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample code</p><p>[[File:zero2w-img243.png]]</p></li><li><p>After waiting for a desktopperiod of time, the interface shown in the figure below will pop up, which is relatively large in sizemeans that QT can compile and run normally.</p><p>[[File:zero2w-img244.png]]</p></li><li><p>References</p>{| class="wikitable" style="width:800px;" |-| <p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu''']</p><p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p><p>[https:/ol/download.qt.io/archive/qt '''https://download.qt.io/archive/qt''']</p>|}
</li></ol>
<div classspan id="figureros-installation-method"></span>
</div><ol startspan id="7" style="listhow-to-install-ros-style1-type: decimal;"><li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less prenoetic-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not preon-installed by defaultubuntu20. Some functions may not be available''')</li04"></olspan>=== How to install ROS 1 Noetic on Ubuntu20.04 ===
::[[File:media/image288zero2w-img245.png|576x78px|选区_397]]
::{| class="wikitable" style="width:800px;" |-| [[Filehttp://docs.ros.org/ '''http:media/image289/docs.ros.png|576x76px]org''']
'''https://wiki.ros.org/Distributions'''|} <ol start="2" style="list-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p>|}</li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:media/image290zero2w-img247.png|576x74px]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p>|}</li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</span>'''
'''<ol start="10" span style="list-style-typecolor: decimal;#FF0000"><li><p>View the compiled rootfs compressed package</p><ol style="ERROR: error loading sources list-style-type: lower-alpha;"><li/span>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li></ol></li></ol>
::'''<span style="color:#FF0000">The read operation timed out</span>'''<blockquote/big>a) |}{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''bullseyesource /opt/ros/noetic/setup.bash''' represents the type of Linux distribution of rootfs
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p>|}</li><li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:media/image291zero2w-img248.png|575x264px]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></li>
<ol startdiv class="10figure" style="list-style-type: decimal;"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li></ol>
:<p>Call `ros2 <command> -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.<ol start/p>{| class="11wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>After compiling the image, Run the following message will be displayedcommand to open rviz2</p><ol {| class="wikitable" style="listwidth:800px;" |-style-type| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>|}<p>[[File: lowerzero2w-alpha;"img253.png]]</p></li><li>The storage path <p>For how to use ROS, please refer to the documentation of the compiled imageROS 2.</lip>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</olp>|}
</li></ol>
=== How to install ROS 2 Humble on Ubuntu22.04 === <ol start="2" style="list-style-type: lower-alphadecimal;"><li>Compilation time<p>Use the install_ros.sh script to '''install_ros.sh'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</olp>
:<p>Call `ros2 <command> -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionstest_ros.sh'''</p>| <p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'OPi OS ArchHello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''HDMI videosource /opt/ros/humble/setup.bash'''</p>| <p>orangepi@orangepi:~$ '''OKros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;"
|-
| <p>'''HDMI Audiohttp://docs.ros.org/en/humble/index.html'''</p>| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''OKhttp://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p>|}</li></ol> <span id="how-to-install-kernel-header-files"></span> == How to install kernel header files == {| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''Type-C USB2Debian11 system with <span style="color:#FF0000">Linux6.1</span> kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.0 x 2'''</big>| } <ol style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''OK/opt/'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''TF Card Startupls /opt/linux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p>|}</li><li><p>Use the following command to install the deb package of the kernel header file</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''WIFIsudo dpkg -i /opt/linux-headers*.deb'''</p>| }</li><li><p>After installation, you can see the folder where the kernel header file is located under '''OK/usr/src'''.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Bluetoothls /usr/src'''</p><p>linux-headers-x.x.x</p>| }</li><li><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in '''OK/usr/src/hello'''. After entering this directory, then use the make command to compile.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</p><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory 'LED Light/usr/src/linux-headers-5.4.125'</p>:<p>CC [M] /usr/src/hello/hello.o</p>:<p>Building modules, stage 2.</p>:<p>MODPOST 1 modules</p>:<p>CC [M] /usr/src/hello/hello.mod.o</p>:<p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5.4.125'</p>| }</li><li><p>After compilation, the '''OKhello.ko'''kernel module will be generated</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:/usr/src/hello$ '''40pin GPIOls *.ko'''</p><p>hello.ko</p>| }</li><li><p>Use the '''insmod''' command to insert the '''OKhello.ko'''kernel module into the kernel</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:/usr/src/hello$ '''40pin I2Csudo insmod hello.ko'''</p>| }</li><li><p>Then use the '''OKdemsg'''command to view the output of the '''hello.ko''' kernel module. If you can see the following output, it means that the '''hello.ko''' kernel module is loaded correctly.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] '40pin SPI''Hello Orange Pi -- init'''</p>| }</li><li><p>Use the '''OKrmmod'''command to uninstall the '''hello.ko''' kernel module</p>{| class="wikitable" style="width:800px;"
|-
| '''40pin UART'''| <p>orangepi@orangepi:/usr/src/hello$ '''OKsudo rmmod hello'''</p>|-| <p>orangepi@orangepi:/usr/src/hello$ '''40pin PWM'''dmesg | grep "Hello"'''OK'''</p>|<p>[ 2871.893988] Hello Orange Pi -| '''Temperature Sensor'''| '''OK'''|-init</p>| '''Hardware watchdog'''| <p>[ 3173.800892] '''OK'''|Hello Orange Pi -| '''Mali GPU'''| '''NO'''|-| '''Video codec'''| '''NOexit'''</p>
|}
</li></ol>
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>After burning The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the system, when you start it source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the first time and enter the desktop, you will see the user wizard '''hello_world.c''' program shown in the figure below.C language</p><div {| class="figurewikitable" style="width:800px;">|-| [[File<p>orangepi@orangepi:media~$ '''vim hello_world.c'''</image293p><p>#include <stdio.png|576x324px|1]]h></p>
</div></li><li><pspan id="debian-bookworm-system">Then wait for the installation to complete</p><div class="figure"span>
<ol style="list-style-type: decimal;"><li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</divp></liol style="list-style-type: lower-alpha;"><li><p>After the installation The version of a.gcc is complete, you need to click the as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Finishgcc --version''' button to restart </p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the systemsource for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><div p>Write the '''hello_world.c''' program in C language</p>{| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include <stdio.h></p>
</divp>int main(void)</lip><lip>{</p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check '''mark of Start on startup''' in the lower right corner, otherwise you need to manually close the Orange Pi :<p>printf("Hello program every time you start it.World!\n");</p><div class="figure">
|-
| <p>orangepi@orangepi:~$ '''Functions on the development boardgcc -o hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''Corresponding DT overlays configuration./hello_world'''</p><p>Hello World!</p>|-}</li></ol></li>| '''40pin - i2c0'''<li><p>Debian Bookworm has Python3 installed by default</p>| '''sun50i<ol style="list-h616style-pitype: lower-i2c0.dtbo'''alpha;"><li><p>The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin - i2c1python3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>| '''sun50i-h616-pi}{| class="wikitable" style="background-i2c1.dtbo'''color:#ffffdc;width:800px;"
|-
| <big><p>'''Use the Ctrl+D shortcut key to exit python'40pin - i2c2s interactive mode.'''</p></big>| }</li><li><p>Write the '''sun50i-h616-pi-i2c2hello_world.dtbopy'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin - uart2vim hello_world.py'''</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''sun50i-h616-pi-uart2hello_world.dtbopy'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin - uart3python3 hello_world.py'''</p><p>Hello World!</p>| '''sun50i}</li></ol></li><li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol style="list-h616style-pitype: lower-uart3alpha;"><li><p>You can use the following command to install openjdk.dtbo'''The latest version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin sudo apt install -y openjdk-17- uart4jdk'''</p>| '''sun50i-h616-pi-uart4}</li><li><p>After installation, you can check the Java version.dtbo'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin java - uart5-version'''</p>| }</li><li><p>Write the Java version of '''sun50i-h616-ph-uart5hello_world.dtbojava'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin - pwm1vim hello_world.java'''</p><p>public class hello_world</p>| '''sun50i-h616-pi-pwm1<p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.dtbo'''println("Hello World!");</p>:<p>}</p><p>}</p>|-}| </li><li><p>Then compile and run '''40pin - pwm2hello_world.java'''</p>{| '''sun50i-h616-pi-pwm2.dtbo'''class="wikitable" style="width:800px;"
|-
| '''40pin - pwm3'''| '''sun50i-h616-pi-pwm3.dtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4.dtbo'''|-| '''40pin - spi1 cs0'''| '''sun50i-h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| <p>orangepi@orangepi:~$ '''sun50i-h616-spi1-cs0-cs1-spidevjavac hello_world.dtbo'''|-| '''设Set USB0 to Host modejava'''</p>| <p>orangepi@orangepi:~$ '''sun50i-h616-usb0-host.dtbojava hello_world'''</p>|-| '''Turn off the green LED light'''| '''sun50i-h616-zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0.dtbo'''<p>Hello World!</p>
|}
</li></ol>
</li></ol>
<ol startspan id="5" style="listubuntu-stylefocal-type: decimal;system"><li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></olspan>
:<ol start="6" style="list-style-type: decimalp>return 0;"</p><li>After setting, you need to restart the system for the configuration to take effect.</lip>}</olp>|}[orangepi@orangepi-pc ~]$ '''sudo reboot''' <span id="how-to-install-software"></spanli>== How to install software == You can use the pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install. [orangepi@orangepi-pc ~]$ '''sudo pacman -Syy vim''' <span id="android-12-tv-system-usage-instructions"li></spanp> = Then compile and run '''Android 12 TV system usage instructionshello_world.c''' = <span id="supported-android-versions"></spanp>== Supported Android versions == {| class="wikitable" style="width:800px;"
|-
| Android Version<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p>| Kernel }</li></ol></li><li><p>Ubuntu Focal has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific versionof Python3 is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Android 12 TV Versionpython3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p>| '''linux5<p>[GCC 9.4'''.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>
|}
|-
| <big><p>'''Motherboard functionsUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''Android12 TVhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''HDMI video'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''HDMI Audiopython3 hello_world.py'''</p><p>Hello World!</p>| '''OK'''}</li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Typesudo apt install -y openjdk-17-C USB2.0 x 2jdk'''</p>| '''OK'''}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''TF card startupjava --version'''</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p>| }</li><li><p>Write the Java version of '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''WIFIvim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Bluetoothjavac hello_world.java'''</p>| <p>orangepi@orangepi:~$ '''OKjava hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol> <span id="ubuntu-jammy-system"></span> === Ubuntu Jammy system === <ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''USB Camera11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>| }</li><li><p>Write the '''OKhello_world.c'''program in C language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''LED Lightvim hello_world.c'''</p><p>#include <stdio.h></p> <p>int main(void)</p><p>{</p>:<p>printf("Hello World!\n");</p> :<p>return 0;</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.c'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin GPIOgcc -o hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''OK./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin I2Cpython3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''40pin SPI1Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OKhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''40pin UART'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin PWMpython3 hello_world.py'''</p><p>Hello World!</p>| '''OK'''}</li></ol></li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-18</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Temperature Sensorsudo apt install -y openjdk-18-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Hardware watchdogjava --version'''</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p>| }</li><li><p>Write the Java version of '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Mali GPUvim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Video codecjavac hello_world.java'''</p>| <p>orangepi@orangepi:~$ '''OKjava hello_world'''</p><p>Hello World!</p>
|}
</li></ol>
</li></ol>
<span id="method-of-uploading-files-to-the-development-board-linux-system"></span> == Method of uploading files to the development board Linux system == <span id="method-to-upload-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC === <span id="how-to-upload-files-using-scp-command"></span>==== How to upload files using scp command ==== <ol style="list-style-type: decimal;"><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system. It can also be replaced with something else, such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of the development board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;"
|-
| <p>test@test:~$ '''24pin Expansion board functionscp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li></ol></li><li><p>If you want to upload a folder, you need to add the -r parameter</p>{| '''Android12 TV'''class="wikitable" style="width:800px;"
|-
| <p>test@test:~$ '''100M network portscp <span style="color:#FF0000">-r</span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li><li><p>There are more usages of scp, please use the following command to view the man manual</p></li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''On/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keys.'''|-| '''TV-OUT'''| test@test:~$ '''OKman scp'''
|}
</ol>
<span id="how-to-upload-files-using-filezilla"></span>
<ol style="list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</p>{| class="wikitable" style="width:800px;"
|-
|| <p>test@test:~$ '''green lightsudo apt install -y filezilla'''</p>|}</li><li><p>Then use the following command to open filezilla</p>{| '''red light'''class="wikitable" style="width:800px;"
|-
| '''u-boot startup phase'''| '''Off'''| '''on'''|-| '''Kernel boot to enter the system'''| '''on'''| <p>test@test:~$ '''onfilezilla'''</p>
|}
</li>
<li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</p>
<div class="figure">
[[File:media/image303zero2w-img256.png|231x185px]]
<span id/div></ol><ol start="how5" style="list-style-type: decimal;"><li><p>Then choose to'''save the password''' and click '''OK'''</p><p>[[File:zero2w-use-adb"img257.png]]</p></spanli>== How to use ADB ==<li><p>Then select '''Always trust this host''' and click '''OK'''</p></li>
<span iddiv class="use-network-connection-adb-debuggingfigure"></span>=== Use network connection adb debugging ===
[service.adb.tcp[File:zero2w-img259.portpng]: [5555]
</div></ol><ol start="28" style="list-style-type: decimal;"><li>If '''service.adb.tcp.port''' is not setThen select the path to be uploaded to the development board on the right side of the filezilla software, you can use select the following command file to be uploaded in Ubuntu PC on the serial port left side of the filezilla software, right-click the mouse, and then click the upload option to set start uploading the port number of file to the network adbdevelopment board.</li></ol>
</div></ol><ol start="39" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PC<p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
<ol startspan id="4" style="listhow-to-upload-files-using-stylefilezilla-type: decimal;1"><li>Then connect network adb on Ubuntu PC</li></olspan>==== How to upload files using filezilla ====
</div></ol><ol start="47" style="list-style-type: decimal;"><li>Then After the connection is successful, you can log in to see the directory structure of the android development board's Linux file system through adb shell on Ubuntu PCthe right side of the filezilla software.</li></ol>
<span id/div></ol><ol start="view8" style="list-howstyle-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file tobe uploaded on the Windows PC on the left side of the filezilla software, right-set-hdmi-display-resolution">click the mouse, and then click the upload option to start uploading the file to the development board.</spanli>== View how to set HDMI display resolution ==
<ol stylediv class="list-style-type: decimal;figure"><li><p>Enter first '''Settings'''</p><p>[[File:media/image306.png|234x83px]]</p></li><li><p>Then select '''Device Preferences'''</p><p>[[File:media/image307.png|415x170px]]</p></li><li><p>Then select '''Display & Sound'''</p><p>[[File:media/image308.png|420x133px]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:media/image309.png|423x96px]]</p></li><li><p>Then select '''HDMI output mode'''</p><p>[[File:media/image310.png|423x101px]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:media/image311.png|429x136px]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:media/image312.png|429x242px]]</p></li></ol>
</div></ol><ol start="9" style="list-style-type: decimal;"><li><p>First After the upload is completed, you need can go to the corresponding path in the development board Linux system to prepare view the following accessoriesuploaded file.</p><ol style="list-style-type: lower-alpha;"/li><li>HDMI to VGA converter</lip>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</olp></li></ol>
[[File:media/image314zero2w-img269.png|373x103px]]
<ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:mediazero2w-img80.png]]</p></image315li><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 in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png|381x50px]]</p></li></ol>
<ol startspan id="4" style="listhow-to-shut-down-styleand-type: decimal;"><li>After turning on WIrestart-FI, you can see the searched signals under '''Available networks'''.</li-development-board"></olspan>
<ol start="5" style="list-style-type: decimal;"><li>After selecting <p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the WI'''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo poweroff'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-FI | <big><p>'''Note that after turning off the development board, you want need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li><li><p>In addition to connect using the poweroff command toshut down, you can also use the password input interface shown below will pop uppower on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>|}</li><li><p>Use the '''reboot''' command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p>|}</li></ol>
<div classspan id="figurelinux-sdkorangepi-build-usage-instructions"></span>
</div><ol start="6" stylespan id="listcompilation-stylesystem-type: decimal;requirements"><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li></olspan>== Compilation system requirements ==
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<div classspan style="figurecolor:#FF0000">Ubuntu 22.04</span>''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.
{| class="wikitable" style="width:800px;" |-| [[Filehttps://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https:media/image314/mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.png04-desktop-amd64.iso''']|373x103px]]}
{| class="wikitable" style="width:800px;" |-| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']|}</ol><ol start="52" style="list-style-type: decimallower-alpha;"><li>Then open '''Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to Note that the hotspot (if you need Ubuntu version needs to modify the name and password of the hotspot, you need be switched to close Hotspot Enable first22.04. Then you can modify it)</li></ol>
[[File:media/image321zero2w-img271.png|402x174px]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The contents of the '''/etc/apt/sources.list''' file that need to be replaced are:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak'''
'''# There is no wired network interface on the main board of the development board''' deb-src https://mirrors.tuna.tsinghua. We can expand the 100M Ethernet through a 24pin expansion boardedu.cn/ubuntu/ jammy-updates main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="34" style="list-style-type: decimallower-alpha;"><li>Then Open After the replacement, you need to update the package information and ensure that no errors are reported.</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''Bluetooth Enable'|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>'''<span style="color:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
<ol startdiv class="7figure" style="list-style-type: decimal;"><li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li></ol>
[[File:media/image332zero2w-img272.png|178x200pxcenter|800px]]
<ol start/div>|}{| class="8wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>After pairing is completed, open '''Paired devices''' When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual). If after entering the git clone command, Ubuntu PC prompts you will see to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the paired Bluetooth devicesgithub account.'''</li></olbig>|}
<span idol style="howlist-tostyle-set-usb0type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains configuration files needed tocompile the image, specific scripts, and source code of some programs, etc.</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-host-mode-1"build documentation</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li></spanol>{| class="wikitable" style= How to set USB0 to HOST mode =="width:800px;" |-| test@test:~/orangepi-build$ '''ls'''
When orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder. Every time you run orangepi-build's build.sh script, it will check whether the cross-compilation toolchain in toolchains exists. If If it does not exist, the download will be restarted. If you want to use USB0 to connect USB devicesit exists, you need to set USB0 to HOST modeit will be used directly without repeated downloading. The method is as follows:
<ol stylediv class="list-style-type: lower-alpha;figure"><li>Run the following command to set USB0 to HOST mode:</li></ol>
<ol style="list-style-type: lower-alpha;"><li>v2018.05</li>{| class="wikitable" style="width:800px;" |-| '''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''|}</ol><ol start="62" style="list-style-type: decimallower-alpha;"><li>After installation, you can see the startup icon of the USB camera on the Android desktopv2021.07</li>{| class="wikitable" style="width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol><span id="orangepi-build-complete-directory-structure-description"></span>
<ol style="list-style-type: decimal;">
<li><p>FirstAfter downloading, please make sure the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse.</p><ol style="list-style-type: lower-alpha;"><li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that both the development board and branch of the mobile phone are connected linux-orangepi warehouse is switched to </p><ol style="list-style-type: none;"><li>a) Linux5.4</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) Linux6.1</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-6.1-sun50iw9'''|}</ol></li></ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>The git warehouse where the same WIFI hotspotu-boot source code is stored is as follows. For Please note that the method branch of connecting the development board to WIFI, please refer u-boot-orangepi warehouse is switched to </p><ol style="list-style-type: lower-alpha;"><li>a) v2018.05</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2018.05-h618'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) v2021.07</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi'''|}</ol></li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the instructions first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in the WIorangepi-build are:</p><ol style="list-style-type: lower-FI connection methodalpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>Then open '''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''MiracastReceiverkernel'''application in : Store the Android system source code of the development boardlinux kernel</p></li><li><p>[[File'''LICENSE''':mediaGPL 2 license file</p></image343li><li><p>'''README.png|416x89px]]md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>The interface after '''MiracastReceiveru-boot''' is opened is as follows: Store the source code of u-boot</p></li><div li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li>{| class="figurewikitable">style="width:800px;" |-| test@test:~/orangepi-build$ '''ls'''
</div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p><p>[[File:media/image345.png|138x266px]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.</p><p>[[File:media/image346.png|144x302px]]</p></li><li><p>Then the selection box shown in the figure below will pop up in the '''MiracastReceiver''' application interface of the development board. Here we can select '''Accept'''</p><p>[[File:media/image347.png|468x265px]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:media/image348.png|559x453px]]</p></lispan id="compile-u-boot"></olspan>
[[File:media/image350.png|547x108px]] After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on. <span id="pin-interface-gpio-uart-spi-test"></span>== 40pin interface GPIO, UART, SPI test == '''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.''' <span id="pin-gpio-port-test-method"></span>=== 40pin GPIO port test method === # First open wiringOP APP on the desktop [[File:media/image351.png|571x132px]] <ol start="2" style="list-stylezero2w-type: decimal;"><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li></ol> [[File:media/image352img274.png|575x136px]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>The GPIO test interface is as shown in Then select the figure below. The two rows model of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.development board</li></ol> [[File:media/image353.png|575x331px]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then click select the branch type of u-boot</p><ol style="list-style-type: lower-alpha;"><li><p>The current branch will compile the '''GPIO READALL''' button, and u-boot v2018.05 version code that needs to be used by the output information is as shown below:linux5.4 image.</p></li><li><p>The next branch will compile the u-boot v2021.07 version code that needs to be used by the linux6.1 image.</olp> <div class="figure"p> [[File:media/image354zero2w-img276.png|576x324px|Screenshot_20230901-103250]]</p></li></ol></li><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</divp><ol start="5" style="list-style-type: decimallower-alpha;"><li>There are a total of 28 GPIO ports available in <p>If the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use purchased has a multimeter to measure the value of the voltage memory size of the pin. If it is '''31.3v'''5GB, it means please select the setting High level successfirst option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</olp> <p>[[File:media/image355zero2w-img277.png|486x304px]]</p></li></ol></li></ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</lip></ol> [[File:media/image356.png|453x289px]] <ol start="7" style="list-style-type: decimal;"><li>Click the '''CheckBox''' button in the picture below again to uncheck Then it, and pin 12 will be set start to low levelcompile u-boot. After setting, you can use a multimeter to measure the voltage value Some of the pin. If it is '''0v''', it means information prompted when compiling the low level setting next branch is successful.</li>as follows:</olp> [[File:media/image357.png|452x280px]] <ol start="8" style="list-style-type: decimallower-alpha;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is OUT and the pin level is low level.Version of u-boot source code</li></ol> [[File:media/image358.png{|417x264px]] <span idclass="pin-uart-test-methodwikitable"></span>=== 40pin UART test method === # As can be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| classstyle="wikitablewidth:800px;"
|-
| '''GPIO序号'''| [ o.k. ] Compiling u-boot [ '''GPIOv2021.07''']| '''功能'''}| '''引脚'''|| '''引脚'''</ol>| '''功能'''<ol start="2" style="list-style-type: lower-alpha;">| '''GPIO'''<li>Version of the cross-compilation tool chain</li>{| '''GPIO序号'''class="wikitable" style="width:800px;"
|-
|-
| '''264'''| [ o.k. ] Target directory [ '''PI8'''| '''TWI1orangepi-build/output/debs/u-SDAboot''']| '''3'''}|</ol>| '''<ol start="4'''| '''5V'''| " style="textlist-style-aligntype: leftlower-alpha;"|><li>The package name of the compiled u-boot deb package</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''263'''| [ o.k. ] File name [ '''PI7'''| '''TWI1linux-u-boot-next-SCLorangepizero2w_x.x.x_arm64.deb''']| '''5'''}|</ol>| '''6'''| '''GND'''| <ol start="5" style="textlist-alignstyle-type: leftlower-alpha;"|><li>Compilation time</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''269'''| [ o.k. ] Runtime [ '''PI131 min''']| '''PWM3'''}| '''7'''|| '''8'''</ol>| '''UART0_TX'''<ol start="6" style="list-style-type: lower-alpha;">| '''PH0'''<li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li>{| '''224'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]|}</ol></li></ol><ol start="7" style="textlist-style-aligntype: leftdecimal;"|><li>View the compiled u-boot deb package</li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''
|-
| '''226'''| test@test:~/orangepi-build$ '''PH2ls output/debs/u-boot/'''| '''UART5_TX'''| '''11linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}| '''12'''</ol>| <ol start="8" style="textlist-style-aligntype: leftdecimal;"|>| <li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''PI1You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li> | Set the IGNORE_UPDATES variable in u'''257userpatches/config-default.conf'''to "yes" {| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''227vim userpatches/config-default.conf'''| '''PH3'''| ...... IGNORE_UPDATES="'''UART5_RX<span style="color:#FF0000">yes</span>'''"| '''13'''|......| '''14'''}| '''GND'''</ol>| <ol start="9" style="textlist-style-aligntype: leftdecimal;"|><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p>| <ol style="textlist-alignstyle-type: leftlower-alpha;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li>{|class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''261cd output/debs/u-boot'''| test@test:~/orangepi_build/output/debs/u-boot$ '''PI5scp \'''| '''UART2_TX'''| '''15linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}| '''16'''</ol>| '''PWM4'''<ol start="2" style="list-style-type: lower-alpha;">| '''PI14'''<li>Install the new u-boot deb package just uploaded</li>{| '''270'''class="wikitable" style="width:800px;"
|-
|-
| orangepi@orangepi:~$ '''231sudo nand-sata-install'''| }</ol><ol start="4" style="list-style-type: lower-alpha;"><li>Then select '''PH75 Install/Update the bootloader on SD/eMMC'''</li> [[File:zero2w-img278.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li>After pressing the Enter key, a Warning will pop up first.</li> [[File:zero2w-img279.png]]</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li> [[File:zero2w-img280.png]]</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol></li></ol><span id="compile-the-linux-kernel"></span>| '''SPI1_MOSI'''| '''19'''== Compile the linux kernel ==|| # Run the '''20build.sh'''script, remember to add sudo permissions| '''GND'''::{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| test@test:~/orangepi-build$ '''232sudo ./build.sh'''| } <ol start="2" style="list-style-type: decimal;"><li>Select '''PH8Kernel package'''and press Enter</li> <div class="figure"> [[File:zero2w-img281.png]] </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.</li> [[File:zero2w-img282.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then select the model of the development board</li> [[File:zero2w-img275.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li> ::a. The current branch will compile the linux5.4 kernel source code ::b. The next branch will compile the linux6.1 kernel source code ::[[File:zero2w-img276.png]]</ol><ol start="6" style="list-style-type: decimal;">| <li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''SPI1_MISOmake menuconfig'''will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li>| '''21'''|[[File:zero2w-img283.png]]| '''22'''| '''UART2_RX'''<ol style="list-style-type: lower-alpha;">| <li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''PI6KERNEL_CONFIGURE=no'''to temporarily block the pop-up of the kernel configuration interface.</li>{| '''262'''class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''230sudo ./build.sh KERNEL_CONFIGURE=no'''| }</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>b. You can also set '''PH6KERNEL_CONFIGURE=no'''in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li>| '''SPI1_CLK'''<li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li> [[File:zero2w-img284.png]]</ol>| '''23'''</ol>|<ol start="7" style="list-style-type: decimal;">| '''24'''<li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p>| '''SPI1_CS0'''<ol style="list-style-type: lower-alpha;">| '''PH5'''<li>Version of the linux kernel source code</li>{| '''229'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiling current kernel [ '''6.1.31''' ]|}</ol><ol start="2" style="textlist-alignstyle-type: leftlower-alpha;"|><li>The version of the cross-compilation tool chain used</li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''
|-
| [ o.k. ] Compiler version [ '''266aarch64-linux-gnu-gcc 11''']| '''PI10'''}</ol>| '''TWI2<ol start="3" style="list-style-type: lower-SDA'''alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li>{| '''27'''class="wikitable" style="width:800px;" |-| [ o.k. ] Using kernel config file [ '''28orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''']| '''TWI2}</ol><ol start="4" style="list-style-type: lower-SCL'''alpha;">| '''PI9'''<li>The path to the kernel-related deb package generated by compilation</li>{| '''265'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''256output/debs/''']| '''PI0'''}</ol>| <ol start="5" style="textlist-alignstyle-type: leftlower-alpha;"|| '''29'''|>| '''30'''<li>The package name of the kernel image deb package generated by compilation</li>{| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [ o.k. ] File name [ '''271linux-image-next-sun50iw9_x.x.x_arm64.deb''']| '''PI15'''}</ol>| <ol start="6" style="textlist-style-aligntype: leftlower-alpha;"|>| '''31'''<li>Compilation time</li>{|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| '''268'''| '''PI12'''| [ o.k. ] Runtime [ '''PWM210 min''']| '''33'''}|</ol>| '''34'''| '''GND'''| <ol start="7" style="textlist-alignstyle-type: leftlower-alpha;"|><li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| [ o.k. ] Repeat Build Options [ '''258sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''']| '''PI2'''}</ol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p>| <ol style="textlist-alignstyle-type: leftlower-alpha;"|>| <li><p>'''35linux-dtb-next-sun50iw9_x.x.x_arm64.deb'''Contains dtb files used by the kernel</p></li>|<li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li>| <li><p>'''36linux-image-next-sun50iw9_x.x.x_arm64.deb'''Contains kernel images and kernel modules</p></li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PC12'''| '''76'''
|-
| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| style="text-aligntest@test: left;"|| style="text~/orangepi-align: left;"|| '''GND'build$ ''| '''39'''|| '''40'''| style="textls output/debs/linux-align: left;"|| *'''PI3'''| '''259'''|}
output/devdebs/ttyAS0 linux-image-next-sun50iw9_x.x.x_arm64.deb|}</devol></ttyAS1 li></ol><ol start="9" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''/dev/ttyAS2 /dev/ttyAS5it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
IGNORE_UPDATES="'''<span style="color:#FF0000">yes</span>'''"|}</ol><ol start="410" style="list-style-type: decimal;"><li>Then click <p>If the '''UART_TEST'''button kernel is modified, you can use the following method to open update the UART test interfacekernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</olli>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol><ol start="52" style="list-style-type: lower-alpha;"><li>Install the deb package of the new linux kernel just uploaded.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</ol></li></ol><span id="compile-rootfs"></span> == Compile rootfs == # Run the build.sh script, remember to add sudo permissions ::{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''sudo ./build.sh'''|} <ol start="2" style="list-style-type: decimal;"><li>Select '''Rootfs and all deb packages''' and press Enter</li> <div class="figure"> [[File:zero2w-img285.png]] </div></ol><ol start="3" style="list-style-type: decimal;"><li>The serial port test interface Then select the model of wiringOP is as shown in the figure belowdevelopment board</li> [[File:zero2w-img275.png]]</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><olstyle="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li> [[File:media/image360zero2w-img276.png|576x150px]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li>
[[File:zero2w-img286.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select the '''type of image</dev/ttyAS2p><ol style="list-style-type: lower-alpha;"><li><p>''' orImage with console interface (server)'''/dev/ttyAS5''' node Represents the image of the server version, which is relatively small in the selection box</p><p>[[File:media/image361size.png|352x186px]]</p></li><li><p>Enter the baud rate you want to set in the edit box, and then click the '''OPENImage with desktop environment''' button to open the uart node. After the opening Represents an image with a desktop, which is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectablerelatively large in size.</p></li> </oldiv class="figure"> [[File:zero2w-img287.png]]
<ol startdiv class="8figure" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''SEND''' button to start sending.</p></li></ol>
[[File:media/image363zero2w-img288.png|376x189px]]
</div></ol><ol start="108" style="list-style-type: decimal;"><li>If everything you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is normalmaintained, the received string will be displayed in the receiving boxso please select an XFCE type desktop.</li></ol>
[[File:media/image364zero2w-img289.png|382x196px]]
[[File:zero2w-img291.png]]</ol><ol start="9" style="list-style-type: decimal;"><li><p>Then the compilation of rootfs will start. Some of the information prompted during compilation are as follows:</p><ol style="list-style-type: lower-alpha;"><li>Type of rootfs</li>{| class="wikitable" style="width:800px;"
|-
| '''GPIO serial number'''| [ o.k. ] local not found [ Creating new rootfs cache for '''GPIObullseye''']| '''Function'''}| '''pin'''|| '''pin'''</ol>| '''Function'''<ol start="2" style="list-style-type: lower-alpha;">| '''GPIO'''<li>The storage path of the compiled rootfs compressed package</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
|-
| [ o.k. ] File name [ '''264bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''']| }</ol></li></ol><ol start="10" style="list-style-type: decimal;"><li><p>View the compiled rootfs compressed package</p><ol style="list-style-type: lower-alpha;"><li>'''PI8bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4'''It is a compressed package of rootfs. The meaning of each field in the name is</li> | :a) '''TWI1-SDAbullseye'''represents the type of Linux distribution of rootfs| :b) '''3xfce'''indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.|| :c) '''4arm64'''represents the architecture type of rootfs| :d) '''5V25250ec7002de9e81a41de169f1f89721'''is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</ol>| <ol start="2" style="textlist-style-aligntype: leftlower-alpha;"|><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~/orangepi-build$ '''263ls external/cache/rootfs/''' bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4 bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list| }</ol></li></ol><ol start="11" style="list-style-type: decimal;"><li>If the required rootfs already exists under '''PI7external/cache/rootfs'''| , then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''TWI1-SCLexternal/cache/rootfs'''to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol> | '''5'''<span id="compile-linux-image"></span> == Compile linux image ==|| # Run the '''6build.sh'''script, remember to add sudo permissions| '''GND'''::{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| test@test:~/orangepi-build$ '''269sudo ./build.sh'''| } <ol start="2" style="list-style-type: decimal;"><li>Select '''PI13Full OS image for flashing'''and press Enter</li> <div class="figure"> [[File:zero2w-img292.png]] </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li> [[File:zero2w-img275.png]]</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li> [[File:zero2w-img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li> [[File:zero2w-img286.png]]</ol><ol start="7" style="list-style-type: decimal;">| <li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''PWM3Image with console interface (server)'''Represents the image of the server version, which is relatively small in size.</p></li>| <li><p>'''7Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li>|| '''<div class="figure"> [[File:zero2w-img287.png]] </div></ol></li></ol><ol start="8'''" style="list-style-type: decimal;">| <li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''UART0_TXplease do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li>| '''PH0'''| '''224'''<div class="figure"> |[[File:zero2w-img288.png]]| </div></ol><ol start="9" style="textlist-alignstyle-type: leftdecimal;"|><li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li> [[File:zero2w-img289.png]] [[File:zero2w-img290.png]] You can then select additional packages that need to be installed. Please press the Enter key here to skip directly. [[File:zero2w-img291.png]]</ol>| <ol start="10" style="textlist-style-aligntype: leftdecimal;"|><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li> ::a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process. ::b. Download the source code of u-boot and linux kernel (if already cached, only update the code) ::c. Compile u-boot source code and generate u-boot deb package ::d. Compile linux source code and generate linux-related deb packages ::e. Make the deb package of linux firmware ::f. Make the deb package of orangepi-config tool ::g. Create a deb package with board-level support ::h. If you compile the desktop version image, you will also create a desktop-related deb package. ::i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use it. ::j. Install the deb package generated previously into rootfs ::k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc. ::l. Then create the image file and format the partition. The default type is ext4. ::m. Then copy the configured rootfs to the mirror partition.| '''GND'''| '''9'''::n. Then update initramfs|| '''10'''::o. Finally, write the bin file of u-boot into the image through the dd command.| '''UART0_RX'''</ol>| '''PH1'''<ol start="11" style="list-style-type: decimal;">| '''225'''<li><p>After compiling the image, the following message will be displayed</p>|<ol style="list-style-type: lower-alpha;"><li>The storage path of the compiled image</li>{| '''226'''class="wikitable" style="width:800px;" | '''PH2'''-| '''UART5_TX'''| [ o.k. ] Done building [ '''11output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''']|}| '''12'''</ol>| <ol start="2" style="textlist-style-aligntype: leftlower-alpha;"|>| '''PI1'''<li>Compilation time</li>{| '''257'''class="wikitable" style="width:800px;"
|-
| '''227[ o.k. ] Runtime [ 19 min ]'''| '''PH3'''}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li>{| '''UART5_RX'''class="wikitable" style="width:800px;" | '''13'''-|| [ o.k. ] Repeat Build Options [ '''14sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''']| }</ol></li></ol><span id="instructions-for-using-the-orange-pi-os-arch-system"></span> = '''GNDInstructions for using the Orange Pi OS Arch system'''=| style<span id="textorange-pi-os-arch-system-function-adaptation-align: left;status"|></span>== Orange Pi OS Arch system function adaptation status == {| class="wikitable" style="width:800px;text-align: leftcenter;"|
|-
| '''261Motherboard functions'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OPi OS Arch'''
|-
|-
| '''231HDMI Audio'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232Type-C USB2.0 x 2'''| '''PH8OK'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''-| '''PI6TF Card Startup'''| '''262OK'''
|-
| '''230WIFI'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
|-
| '''266LED Light'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265OK'''
|-
| '''25640pin GPIO'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''27140pin I2C'''| '''PI15OK'''| style="text-align: left;"|'''40pin SPI'''| '''31OK'''|-| '''3240pin UART'''| '''PWM1OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''PI11Hardware watchdog'''| '''267OK'''
|-
| '''268Mali GPU'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>NO</span>'''
|-
| '''258Video codec'''| '''PI2'''| <span style="text-aligncolor: left;#FF0000"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76>NO</span>'''
|}
<ol start="6" style="list-style-type: decimallower-alpha;"><li><p>Then select After burning the spi device node in the upper left corner. If system, when you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If start it for the '''w25qxx''' module is connected to first time and enter the 40pin spi1 cs0desktop, then please select'''/dev/spidev1.0''', if you will see the w25qxx module is connected to user wizard program shown in the 40pin spi1 cs1, then please select '''/dev/spidev1figure below.1'''</p>
<div class="figure">
[[File:media/image366zero2w-img293.png|296x135px|C:\Users\orangepi\Desktop\用户手册插图\Zero3\未标题-7.jpg未标题-7]]
</div></li>
<li><p>Then click the '''OPEN''' button First you need to initialize select the SPIlanguage you want</p></li></oldiv class="figure">
[[File:media/image367zero2w-img294.png|295x168px]]
<ol start="8" style="list-style-type: decimal;"/div></li><li>Then fill in <p>After selecting the bytes that need to be sentlanguage, such as reading the ID information of user wizard will immediately switch to the onboard SPIFlashcorresponding language interface, filling as shown below in the address 0x9f in data[0], and then click the '''TRANSFER''' buttonChinese</lip></oldiv class="figure">
[[File:media/image368zero2w-img295.png|294x169px]]
<ol start="9" style="list-style-type: decimal;"/div></li><li>Finally, <p>Then select the APP will display the read ID information of the onboard SPI Flash.area</lip></oldiv class="figure">
[[File:media/image369zero2w-img296.png|296x223px]]
<ol start="10" style="list-style-type: decimal;"/div></li><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of <p>Then select the onboard SPI Flash is also similar.keyboard model</lip></oldiv class="figure"> [[File:zero2w-img297.png]]
<span id="pin-i2c-test-method"/div></li><li><p>Then create a new username and set a password</spanp><div class=== 40pin I2C test method ==="figure">
|-
|-
| [orangepi@orangepi-pc ~]$ '''264sudo vim /boot/extlinux/extlinux.conf'''| LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb '''PI8FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>'''#Configuration that needs to be added| '''TWI1}</ol><ol start="3" style="list-style-SDA'''type: decimal;"><li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| '''3'''class="wikitable" style="width:800px;" |-| <p>'''4/boot/dtbs/allwinner/overlay/'''</p>| '''5V'''}</li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li> {| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''263Functions on the development board'''| '''PI7Corresponding DT overlays configuration'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26940pin - i2c0'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224sun50i-h616-pi-i2c0.dtbo'''
|-
|-
| '''22640pin - i2c2'''| '''PH2sun50i-h616-pi-i2c2.dtbo'''| '''UART5_TX'''-| '''1140pin - uart2'''|| '''12'''| style="textsun50i-h616-pi-align: left;"|| '''PI1'''| '''257uart2.dtbo'''
|-
| '''22740pin - uart3'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-uart3.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - uart4'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-uart4.dtbo'''
|-
|-
| '''23140pin - pwm1'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20''sun50i-h616-pi-pwm1.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - pwm2'''| '''PH8sun50i-h616-pi-pwm2.dtbo'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''-| '''PI640pin - pwm3'''| '''262sun50i-h616-pi-pwm3.dtbo'''
|-
| '''23040pin - pwm4'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-pi-pwm4.dtbo'''
|-
|-
| '''26640pin - spi1 cs1'''| '''PI10'''| '''TWI2sun50i-h616-spi1-SDA'''| '''27'''|| '''28'''| '''TWI2cs1-SCL'''| '''PI9'''| '''265spidev.dtbo'''
|-
| '''25640pin - spi1 cs0 cs1'''| '''PI0'''| style="textsun50i-h616-spi1-cs0-cs1-align: left;"|| '''29'''|| ''spidev.dtbo'30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271设Set USB0 to Host mode'''| '''PI15'''| style="textsun50i-h616-usb0-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267host.dtbo'''
|-
| '''268Turn off the green LED light'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34''sun50i-h616-zero2w-disable-led.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258How to close the UART0 debugging serial port'''| '''PI2sun50i-h616-disable-uart0.dtbo'''| }</ol><ol start="5" style="textlist-alignstyle-type: leftdecimal;"|>| <li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''35'''|| '''36FDTOVERLAYS.'''For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PC12'''| '''76'''
|-
| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text[orangepi@orangepi-align: left;"|| pc ~]$ '''PI4sudo vim /boot/extlinux/extlinux.conf'''| '''260'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''|}</ol><ol start="36" style="list-style-type: decimal;"><li>First open wiringOP APP on After setting, you need to restart the desktopsystem for the configuration to take effect.</li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''sudo reboot'''|}</ol><span id="how-to-install-software"></span>
<ol startspan id="5" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>The i2c test interface of wiringOP is shown in the figure below</li></olspan>
<ol startspan id="6" style="listsupported-styleandroid-type: decimal;versions"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li></olspan>== Supported Android versions ==
<ol startspan id="7" style="listandroid-12-tv-function-styleadaptation-type: decimal;status"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li></olspan> [[File:media/image178.png|121x103px]]== Android 12 TV function adaptation status ==
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''2Motherboard functions'''| '''5VAndroid12 TV'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264HDMI video'''| '''PI8OK'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263HDMI Audio'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269Type-C USB2.0 x 2'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
|-
| '''226WIFI'''| '''PH2OK'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1Bluetooth'''| '''257OK'''
|-
| '''227USB Camera'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261LED Light'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
|-
| '''23140pin I2C'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin SPI1'''| '''PH8OK'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''-| '''PI640pin UART'''| '''262OK'''
|-
| '''23040pin PWM'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
|-
| '''266Hardware watchdog'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265OK'''
|-
| '''256Mali GPU'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271Video codec'''| '''PI15OK'''| } {| class="wikitable" style="width:800px;text-align: leftcenter;"|-| '''3124pin Expansion board function'''|| '''32Android12 TV'''| '''PWM1'''-| '''PI11100M network port'''| '''267OK'''
|-
| '''268100M Ethernet port light'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258USB2.0 HOST x 2'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76OK'''
|-
| '''272Infrared reception'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260OK'''
|-
| style="text-align: left;"'''Headphone audio playback'''|'''OK'''| style="text-align: left;"|| '''GNDOn/off button'''| '''39OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''40OK, The default setting is the volume up and down keys.'''| style="text-align: left;"|| '''PI3TV-OUT'''| '''259OK'''
|}
<ol startspan id="2" style="listonboard-led-light-styledisplay-type: decimal;instructions"><li>First click the wiringOP icon to open wiringOP APP</li></olspan>== Onboard LED light display instructions ==
<ol startspan id="3" style="listhow-to-return-to-the-previous-interface-stylein-type: decimal;android"><li/span>Then click the '''PWM_TEST''' button on the main interface of wiringOP == How to return to enter the PWM test previous interface</li></ol>in Android ==
</div><ol startspan id="5" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li></olspan>=== Use network connection adb debugging ===
apollo-p2:/ #|}</ol start><span id="2" style="listuse-data-cable-to-connect-styleadb-type: decimal;debugging"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li></olspan>
test@test:~$ '''sudo apt-get install -y adb'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then you need to merge multiple compressed files into one, and then extract Check whether the Android source code. The command looks like this:ADB device is recognized</li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb devices'''
4c00146473c28651dd0 device
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then unzip you can log in to the compressed package of the files modified by Orange Pi Zero2wandroid system through adb shell on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb shell'''
<ol style="list-style-type: decimal;"><li><p>Enter first '''opizero2w_android12_patchesSettings''' opizero2w_android12_patches</p><p>[[File:zero2w-img306.tarpng]]</p></li><li><p>Then select '''Device Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''Display & Sound'''</p><p>[[File:zero2w-img308.png]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''HDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img312.gzpng]]</p></li></ol>
<ol startspan id="5" style="listhdmi-to-vga-display-styletest-type: decimal;1"><li/span>Then copy the files modified by Orange Pi Zero2w === HDMI to the Android source code</li></ol>VGA display test ===
[[File:zero2w-img144.png]]</ol><span idol start="compile-the-source2" style="list-codestyle-oftype: lower-android-12alpha;"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</spanli>== Compile the source code of Android 12 ==
{| class="wikitable" style="background-color:# First install ffffdc;width:800px;" |-| <big>'''When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the software packages needed HDMI to compile Android12 source codeVGA converter, VGA cable and monitor.'''</big>|}</ol><span id="wi-fi-connection-method"></span>
<ol start="2" style="list-style-type: decimal;"><li>Then select '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \Network & Internet'''</li>
[[File:zero2w-img315.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>After turning on WI-FI, you can see the searched signals under '''libssl-dev libncurses5 clang gawkAvailable networks'''.</li>
[[File:zero2w-img316.png]]</ol><ol start="25" style="list-style-type: decimal;"><li><p>Then compile After selecting the code in WI-FI you want to connect to, the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./buildpassword input interface shown below will pop up.sh config''' to set compilation options</li></ol></li></ol>
[[File:zero2w-img334.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''......Received files'''.</li>
apollo-p2:/ #
|}
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Then run Run the following command to switch back to Device mode</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''.cat /sys/devices/platform/soc@3000000/build.shsoc@3000000\:usbc0@0/usb_device''' script to start compilation.</li></ol>
apollo-p2:/ #
|}
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>After compilation The command to view the current mode of USB0 is completed, you will see the following output</li><{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/ol>otg_role'''
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz