Open main menu

Wiki-Orange Pi β

Changes

Orange Pi I96

8,350 bytes added, 15:58, 21 June 2022
no edit summary
* Download the latest source code
You could download the latest WiringPi source code from official website: <br>
[http://www.orangepi.online/ <span style="color:#0000ff;">www.orangepi.online</span>]<br>
You could also download files from github: <br>
[https://github.com/OrangePiLibra/WiringPi.git <span style="color:#0000ff;">https://github.com/OrangePiLibra/WiringPi.git</span>]
with the following command:<br>
<span style="background:#fffaa5">env GIT_SSL_NO_VERIFY=true git clone<span><br><br>
* Compile and install WiringPi
Use the following command to compile and install the WiringPi after get the latest source code. <br>
 cd WiringOP/<br>
 ./build OrangePi_I96 <br>
 ./build OrangePi_I96 install
* Test WiringPi with gpio command
You could use gpio command to test GPIO on 40pin on Orange Pi i96 with WiringPi installed.<br>
i Use "gpio readall" command to print out all WiringPi pin mapping as following.
BCM line represents the actual hardware GPIO, there are 4 Groups GPIO and each Group have 32pins, and the serial number start from Group PA. PA0 corresponds to BCM colum number 0.<br>
wPi line represents pins of wiringPi, you could use this group of data when use C library and gpio command on wiringPi. For example, number 37 pin is corresponding to number 25 pin of wiringPi, you could operate the 37 via operating 25pin.<br>
Name line represents the definition name of Pin.<br>
Mode line represents the mode of pin, it could but both input and output.<br>
V line represents the voltage value of the current pin.<br>
Physical line represents the actual hardware number.
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img32.png|800px]]</div>
<br>
ii Use "gpio export pin mode" to explore wiringPi GPIO to the directory of /sys/class/gpio and set the GPIO mode into mode. <br>
According to the above WiringPi pin mapping, hardware pin number 29 is corresponding to WiringPi pin number GPIO 25, explore the number 25 and set it into output mode.<br>
iii Use "gpio unexport pin" to cancel explore pin to /sys/class/gpio. For example:<br>
 orangepi# gpio unexport 26<br>
iv Use "gpio exports" to check the current explored gpio. For expample:<br>
 orangepi# gpio exports<br>
v Use "gpio mode pin mode" command to configure wiringPi pin mode. For example:<br>
 Configure pin wiringPi 24 as output mode orangepi# gpio mode 24 out<br>
 Configure pin wiringPi 26 as input mode orangepi# gpio mode 26 in<br>
vi.Use "gpio write pin value" to write value of output mode pin, for example:<br>
 Configure pin wiringPi 26 as output pin:orangepi# gpio mode 26 out<br>
 Write 0 on wiringPi 26 orangepi# gpio write 26 0<br>
 Write 1 wiringPi 26 orangepi# gpio write 26 1<br>
vii.Use "gpio read pin" command to read the value of input mode pin, for example:<br>
 Configure pin wiringPi 26 as input pin orangepi# gpio mode 26 in<br>
 read the value from wiringPi 26 orangepi# gpio read 26
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img33.png|800px]]</div>
<br>
If you want to learn more "gpio" command, you could refer to "gpio -h" obtain.<br>
<br>
* Use WiringPi C Library
 WiringPi support C library and python library, you could use C language to operation GPIO port, the example source code is on the directory of /example/OrangePi/.
Here is an example for C library usage on GPIO:<br>
<br>
 Complie GPIO LED
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img34.png|800px]]</div>
<br>
Usage of C library on wiringPi: <br>
<br>
In order to use wiringPi C library, first you need to import file of "wiringPi.h". You need to initialize wiringPi before using GPIO with function wiringPiSetup(). And then you could configure pin mode into INPUT or OUTPUT. And please note that the pin number should corresponding to wiringPi. Finally you could use function digitalWrite() and digitalRead() to read and write. <br>
<br>
== '''Source Code Compilation of Android and Linux ''' ==
<br>
Hardware: Orange Pi development board*1, Card reader*1, TF card*1, power supply*1
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img35.png|800px]]</div>
<br>
 Software: Linux host computer, which hard disk space at least 50G (to meet a fully compiled need)<br>
 Linux host computer needs:<br>
 Version 2.7.3 of Python;<br>
 Version 3.81-3.82 of GNU Make;<br>
 JDK1.6;<br>
 Version 1.7 or higher version of Git.<br>
<br>
'''Install JDK'''<br>
<br>
* Download and unzip JDK, you will get jdk-6u31-linux-x64.bin, copy it to the directory of /opt
* Modify the permission of jdk-6u31-linux-x64.bin with following command:<br>
 sudo chmod 755 jdk-6u31-linux-x64.bin
* Install jdk1.6<br>
 /jdk-6u31-linux-x64.bin
* Configuration multi Java version coexistence mode with the following command:<br>
 sudo update-alternatives --install /user/bin/java java /opt/jdk1.6.0_31/bin/java 300 <br>
 sudo update-alternatives --install /user/bin/javap javap /opt/jdk1.6.0_31/bin/javap 300<br>
 sudo update-alternatives --install /user/bin/javac javac /opt/jdk1.6.0_31/bin/javac 300<br>
 sudo update-alternatives --install /user/bin/jar jar /opt/jdk1.6.0_31/bin/jar 300<br>
 sudo update-alternatives --install /user/bin/javaws javaws /opt/jdk1.6.0_31/bin/javaws 300<br>
 sudo update-alternatives --install /user/bin/javapdoc javadoc /opt/jdk1.6.0_31/bin/javadoc 300<br>
<br>
* Switch to java version and select version 1.6, use the following command:<br>
 sudo update-alternatives --config java<br>
 sudo update-alternatives --config javac<br>
 sudo update-alternatives --config jar<br>
 sudo update-alternatives --config javap<br>
 sudo update-alternatives --config javaws<br>
 sudo update-alternatives --config javadoc<br>
* After confirmed it is version 1.6, you could use the following command:
java -version
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img36.png|800px]]</div>
<br>
=== '''Install Platform Supported Software''' ===
<br>
 $ sudo apt-get install git gnupg flex bison gperf build-essential \<br>
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \<br>
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \<br>
libgl1-mesa-dev g++-multilib mingw32 tofrodos \<br>
python-markdown libxml2-utils xsltproc zlib1g-dev:i386<br>
 $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1/usr/lib/i386-linux-gnu/libGL.so<br>
<br>
=== '''Download the Source Package and Unzip it''' ===
<br>
Download website: http://www.orangepi.online/downloadresources/<br>
Downloaded source package and use the following command:<br>
 $cat OrangePi_2G-IOT* > tar.tar.gz<br>
 $ tar –xvzf tar.tar.gz<br>
<br>
Unzip the file you will get the trunk directory, enter it via the terminal.<br>
<br>
=== '''Android source code compiler''' ===
<br>
 Before compiling Android source code, please make sure you have already installed JAVA 1.6 version, if not, please refer to previous charter to install first. After you install jave 1.6 successfully, you could begin to compile Android source code.<br>
* Select source code:
 Use command to switch to Android source code:<br>
  cd */trunk/<br>
* Import development variables
  $ source build/envsetup.sh
Select project
  $ lunch<br>
If boot from TF card, select slt-userdebug, then select NollecA9V2VV8810P_ext4<br>
If boot from Nand, select etu-userdebug, then select NollecA9V2VV8810P<br>
<br>
* Compile system
 $ make –j
* Update image if boot from TF card
After compile Android source code for booting from TF card, you will get a new image on the directory of:<br>
  */trunk/out/target/product/slt**/<br>
And use the following commands to update it:<br>
sudo dd if=bootloader.img of=/dev/sdc bs=512 seek=256 count=4096 && sync <br>
sudo dd if=modem.img of=/dev/sdc bs=512 seek=12544 count=8192 && sync<br>
sudo dd if=boot.img of=/dev/sdc bs=512 seek=20736 count=16384 && sync<br>
sudo dd if=recovery.img of=/dev/sdc bs=512 seek=37120 count=20480 && sync<br>
sudo dd if=system.ext4.img of=/dev/sdc bs=512 seek=57600 count=512000 && sync<br>
sudo dd if=vendor.ext4.img of=/dev/sdc bs=512 seek=569600 count=512000 && sync<br>
  /dev/sdc is the mounted number on system of SD card.
* Nand update
There will be corespondent image on the directory of */trunk/out/target/product/etu**/ after compilation. Update the image into system with NAND update tool. About the details steps you could refer to How to update Android Nand in the manual.