Changes

Jump to: navigation, search

Orange Pi 2G-IoT

41,358 bytes added, 10:38, 1 July 2022
no edit summary
 It’s an open-source single-board computer. It can run Android 4.4, Ubuntu, Debian, Raspberry Pi image. It uses the RDA8810 Soc, and has 256MB LPDDR2 SDRAM.<br>
<br>
=== '''What can I do with Orange Pi 2G-IoT?''' ===
<br>
You can use it to build... 
{| class="wikitable" style="width:800px;background:#ffffff;"
|-
| colspan=2|| <span style="font-weight:700;">Hardware specification</span>
|-
| CPU || ARM Cortex-A5 32bit
| Supported OS|| Android, Ubuntu, Debian, Rasbian
|-
| cospan=2|| <span style="font-weight:700;">Interface definition</span>
|-
| Product size|| 67mm × 42mm
| Weight|| 35g
|-
| colspan=2|| Orange Pi™ is a trademark of the Shenzhen Xunlong Software CO., Limited
|}
<br>
<div>[[File:Orange-pi-2g-iot-img4.png|500px|]]</div>
<br>
 
=== '''GPIO Specifications''' ===
<br>
 The CSI Camera Connector is a 24-pin FPC connector which can connect external camera module with proper signal pin mappings. The pin of CIS connector can be defined as follows. The connector marked with "CON 1" on the Orange Pi 2G-IOT IoT is camera connector.<br>
<br>
<div>[[File:Orange-pi-i96-img3.png|500px800px|]]</div>
<br>
'''OrangePi 2G-IOTIoT-CSI'''
<br>
<table style="min-width: 800px;text-align: center;" border="1" bordercolor="#d8d8d8" cellspacing="0"
</table>
<br>
 
== '''Using Method''' ==
<br>
|}
<br>
<div style="width:800px;display:flex;padding-left:200px;align-items:center;">
<div style="text-align:center;">
[[File:Orange-pi-i96-img4.png|200px]]
v.Click the "Format"button.
</div>
<br>c.Download the operating system image file from the download page, the page address is as follows:<br> http://www.orangepi.cnorg/html/hardWare/computerAndMicrocontrollers/downloadresourcescnservice-and-support/Orange-Pi-2G-IoT.html<br>
d.Unzip the downloaded file (in addition to the Android system, this method can be used to burn to write, the Android system need another burn, the following will introduce).<br>
e.Right click the downloaded file, select "Unzip file" to write image to TF card.
</div>
c.Download the image OS from download page: <br>
http://www.orangepi.cnorg/`downloadresourcescnhtml/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-2G-IoT.html<br>
d.Unzip the downloaded file and right click it, select " Unzip file"<br>
e.Write image into TF card
<br>
* Insert the TF card with written image into the TF card slot
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img5.png|400px]]</div>
<br>
* Make sure the toggle switch is showing like the following, booting from SD card.
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img6.png|400px]]</div>
<br>
* Insert the keyboard or mouse into the USB port.
* Connect wifi antenna and base-band antenna
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img7.png|400px]]</div>
<br>
* Connect LCD and Camera
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img8.png|400px]]</div>
<br>
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img9.png|400px]]</div>
<br>
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img10.png|400px]]</div>
<br>
* Connect TTL cable, you could refer to the Debug method in this instruction.
Serial port uses TTL to USB cable to connect.<br>
<br>
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img11.png|400px]]</div>
<br>
* It is the power input interface on the right side for connecting a 5V and at least 2A or bigger than 2A power adapter. Avoid using smaller power GSM mobile phone charger, it is not able to output 2A even if it marked "5V/2A".
<div style="padding-left:100px; ">[[File:Orange-pi-2g-iot-img12.png|400px]]</div>
<br>
 If the above steps are successful, the OrangePi will start in a few minutes. The monitor Graphical interface of display system. It may take a long time to start the first time, please wait patiently. The next time will boot very fast.<br>
=== '''Initialize settings for your Linux system''' ===
<br>
 You need to make some basic settings when it is you first time to use Linux on Orange Pi 2G-IOTIoT, like wifi setting, audio setting, user setting. <br>
<br>
'''1)Wifi setting on serial port'''<br>
<br>
 You need to use two cellphones if you want to use this function. Please refer to this: <br>
 Orange Pi 2G-IOT IoT is defaulted to connect the hotspot of orangepi, the password is orangepi. Use another cellphone’s hotspot function, setting the hot spot name as orangepi, password as orangepi. It will connect to orangepi hotspot default after booting the system. After that, use another cellphone to connect the hotspot, and use “wifi assistant” to check the IP of Orange Pi 2G-IOTIoT.<br> After getting the IP of Orange Pi 2G-IOTIoT, you could use SSH remote login in Linux PC or Windows PC. Command as following: <br>
 ssh orangepi@192.168.xxx.xxx<br>
 Password: orangepi<br>
=== '''Write Android into Nand''' ===
<br>
 Orange Pi 2G-IOT IoT is supported boot from Nand, and also supported update Android in Nand.<br>
<br>
'''1)Boot Android from NAND'''<br>
<br>
 Switching the boot mode into NAND via short jumper cap.
<div style="padding-left:200px;">[[File:Orange-pi-2g-iot-img13.png|400px]]</div>
<br>
 Power it on, Orange Pi 2G-IOT IoT will boot from NAND.<br>
<br>
'''2)Update Android in NAND'''<br>
* Short jumper cap to switch the system to boot from NAND, set toggle switch into 1234 UP, 5678 Down like the following:<br>
<br>
<div style="padding-left:200px;">[[File:Orange-pi-2g-iot-img14.png|400px]]</div>
<br>
'''3)Install writing tool on Windows '''<br>
<br>
 For now Nand writing tool could only support working on Windows, you could download the tool from official website: <br>http://www.orangepi.org/downloadresourceshtml/hardWare/computerAndMicrocontrollers/service-and-support/ Orange-Pi-2G-IoT.html <div>[[File:Orange-pi-i962g-iot-img18img66.png|800px]]</div>
<br>
'''4)Install USB driver on Windows'''
<br>
 Unzip the tool file, install the USB driver, here is the path: <br>*http:/OrangePi_2G/www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-IOT_Toolschainand-support/USB_Driver/USBOrange-Pi-2G-IoT.html<br><div>[[File:Orange-pi-2g-iot-driverimg67.png|800px]]</div><br>
 You should install it according to your PC, if your PC is 32bit, then install x86 USB driver, if it is 64bit, then is x64 USB driver.<br>
<br>
'''5)Download Android Nand image'''<br> Here is the ink for Orange Pi 2G-IOT IoT Nand version image:<br> httphttp://www.orangepi.org/downloadresourceshtml/hardWare/computerAndMicrocontrollers/ service-and-support/Orange-Pi-2G-IoT.html<br> <div>[[File:Orange-pi-i962g-iot-img19img66.png|800px]]</div>
<br>
'''6)Use writing tool'''<br>
<br>
Use writing tool to write NAND:<br>*http://www.orangepi.org/html/OrangePi_2GhardWare/computerAndMicrocontrollers/service-and-IOT_Toolschainsupport/OrangePi_2GOrange-Pi-IOT_NandUpdate_Tools/OrangePi_2G2G-IOT_Update.exeIoT.html<div style="padding-left:200px;">[[File:Orange-pi-i96-img20.png|600px]]</div>
<br>
 Click “load BIN” to import the image of NAND version into writing tool. After that, click Download button to download the image. Meanwhile, the tool is waiting for the download link of Orange Pi 2G-IOTIoT.<br>
<br>
'''7)Download Image'''<br>
<br>
 Prepare an Android USB to DC cable, first connect to the OTG port of Orange Pi 2G-IOTIoT, then push on the power button for 5s, and connect the cable to the Windows PC. Meanwhile, the screen will indicate that connect successful and downloading. It will take around 3min to finished downloaded, after that, reboot the system and then the system will run on the update Android.<br>
 Note: If it could not download, please check the the shorting cap and switch.
<div style="padding-left:200px;">[[File:Orange-pi-i96-img21.png|600px]]</div>
<br>
<br>
* ADB setting: Set the toggle switch into 1234 “UP”, 5678 “Down”, the system will switch into adb model, in this model, the USB is unable.
<div style="padding-left:200px;">[[File:Orange-pi-2g-iot-img16.png|600px]]</div>
<br>
* Connect to the OTG port of Oragne Pi 2G-IOT IoT with the USB to DC cable, the other side connect to PC, push the power button and then the system will be Android.
* If the PC haven’t set on adb, then please refer to the teaching method of Ubuntu and Windows adb in internet. Use adb command in the PC terminal to connect the adb:adb shell
* After connect to OrangePi 2G-IOT IoT via adb, you could refer to the adb debug method from the internet to enter into Orange Pi 2G-IOTIoT
We would recommend you use Plug-in Vysor in Chrome browser, this tool could enter Android via adb:
<div style="padding-left:200px;">[[File:Orange-pi-i96-img23.png|600px]]</div>
<br>
<div style="padding-left:200px;">[[File:Orange-pi-i96-img24.png|400px]]</div>
<br>
b.$ usermod -l zhangsan orangepi <br>
Change account of orangepi into Zhangsan
<div style="padding-left:100px; ">[[File:Orange-pi-i96-img25.png|600px]]</div>
<br>
c.$ groupmod -n zhangsan orangepi <br>   
=== '''Usage of GPIO and WiringPi''' ===
<br>
'''1)Use WiringPi on OrangePi 2G-IoT to connect network'''<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img17.png|600px]]</div>
<br>
OrangePi 2G-IoT could support WiringPi, you could have a try according to the introduction on this section. The following is 40 Pin of OrangePi. <br>
<br>
a.Download the latest WiringPi source code of Orange Pi 2G-IoT<br>
Please confirm that the Orange Pi 2G-IoT has connect to wifi or network successfully, if no, then you need to first make it connect to wifi or network. If you connect to network, then you also need to install some essential tools:<br>
<div style="padding-left:40px;"><span style="background:#fffaa5;">sudo apt-get install git gcc make</span></div>
b.Download the latest source code <br>
You could download the latest WiringPi source code from official website:<br>
http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-2G-IoT.html<br>
<br>
You could also download files from github: <br>
https://github.com/OrangePiLibra/WiringPi.git with the following command:<br>
<span style="background:#fffaa5;">env GIT_SSL_NO_VERIFY=true git clone</span><br>
c.Compile and install WiringPi<br>
Use the following command to compile and install the WiringPi after get the latest source code. <br>
cd WiringOP/<br>
./build OrangePi_2G-IoT <br>
./build OrangePi_2G-IoT install<br>
d.Test WiringPi with gpio command<br>
You could use gpio command to test GPIO on 40pin on Orange Pi 2G-IoT 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.<br>
<br>
<div style=" ">[[File:Orange-pi-i96-img32.png|600px]]</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 37 is corresponding to WiringPi pin number GPIO 25, explore the number 25 and set it into output mode.<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img18.png|600px]]</div>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img19.png|600px]]</div>
<br>
iii Use "gpio unexport pin" to cancel explore pin to /sys/class/gpio. For example:
orangepi# gpio unexport 25<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img20.png|600px]]</div>
<br>
iv Use "gpio exports" to check the current explored gpio. For expample:
orangepi# gpio exports<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img21.png|600px]]</div>
<br>
v Use "gpio mode pin mode" command to configure wiringPi pin mode. For example:<br>
Configure pin wiringPi 25 as output mode<br>
orangepi# gpio mode 25 out<br>
Configure pin wiringPi 26 as input mode<br>
orangepi# gpio mode 26 in<br>
<br>
vi.Use "gpio write pin value" to write value of output mode pin, for example:<br>
Configure pin wiringPi 25 as output pin:<br>
orangepi# gpio mode 25 out<br>
Write 0 on wiringPi 25 <br>
orangepi# gpio write 25 0<br>
Write 1 wiringPi 25<br>
orangepi# gpio write 25 1<br>
<br>
vii.Use "gpio read pin" command to read the value of input mode pin, for example:<br>
Configure pin wiringPi 25 as input pin<br>
orangepi# gpio mode 25 in<br>
read the value from wiringPi 25<br>
orangepi# gpio read 25<br>
<br>
<div style=" ">[[File:Orange-pi-i96-img33.png|600px]]</div>
<br>
viii.If you want to learn more "gpio" command, you could refer to "gpio -h" obtain.<br>
<br>
e.Use WiringPi C Library<br>
<br>
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/. <br>
Here is an example for C library usage on GPIO:<br>
Complie GPIO LED<br>
<br>
<div style=" ">[[File:Orange-pi-i96-img34.png|600px]]</div>
<br>
Usage of C library on wiringPi:<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>
 
=== '''Connect to Network via GSM''' ===
<br>
1)Use 2G-IoT to send message<br>
<br>
For now the version of Ubuntu,Debian and Raspbian could support SMS sending message. Before using the SMS function, please make sure the SIM card you use is active.<br>
<br>
i.Prepare <br>
<br>
First you need to prepare an activated Micro SIM card and insert into Orange Pi 2G-IoT, the Orange PI 2G-IoT could support the following frequency:<br>
Frequency Range: 850,900,1800,1900 <br>
Standard: GSM800<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img23.png|600px]]</div>
<br>
ii.Install SIM card<br>
<br>
Please note the direction of when inserting SIM card. <br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img25.png|600px]]</div>
<br>
iii.Login Linux system<br>
<br>
After inserting SIM card, power on and enter into Linux system. You could login the system via serial port or SSH. If you are going to use serial port to login, please be remember to set the baud rate into 921600.<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img26.png|600px]]</div>
<br>
iv.SMS Usage<br>
<br>
There are many ways to use SMS, here will introduce the way with serial port and C language.<br>
<br>
a.With Serial Port<br>
<br>
You need to install the tool of minicom on Orange Pi 2G-IoT before using SMS. Please make sure the board has already connect to wifi.<br>
You could install minicom with the following command:<br>
<div style="padding-left:40px;"><span style="background:#fffaa5;">sudo apt-get install minico</span></div>
<br>
The AP core and Modem will communicate via serial port. There will be a modem0 node after booting into Linux system. You could use serial port tool to connect to the /dev/modem0 node, which we recommend you use minicom, you could also try other tools.<br>
If you are using the minicom or other tools on serial port, please refer to the following:
You could configure with the following command to connect /dev/modem0:<br>
<div style="padding-left:40px;"><span style="background:#fffaa5;">sudo minicmo -s</span></div>
<br>
After input the command, you will enter the configure interface, select "'''Serial port setup'''"<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img27.png|600px]]</div>
<br>
Push A to modify Serial Device into /'''dev/modem0'''<br>
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img28.png|600px]]</div>
<br>
'''Use AT command to send message'''<br>
<br>
First you need to input AT command to check the situation of Modem, if Modem replies OK, then means Modem is connect correctly.<br>
<br>
<div>[[File:Orange-pi-2g-iot-img29.png|600px]]</div>
<br>
Input command of AT +cfun=1 to open Modem full function<br>
<br>
<div>[[File:Orange-pi-2g-iot-img30.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img31.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img32.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img33.png|600px]]</div>
<br>
Initialize serial port:<br>
<br>
<div>[[File:Orange-pi-2g-iot-img34.png|600px]]</div>
<br>
Send AT command function<br>
<br>
<div>[[File:Orange-pi-2g-iot-img35.png|600px]]</div>
<br>
AT send message<br>
<br>
<div>[[File:Orange-pi-2g-iot-img36.png|600px]]</div>
<br>
Detail steps you could refer to the following: “'''OrangePi_2G_IoT_GSM_Demo.c'''”<br>
Here is the reflect of running C:<br>
<br>
<div>[[File:Orange-pi-2g-iot-img37.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img41.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img38.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img42.png|600px]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img39.png|600px]]</div>
<br>
Finally you will receive the message from OrangePi 2G-IoT<br>
<br>
<div>[[File:Orange-pi-2g-iot-img40.png|300px]]</div>
<br>
* OrangePi_2G_IoT_GSM_Demo.c
<br>
<div style="background:#fbfaf8;padding:20px;">
<nowiki>/*</nowiki><br>
<nowiki>* OrangePi 2G-IoT GSM Demo</nowiki><br>
<nowiki>*  (C) Copyright 2017 OrangePi</nowiki><br>
<nowiki>*/</nowiki><br>
<nowiki>#include <stdio.h></nowiki><br>
<nowiki>#include <stdlib.h></nowiki><br>
<nowiki>#include <unistd.h></nowiki><br>
<nowiki>#include <fcntl.h></nowiki><br>
<nowiki>#include <string.h></nowiki><br>
<nowiki>#include <termios.h></nowiki><br>
<nowiki>#include <sys/types.h></nowiki><br>
<nowiki>#include <sys/stat.h></nowiki><br>
<br>
<nowiki>#define NR_CITY  30</nowiki><br>
<nowiki>#define MODEM_PATH  "/dev/modem0"</nowiki><br>
<nowiki>#define VERSION     "0.1.0"</nowiki><br>
<br>
struct Centry_number {<br>
    char *city;<br>
    char *number;<br>
} City_Number[NR_CITY] = {<br>
    { "ShenZhen",           "13010888500" },<br>
    { "Beijing",            "13010112500" },<br>
    { "Shanghai",           "13010314500" },<br>
    { "Shandong",           "13010171500" },<br>
    { "Jiangsu" ,           "13010341500" },<br>
    { "Zhejiang",           "13010360500" },<br>
    { "Fujian",             "13010380500" },<br>
    { "Sichuan",            "13010811500" },<br>
    { "Chongqing",          "13010831500" },<br>
    { "Hainan" ,            "13010501500" },<br>
    { "Heilongjiang",       "13010980500" },<br>
    { "Jilin",              "13010911500" },<br>
    { "Tianjin",            "13010130500" },<br>
    { "Hebei",              "13010180500" },<br>
    { "Inner Mongolia",     "13010950500" },<br>
    { "Shanxi",             "13010701500" },<br>
    { "Anhui",              "13010305500" },<br>
    { "Xinjiang",           "13010969500" },<br>
    { "Qinghai",            "13010776500" },<br>
    { "Gansu",              "13010879500" },<br>
    { "Ningxia",            "13010796500" },<br>
    { "Guizhou",            "13010788500" },<br>
    { "Yunnan",             "13010868500" },<br>
    { "Hunan",              "13010731500" },<br>
    { "Hubei",              "13010710500" },<br>
    { "Guangdong",          "13010200500" },<br>
    { "Guangxi",            "13010591500" },<br>
    { "Henan",              "13010761500" },<br>
    { "Jiangxi",            "13010720500" },<br>
    { "Liaoning",           "13010240500"},<br>
};<br>
<br>
<nowiki>/*</nowiki><br>
<nowiki>*</nowiki>Initialize serial<br>
<nowiki>*/</nowiki><br>
void serial_init(int fd)<br>
{<br>
    struct termios options;<br>
<br>
    tcgetattr(fd, &options);<br>
    options.c_cflag |= (CLOCAL | CREAD);<br>
    options.c_cflag &= ~CSIZE;<br>
    options.c_cflag &= ~CRTSCTS;<br>
    options.c_cflag |= CS8;<br>
    options.c_cflag &= ~CSTOPB;<br>
    options.c_iflag |= IGNPAR;<br>
    options.c_oflag = 0;<br>
    options.c_lflag = 0;<br>
    cfsetispeed(&options, B9600);<br>
    cfsetospeed(&options, B9600);<br>
    tcsetattr(fd, TCSANOW, &options);<br>
}<br>
<br>
void display_message(int direction, const char *message)<br>
{<br>
    if (direction) {<br>
        printf("Send Message ------> %s\n", MODEM_PATH);<br>
        printf(">> %s\n", message);<br>
    } else {<br>
        printf("Rece Message <------ %s\n", MODEM_PATH);<br>
        printf("<< %s\n", message);<br>
    }<br>
}<br>
<br>
void Send_AT(int fd, const char *str1, const char *str2, const char *str3)<br>
{<br>
    char buff[128];<br>
    char answer[128];<br>
<br>
    memset(buff, 0, sizeof(buff));<br>
    if (str1 != NULL)<br>
        strcpy(buff, str1);<br>
    if (str2 != NULL)<br>
        strcat(buff, str2);<br>
    if (str3 != NULL)<br>
        strcat(buff, str3);<br>
    write(fd, buff, strlen(buff));<br>
    display_message(1, buff);<br>
<br>
    memset(answer, 0, sizeof(answer));<br>
    sleep(1);<br>
    read(fd, answer, sizeof(answer));<br>
    display_message(0, answer);<br>
<br>
}<br>
<br>
int send(int fd, char *cmgf, char *cmgs, char *csca, char *message)<br>
{<br>
    /* AT Test */<br>
    Send_AT(fd, "AT\r", NULL, NULL);<br>
    /* Set Modem Full Function */<br>
    Send_AT(fd, "AT +CFUN=", "1", "\r");<br>
    /* Set CMGF */<br>
    Send_AT(fd, "AT +CMGF=", cmgf, "\r");<br>
    /* Set Message Centr Number */<br>
    Send_AT(fd, "AT +CSCA=", csca, "\r");<br>
    /* Set Receive Number */<br>
    Send_AT(fd, "AT +CMGS=", cmgs, "\r");<br>
    /* Send Message */<br>
    Send_AT(fd, message, NULL, NULL);<br>
}<br>
<br>
int Send_Message(int fd)<br>
{<br>
    char buff[128];<br>
    char num1[64];<br>
    char num2[64];<br>
    int i;<br>
    int choice;<br>
<br>
    printf("********* City Select **********\n");<br>
    for (i = 0; i < NR_CITY; i++)<br>
        printf("[%2d] %s\n", i, City_Number[i].city);<br>
    printf("Please select your City!\n");<br>
    scanf("%d", &choice);<br>
    do {<br>
        memset(num1, 0, sizeof(num1));<br>
        printf("\nPlease Entry Receive phone number:\n");<br>
        scanf("%s", num1);<br>
    } while (strlen(num1) != 11);<br>
<br>
    sleep(1);<br>
    memset(buff, 0, sizeof(buff));<br>
    printf("Please input Meesage:\n");<br>
    scanf("%s", buff);<br>
<br>
    /* Restruct buff */<br>
    i = strlen(buff);<br>
    buff[i] = 0x1A;<br>
    buff[i+1] = '\r';<br>
    buff[i+2] = '\0';<br>
<br>
    memset(num2, 0, sizeof(num2));<br>
    strcpy(num2, "+86");<br>
    strcat(num2, num1);<br>
<br>
    memset(num1, 0, sizeof(num1));<br>
    strcpy(num1, "+86");<br>
    strcat(num1, City_Number[choice].number);<br>
<br>
    send(fd, "1", num2, num1, buff);<br>
}<br>
<br>
<nowiki>/*</nowiki><br>
<nowiki>*</nowiki> Call Phone.<br>
<nowiki>*/</nowiki><br>
void Call_Phone(int fd)<br>
{<br>
    char buff[128];<br>
    char number[20];<br>
<br>
    do {<br>
        memset(number, 0, sizeof(number));<br>
        printf("\nPlease input phone number:");<br>
        scanf("%s", number);<br>
    } while (strlen(number) != 11);<br>
<br>
    memset(buff, 0, sizeof(buff));<br>
    strcpy(buff, "+86");<br>
    strcat(buff, number);<br>
    strcat(buff, ";");<br>
<br>
    /* AT Test */<br>
    Send_AT(fd, "AT\r", NULL, NULL);<br>
    /* Call */<br>
    Send_AT(fd, "AT", " DT ", buff);<br>
}<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
    int fd;<br>
    char choice;<br>
<br>
    fd = open(MODEM_PATH, O_RDWR | O_NOCTTY | O_NDELAY);<br>
    if (fd < 0) {<br>
        printf("Can't open %s\n", MODEM_PATH);<br>
        return -1;<br>
    }<br>
<br>
    /* Initialize /dev/modem0 */<br>
    serial_init(fd);<br>
<br>
    printf("********************\n");<br>
    printf("\tWelcome to OrangePi 2G-IoT\n");<br>
    printf("\tModem version %s\n", VERSION);<br>
    printf("********************\n");<br>
    printf("Entry your select:\n");<br>
    printf("1. Send Message\n");<br>
    printf("2. Call Phone\n");<br>
    printf("3. Exit\n");<br>
    choice = getchar();<br>
<br>
    switch (choice) {<br>
    case '1':<br>
            Send_Message(fd);<br>
            break;<br>
    case '2':<br>
            Call_Phone(fd);<br>
            break;<br>
    default:<br>
            break;<br>
<br>
    }<br>
    close(fd);<br>
<br>
    return 0;<br>
}<br>
</div>
<br>
The open source project WiringPi is working on OrangePi 2G-IoT. This section will introduce how to utilize WiringPi on OrangePi 2G-IoT. The following is definition of 40pin.<br>
<br>
<div>[[File:Orange-pi-2g-iot-img17.png|500px|]]</div>
<br>
<div>[[File:Orange-pi-i96-img32.png|500px|]]</div>
<br>
Usage:<br>
<br>
1)Download WiringPi image of OrangePi 2G-IoT<br>
<br>
env GIT_SSL_NO_VERIFY=true git clone https://github.com/OrangePiLibra/WiringPi.git<br>
<br>
2)Compile and install WiringPi<br>
<br>
cd WiringPi<br>
sudo ./build OrangePi_2G-IoT<br>
sudo ./build install<br>
<br>
3)Utilze WiringPi <br>
<br>  
cd WiringPi/example/OrangePi<br>
make OrangePi<br>
./OrangePi<br>
<br>
4)Details GPIO infromation<br>
<br>
cd  WiringPi/example/OrangePi<br>
cat README.md<br>
<br>
Reality Test<br>
OrangePi 2G-IoT contains GPIOA, GPIOB, GPIOC and GPIOD. Each of group has 32 gpio. The type of GPIO is "Input", "Output" and "specify function" such as "I2C", "I2S" and so on. On board, OrangePi 2G-IoT exports 40 pins as different function. User can utilize these, GPIO on different application scenarios. For example, User can configure the type of GPIO as "Input", and get current voltage from program. Another hand, User can configure GPIO as specify function, such as "Uart", "I2C" and "SPI".<br>
<br>
<div>[[File:Orange-pi-2g-iot-img54.png|500px|]]</div>
<br>
Please note that: On OrangePi 2G-IoT, GPIOA, GPIOB and GPIOD tract as general GPIO, but GPIOC as non-general GPIO. Because of some hardware design. The host of GPIOC is modem not CPU. So, If CPU wanna control GPIOC, it must send message to Modem, and Moden get message and control GPIOC, it's not good news. In other words. on version 0.1, GPIOC only support "OUTPUT" mode. <br>
The size of GPIOx group is 32, so we can get gpio map:<br>
GPIOA: 0   -  31<br>
GPIOB: 32  -  63<br>
GPIOC: 64  -  95<br>
GPIOD: 96  -  127<br>
Each gpio have a unique ID, and the way of caculate as follow:<br>
GPIO_A_x:   ID = 0   + x<br>
GPIO_B_x:   ID = 32  + x<br>
GPIO_C_x:   ID = 64  + x<br>
GPIO_D_x:   ID = 96  + x<br>
<br>
1)Set gpio as Input mode<br>
<br>
As General GPIO, we only offer the number of GPIOx. then, use library of wiringPi, User can easily to control GPIO. GPIOC can not support "Input" mode.<br>
<br>    
<nowiki>#include <wiringPi.h></nowiki><br>
<nowiki>/*</nowiki> Defind unique ID <nowiki>*/</nowiki><br>
<nowiki>#define PA1         1</nowiki><br>
<nowiki>#define PB5         37</nowiki><br>
<nowiki>#define PD2         98</nowiki><br>
int main(void)<br>
 {<br>
unsigned int vol;<br>
<br>
<nowiki>/*</nowiki> Setup wiringPi <nowiki>*/</nowiki><br>
 wiringPiSetup();<br>
<br>
<nowiki>/*</nowiki> Set Input Mode <nowiki>*/</nowiki><br>
pinMode(PA1, INPUT);<br>
pinMode(PB5, INPUT);<br>
pinMode(PD2, INPUT);<br>
<br>
<nowiki>/*</nowiki> Get value from GPIO <nowiki>*/</nowiki><br>
vol = digitalRead(PA1);<br>
vol = digitalRead(PB5);<br>
vol = digitalRead(PD2);<br>
<br>
return 0;<br>
}<br>
<div>[[File:Orange-pi-2g-iot-img55.png|500px|]]</div>
<br>
2)Set gpio as "OUTPUT" mode<br>
<br>
All GPIO support "OUTPUT" mode. The demo code as follow:<br>
<br>
<nowiki>#</nowiki>include <wiringPi.h><br>
<nowiki>/*</nowiki> Defind unique ID <nowiki>*/</nowiki><br>
<nowiki>#</nowiki>define PA1        1<br>
<nowiki>#</nowiki>define PB5        37<br>
<nowiki>#</nowiki>define PC27       91<br>
<nowiki>#</nowiki>defien PD2        98<br>
int main(void)<br>
{<br>
<nowiki>/*</nowiki> Setup wiringPi <nowiki>*/</nowiki><br>
iringPiSetup();<br>
<nowiki>/*</nowiki> Set GPIO Mode <nowiki>*/</nowiki><br>
pinMode(PA1,  OUTPUT);<br>
pinMode(PB5,  OUTPUT);<br>
pinMode(PC27, OUTPUT);<br>
 pinMode(PD2,  OUTPUT);<br>
<br>
digitalWrite(PA1,  HIGH);<br>
digitalWrite(PB5,  LOW);<br>
digitalWrite(PC27, HIGH);<br>
digitalWrite(PD2,  LOW);<br>
<br>
return 0;<br>
}<br>
<div>[[File:Orange-pi-2g-iot-img56.png|500px|]]</div>
<br>
 
=== '''Use GSM to Connect Network''' ===
<br>
Orange Pi 2G-IoT Linux Dist has debugged to connect network via GSM. You could first download Linux Dist from official website, Debian, Ubuntu and Raspbian could support GSM function.<br>
First you need to prepare an activated Micro SIM card, the Orange PI 2G-IoT could support the following frequency:<br>
Frequency Range: 850,900,1800,1900 <br>
Standard: GSM800<br>
The phone card we used is launched by China Unicom and Alibaba Group.<br>
<br>
<div>[[File:Orange-pi-2g-iot-img57.png|500px|]]</div>
<br>
Download Linux Dist from official website:<br>
http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-2G-IoT.html<br>
<br>
Download and write image into SD card, then insert SD card and SIM card into the board.
You could login the system via serial port and SSH. If via serial port, please remember to set the baud rate into 921600.
<div>[[File:Orange-pi-2g-iot-img59.png|500px|]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img26.png|500px|]]</div>
<br>
Execute the following command after power on and login to ppp dial up.<br>
wvdia Tom &<br>
This command will run at the backstage for dial up, after dial-up access, you could use ping and ifconfig to check the network. If network connect successful, then you could use GSM to connect network.
<div>[[File:Orange-pi-2g-iot-img60.png|600px|]]</div>
<br>
<div>[[File:Orange-pi-2g-iot-img61.png|600px|]]</div>
<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=" ">[[File:Orange-pi-2g-iot-img5.png|500px]]</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>[[File: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: <br>
http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-2G-IoT.html<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>
 Before compile Android source code, you need to first compile modem kernel for both Tcard Startup and Nand Startup. modem kernel is misp framework, you need to use corresponding cross compilation tool.Youo could use the following command to unzip the cross compilation tool file:<br>
<br>
 $ tar -xvjf OrangePi_Doc.tar.bz2<br>
 $ cd Platform/RDA/modem-cross<br>
 $ tar -xvzf modem-cross-compiler-linux.tar.gz<br>
 $ cd cross-compiler<br>
<br>
 After you get the corresponding tool, install the cross compilation tool of modem as the following steps:<br>
Step 1: Cross-Compiler Installation<br>
 $ sudo tar -xzf ~/modem-cross-compiler-linux.tar.gz -C /opt<br>
 $ ls /opt/cross-compiler<br>
 $ sudo chown -R root:root /opt/cross-compiler<br>
 $ sudo chmod +x /opt/cross-compiler/bin/*<br>
<br>
Step 2: Environment Configuration<br>
 $ sudo sh -c 'echo export PATH=$PATH:/opt/cross-compiler/bin > /etc/profile.d/cross-compiler.sh'<br>
 $ sudo sh -c 'echo /opt/cross-compiler/lib > /etc/ld.so.conf.d/cross-compiler.conf'<br>
 $ sudo ldconfig -v<br>
 $ sudo ldconfig -v | grep '/opt/cross-compiler/lib'<br>
 $ mips-elf-gcc -v<br>
<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.<br>
<br>
=== '''Compile Linux source Code''' ===
<br>
 Linux source code of Orange Pi 2G-IoT has been updated to github, you could download from github. Compile Linux would require you work under Linux environment. We would recommend you use Ubuntu 16.04 of Linux PC.<br>
* Download Linux source code
 You could download Linux source code from github:<br>
[https://github.com/OrangePiLibra/OrangePi <span style="color:#42a0e5;">https://github.com/OrangePiLibra/OrangePi</span>]
<br>
 You could also use git command to update:<br>
  git clone https://github.com/OrangePiLibra/OrangePi.git
* Compile source code
Use the following command to enter into source code directory after you get the source code:<br>
  cd */OrangePi<br>
Execute the following script:<br>
  ./Build_OrangePi.sh<br>
Input root password:
<div style=" ">[[File:Orange-pi-i96-img37.png|600px]]</div>
<br>
After root password recognize successful, enter inter main interface and use Enter key.
<div style=" ">[[File:Orange-pi-i96-img38.png|600px]]</div>
<br>
Select “Build system with kernel/uboot/rootfs” on main functional interface and use Enter key.
<div style=" ">[[File:Orange-pi-i96-img39.png|600px]]</div>
<br>
And then select “OrangePi 2G-IoT” with Enter key to update source code.
<div style=" ">[[File:Orange-pi-i96-img40.png|600px]]</div>
<br>
 It would take around 40minutes to update source code and corresponding scripts. After updated the source code, there will be generated a directory of OrangePi_i96. This directory contains both Linux source code and scripts:
<div style=" ">[[File:Orange-pi-i96-img41.png|600px]]</div>
<br>
* Compile Linux
<br>
Execute the following command after enter into directory of OrangePiRDA: ./build.sh<br>
 The script is is an automatic script, you could select a corresponding board which you want to compile, here is “OrangePi 2G-IoT”.
<div style=" ">[[File:Orange-pi-i96-img42.png|600px]]</div>
<br>
 If it is the first time you run the script, the system would install development tool automatic to make sure the network is connecting.
<div style=" ">[[File:Orange-pi-i96-img43.png|600px]]</div>
<br>
After installed tool, enter root password and use Enter key.
<div style=" ">[[File:Orange-pi-i96-img44.png|600px]]</div>
<br>
You will enter into the main interface after entering password, select what you are going to do:
<div style=" ">[[File:Orange-pi-i96-img45.png|600px]]</div>
<br>
This version is only support the above three options. After selecting the corresponding option, the system would compile automatically.
<div style=" ">[[File:Orange-pi-i96-img46.png|600px]]</div>
<br>
There will be prompt the location of kernel image and module after compilation.
<div style=" ">[[File:Orange-pi-i96-img47.png|600px]]</div>
<br>
* Update Linux Kernel and module
 After finished the above compilation steps, you could update the new kernel and module into the board to run it. Before this, you could refer to the charter about Linux image writing section to write a Linux distro into SD card. After written image, insert SD card into PC and till now it would recognize there are two partitions, one is boot partition with file of uboot, kernel and Ramdisk. The other partition is rootfs partion which contains root file system.<br>
 There is already marked the location of generated kernel, you only need to copy the generated zImage into first partition of SD card and replace zImage inside. Till now the kernel has been updated.<br>
 And there is already marked the location of new generated module, the second SD card partition is Rootfs partition, you need to have root permission to delete the directory of rootfs/lib/modules/3.xxx with following command:<br>
 sudo rm -rf */rootfs/lib/modules/3.xxx<br>
Copy the new generated module into rootfs partition you need to use the following command:<br>
sudo cp -rf */OrangePiRDA/output/lib/modules/3.xxx */rootfs/lib/modules/ sync<br>
After all above steps, kernel and module update have been finished.<br>
You could insert SD card into Orange pi, and make the jumper like the following, after booting, it would enter into Linux.
<div style=" ">[[File:Orange-pi-2g-iot-img62.png|200px]]</div>
<br>
 
== '''Orange Pi Driver development''' ==
<br>
 In order to help developers more familiar with Orange Pi, this instruction will make a brief illustration on device driver module and application program.<br>
<br>
Hardware: Orange Pi development board*1, Card reader*1, TF card*1, power supply*1
<div style=" ">[[File:Orange-pi-2g-iot-img5.png|600px]]</div>
<br>
=== '''Device driver and application programming''' ===
<br>
'''1)Application Program (app.c)'''<br>
<br>
<div>[[File:Orange-pi-i96-img50.png|600px]]</div>
<br>
'''2)Driver Program (OrangePi_misc.c)'''<br>
<br>
<div>[[File:Orange-pi-i96-img51.png|600px]]</div>
<br>
<div>[[File:Orange-pi-i96-img52.png|600px]]</div>
<br>
 
=== '''Compile device driver''' ===
<br>
Copy the OrangePi_misc.c to the */trunk/kernel/driver/misc:<br>
Enter to */trunk/kernel/driver/misc<br>
Modify Makefile on currently file, shown as following:
<div>[[File:Orange-pi-i96-img53.png|800px]]</div>
<br>
There is Kconfig on the same sibling folders with Makefile. Each Kconfig respectively describes the the source directory file related kernel configuration menu. In the kernel configuration making menuconfig, it read from the Kconfig config menu and the user configuration saved to the config. In the kernel compile, the main Makefile by calling this.Config could know the user's configuration of the kernel.<br>
Kconfig is corresponding to the kernel configuration menu. Add a new driver to the kernel source code, you can modify the Kconfig to increase the configuration menu for your drive, so you can choose whether the menuconfig driver was compiled or not.
<div>[[File:Orange-pi-i96-img54.png|800px]]</div>
<br>
Back to the source code directory /trunk:<br>
$ make bootimage<br>
Make sure it have already finished make-engineer-configuration before execute this command, if not, please refer to last section about Linux source code compilation.<br>
Update the new generated module file into Linux system.<br>
It will show on *cd<br>
/trunk/out/target/product/slt-NollecA9V2VV8810P_ext4/obj/KERNEL/out<br>
/target/product/slt-NollecA9V2VV8810P_ext4/obj<br>
/KERNEL/modules/lib/modules/<br>
3.10.62-rel5.0.2/ generated corresponding .ko file, <br>
it is the module<br>
that generated after OrangePi_misc.c compilation.<br>
<br>
Insert U disk (please note the SD card should have written image) if the SD card is mounted to the directory system of /dev/sdc, then SD card will mount to rootfs, which is /dev/sdc7, and mounted to rootfs partition automatic.
<div>[[File:Orange-pi-i96-img55.png|800px]]</div>
<br>
Copy the directory file:<br>
/trunk/out/target/product/slt-NollecA9V2VV8810P_ext4<br>
/obj/KERNEL/out/target/product/slt-NollecA9V2VV8810P_ext4/<br>
obj/KERNEL/modules/lib/modules/3.10.62-rel5.0.2/
into:<br>
/media/*/lib/modules/
<br>
 
=== '''Compiling method of application''' ===
<br>
Check whether there is the cross compiler, if not, then download and install it.<br>
$ arm-linux-gnueabihf-gcc -v
<div>[[File:Orange-pi-i96-img56.png|800px]]</div>
<br>
While compiling the application, you will fill that you need the cross compiler arm-linux-gnueabihf-gcc, download and install it.
<div>[[File:Orange-pi-i96-img57.png|800px]]</div>
<br>
Unzip the downloaded file and enter the the directory
<div>[[File:Orange-pi-i96-img58.png|800px]]</div>
<br>
Check the information after entering bin directory
<div>[[File:Orange-pi-i96-img59.png|800px]]</div>
<br>
pwd hows the path and export it into the whole project
<div>[[File:Orange-pi-i96-img60.png|800px]]</div>
<br>
$ ll /etc/environment shows that the file can only read, need to modify permissions <br>
$ chmod 755 /etc/environment<br>
<div>[[File:Orange-pi-i96-img61.png|800px]]</div>
<br>
Add the path to the whole environment variable<br>
<div>[[File:Orange-pi-i96-img62.png|800px]]</div>
<br>
Compile the application with cross compiler<br>
<br>
$ arm-linux-gnueabihf-gcc app.c –o aq<br>
There will be an ap application generated in the directory, copy it to the development board file system(on the rootfs directory of /home/orangepi/)<br>
$ cp aq /media/*/home/orangepi/<br>
<br>
 
=== '''Running driver and application''' ===
<br>
Removed the SD card and inserted it into the development board and power on.<br>
You need to switch to root users and load module driver module to the development board first.<br>
$ insmod /lib/modules/orangepi.ko
<div>[[File:Orange-pi-i96-img63.png|800px]]</div>
<br>
$ lsmod To check whether it is loaded
<div>[[File:Orange-pi-i96-img64.png|800px]]</div>
<br>
$ ll /dev/orangepimisc( Miscellaneous equipment automatically generated device files, the specific look at the driver code)
<div>[[File:Orange-pi-i96-img65.png|800px]]</div>
<br>
Executive application (note the use of the application, check the code for specify)<br>
$ ./aq /dev/orangepimisc
<br>
<br>
== '''Using Debug tools on OrangePi ''' ==
<br>
Hardware: Orange Pi development board*1, Card reader*1, TF card*1, power supply*1, TTL to USB cable*1
<div style=" ">[[File:Orange-pi-2g-iot-img5.png|500px]]</div>
<br>
'''TTL to USB cable'''
<div style=" ">[[File:Orange-pi-i96-img67.png|500px]]</div>
<br>
=== '''Operations on Windows''' ===
<br>
 In order to get more debugging information in the project development process of using OrangePi, OrangePi default support for serial information debugging. For developers, you can simply get the serial port debugging information with the materials mentioned above. The host computer using different serial debugging tools are similar, basically can reference with the following manual for deployment. There are a lot of debugging tools for Windows platform, the most commonly used tool is putty. This section takes putty as an example to explain the deployment.<br>
Android Baud rate set as 921600<br>
Linux Baud rate set as 921600<br>
<br>
'''1)Install USB driver on Windows'''<br>
<br>
* Download and unzip the latest version of driver: <br>
 PL2303_Prolific_DriverInstaller_v130.zip
<div>[[File:Orange-pi-i96-img68.png|800px]]</div>
<br>
* Choose application installation as Administrator
<div>[[File:Orange-pi-i96-img69.png|800px]]</div>
<br>
* Wait for installation completing
<div>[[File:Orange-pi-i96-img70.png|800px]]</div>
<br>
'''2)Install putty on Windows'''<br>
<br>
* Download putty installation package
<div>[[File:Orange-pi-i96-img71.png|800px]]</div>
<br>
* Unzip and install it
<div>[[File:Orange-pi-i96-img72.png|800px]]</div>
<br>
* Open it after installed, shown as below:
<br>
<div style=" ">[[File:Orange-pi-i96-img73.png|600px]]</div>
<br>
'''3)Connect method'''<br>
<br>
Use the TTL to the serial port cable, one end connected to OrangePi, the other end connected to PC
<br>
<div style=" ">[[File:Orange-pi-2g-iot-img63.png|500px]]</div>
<br>
'''4)Equipment information acquisition'''
<br>
* Select control panel on Start menu
<div style=" ">[[File:Orange-pi-i96-img75.png|400px]]</div>
<br>
<div style=" ">[[File:Orange-pi-i96-img76.png|600px]]</div>
<br>
* Click on the device manager to check the port number
<div style=" ">[[File:Orange-pi-i96-img77.png|400px]]</div>
<div style=" ">[[File:Orange-pi-i96-img78.png|400px]]</div>
<br>
'''5)Putty configuration'''
<div style=" ">[[File:Orange-pi-i96-img79.png|400px]]</div>
<br>
Serial port should set to the corresponding port number (COM5), the speed should set to 115200<br>
<br>
'''6)Start debug'''<br>
Power Orange Pi on and boot it, the serial port will automatic print out debug log.
<div style=" ">[[File:Orange-pi-i96-img80.png|600px]]</div>
<br>
 
=== '''Operations on Linux''' ===
<br>
There are Minicom and Kermit serial debugging tools for Linux, this section will take Kermit as an example to have an illustrate.<br>
<br>
'''1)Install Kermit'''
<br>
* Install the Kermit by execute command:
 $ sudo apt-get install ckermit
<div>[[File:Orange-pi-i96-img81.png|800px]]</div>
<br>
* Configurate Kermit
 $ sudo vi /etc/kermit/kermrc
<div>[[File:Orange-pi-i96-img82.png|800px]]</div>
<br>
* Add lines:
<div style="padding-left:20px;">
set line /dev/ttyUSB1<br>
set speed 921600<br>
set carrier-watch off<br>
set handshake none<br>
set flow-control none<br>
robust<br>
set file type bin<br>
set file name lit<br>
set rec pack 1000<br>
set send pack 1000<br>
set window 5
</div>
<div>[[File:Orange-pi-i96-img83.png|600px]]</div>
<br>
'''2)Connect method for debug'''
<br>
 Use the TTL to the serial port cable, one end connected to OrangePi, the other end connected to PC
<br>
<div>[[File:Orange-pi-2g-iot-img64.png|300px]]</div>
<br>
'''3)Equipment information acquisition'''<br>
<br>
$ ls /dev/ (Input command in the PC terminal to check the device number of TTL to the serial cable)
<div>[[File:Orange-pi-i96-img85.png|800px]]</div>
<br>
* It can be seen from the figure that TTL to the serial port cable is identified as ttyUSB0, configure the /ect/kermit/kermitc file, update the serial port information.<br>
 $ sudo vi /etc/kermit/kermitc
* Set the value of setline into /dev/ttyUSB0
<div>[[File:Orange-pi-i96-img86.png|800px]]</div>
<br>
'''4)Start debug'''
<br>
* Input command in the host computer terminal, enter the Kermit mode:
 $ sudo kermit –c
<div>[[File:Orange-pi-i96-img86.png|800px]]</div>
<br>
* Power it on and boot Orange Pi, the serial port will automatic print debug log, the account and password ard root/orangepi and orangepi/orangepi
<br>
<div>[[File:Orange-pi-i96-img88.png|800px]]</div>
<br>
 
== '''Download the Orange Pi 2G-IoT User Manual''' ==
<br>
For more information on using the Orange Pi 2G-IoT, please see the [https://drive.google.com/open?id=1v_ecsBnlQtxE4BNQ4v1eBa_YE0fhiUkK <span style="color:red;">Orange Pi 2G-IoT User Manual</span>]. (Click to download)

Navigation menu