quickstart-lite-steps-hi3861-connection.md 7.7 KB
Newer Older
D
duangavin123 已提交
1
# Setting Up WLAN Connection<a name="EN-US_TOPIC_0000001174350611"></a>
W
wenjun 已提交
2

D
duangavin123 已提交
3 4
-   [Building Source Code](#section191121332125319)
-   [Burning Images](#section3288165814218)
M
mamingshuai 已提交
5
-   [Connecting WLAN Module to the Internet.](#section194671619167)
[
[yang] 已提交
6 7

This example shows how to connect the WLAN module to the gateway using attention \(AT\) commands.
W
wenjun 已提交
8

D
duangavin123 已提交
9
## Building Source Code<a name="section191121332125319"></a>
W
wenjun 已提交
10

Y
yangni 已提交
11 12
This section describes how to perform the WLAN module building on a Linux server.

D
duangavin123 已提交
13
If the Linux environment is installed using Docker, perform the building by referring to  [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, perform the following steps:
W
wenjun 已提交
14

[
[yang] 已提交
15
1.  Open the HUAWEI DevEco Device Tool and choose  **View**  \>  **Terminal**.
W
wenjun 已提交
16

D
duangavin123 已提交
17 18
    **Figure  1**  Starting the IDE terminal tool<a name="fig755583241511"></a>  
    ![](figure/starting-the-ide-terminal-tool.png "starting-the-ide-terminal-tool")
W
wenjun 已提交
19

N
NEEN 已提交
20
    On the  **TERMINAL**  panel, run the ssh command, for example,  **ssh** **_user_@_ipaddr_**, to connect to the Linux server.
W
wenjun 已提交
21

D
duangavin123 已提交
22 23
    **Figure  2**  TERMINAL panel<a name="fig14407256101510"></a>  
    ![](figure/terminal-panel.png "terminal-panel")
W
wenjun 已提交
24

N
NEEN 已提交
25
2.  Go to the root directory of the code, run the  **hb set**  and  **.**  commands on the  **TERMINAL**  panel, and select the  **wifiiot\_hispark\_pegasus**  version.
N
NEEN 已提交
26

D
duangavin123 已提交
27 28
    **Figure  3**  Selecting the target build version<a name="fig191035701814"></a>  
    ![](figure/selecting-the-target-build-version.png "selecting-the-target-build-version")
N
NEEN 已提交
29 30

3.  Run the  **hb build**  command to start building.
W
wenjun 已提交
31

D
duangavin123 已提交
32 33
    **Figure  4**  Running commands on the TERMINAL panel<a name="fig10635942111916"></a>  
    ![](figure/running-commands-on-the-terminal-panel.png "running-commands-on-the-terminal-panel")
W
wenjun 已提交
34

N
NEEN 已提交
35 36
4.  Check whether the building is successful. If yes,  **wifiiot\_hispark\_pegasus build success**  will be displayed, as shown in the following figure.

D
duangavin123 已提交
37 38
    **Figure  5**  Successful building<a name="fig195291328182015"></a>  
    ![](figure/successful-building.png "successful-building")
W
wenjun 已提交
39

N
NEEN 已提交
40
5.  Check whether the following files are generated in the  **./out/wifiiot/**  directory.
[
[yang] 已提交
41 42

    ```
N
NEEN 已提交
43
    ls -l out/hispark_pegasus/wifiiot_hispark_pegasus/
[
[yang] 已提交
44
    ```
W
wenjun 已提交
45

D
duangavin123 已提交
46 47
    **Figure  6**  Directory for storing the generated files<a name="fig112257131214"></a>  
    ![](figure/directory-for-storing-the-generated-files.png "directory-for-storing-the-generated-files")
W
wenjun 已提交
48 49


D
duangavin123 已提交
50
## Burning Images<a name="section3288165814218"></a>
W
wenjun 已提交
51

D
duangavin123 已提交
52
Programming the flash memory is the process of downloading compiled program files to a chipset development board to provide a basis for subsequent debugging. With the one-click flash memory programming function of DevEco Device Tool, you can program flash memory on development boards quickly and efficiently.
W
wenjun 已提交
53

D
duangavin123 已提交
54
**The Hi3861 V100 development board allows you to program flash memory through the serial port using the burn-serial or hiburn-serial protocol. The hiburn-serial protocol is applicable to both Windows and Linux systems, while the burn-serial is applicable to Linux only.**
W
wenjun 已提交
55

D
duangavin123 已提交
56 57 58 59 60 61
>![](../public_sys-resources/icon-note.gif) **NOTE:** 
>The burn-serial protocol is used for compatibility with the projects of historical versions. It does not differ from hiburn-serial in operations.

The operations for programming flash memory in Windows and Linux are the same. The only difference lies in the environment setup for DevEco Device Tool.

1.  Connect the PC and the target development board through the USB port. For details, see  [Introduction to the Hi3861 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3861-0000001105041324).
N
NEEN 已提交
62
2.  <a name="en-us_topic_0000001056563976_li848662117291"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
W
wenjun 已提交
63

D
duangavin123 已提交
64
    >![](../public_sys-resources/icon-note.gif) **NOTE:** 
D
duangavin123 已提交
65
    >If the serial port number is not displayed correctly, follow the steps described in  [Installing the Serial Port Driver on the Hi3861 Series Development Board](https://device.harmonyos.com/en/docs/ide/user-guides/hi3861-drivers-0000001058153433).
W
wenjun 已提交
66

D
duangavin123 已提交
67
    ![](figure/record-the-serial-port-number.png)
W
wenjun 已提交
68

N
NEEN 已提交
69
3.  Open DevEco Device Tool and go to  **Projects**  \>  **Settings**.
W
wenjun 已提交
70

D
duangavin123 已提交
71
    ![](figure/setting.png)
W
wenjun 已提交
72

D
duanxichao 已提交
73 74
4.  On the  **Partition Configuration**  tab page, modify the settings. In general cases, you can leave the fields at their default settings.
5.  On the  **hi3861**  tab page, set the programming options.
W
wenjun 已提交
75

D
duangavin123 已提交
76 77 78
    -   **upload\_port**: Select the serial port number obtained in step  [2](#en-us_topic_0000001056563976_li848662117291).
    -   **upload\_protocol**: Select the programming protocol. For Windows, set this parameter to  **burn-serial**  or  **hiburn-serial**. For Linux, set this parameter to  **hiburn-serial**.
    -   **upload\_partitions**: Select the file to be programmed.  **hi3861\_app**  is selected by default.
W
wenjun 已提交
79

D
duangavin123 已提交
80
    ![](figure/options.png)
W
wenjun 已提交
81

N
NEEN 已提交
82
6.  When you finish modifying, click  **Save**  in the upper right corner.
D
duanxichao 已提交
83
7.  Open the project file. In the DevEco Device Tool window, go to  **PROJECT TASKS**  \>  **hi3861**  \>  **Upload**  to start programming.
W
wenjun 已提交
84

D
duangavin123 已提交
85
    ![](figure/upload.png)
W
wenjun 已提交
86

N
NEEN 已提交
87
8.  When the following information is displayed, press the RST button on the development board to restart it.
W
wenjun 已提交
88

D
duangavin123 已提交
89
    ![](figure/restart-the-development-board.png)
W
wenjun 已提交
90

D
duangavin123 已提交
91
9.  Start programming. If the following message is displayed, it indicates that the programming is successful.
N
NEEN 已提交
92

D
duangavin123 已提交
93
    ![](figure/burning-succeeded.png)
W
wenjun 已提交
94 95


M
mamingshuai 已提交
96
## Connecting WLAN Module to the Internet.<a name="section194671619167"></a>
W
wenjun 已提交
97

N
NEEN 已提交
98
After completing version building and burning, do as follows to connect the WLAN module to the Internet using AT commands.
W
wenjun 已提交
99

N
NEEN 已提交
100
1.  Click the icon of  **DevEco: Serial Monitor**  at the bottom of DevEco Studio to keep the connection between the Windows workstation and the WLAN module.
W
wenjun 已提交
101

D
duangavin123 已提交
102 103
    **Figure  7**  Opening the DevEco serial port<a name="fig464411253297"></a>  
    ![](figure/opening-the-deveco-serial-port.png "opening-the-deveco-serial-port")
W
wenjun 已提交
104

N
NEEN 已提交
105
2.  Reset the WLAN module. The message  **ready to OS start**  is displayed on the  **TERMINAL**  panel, indicating that the WLAN module is started successfully.
W
wenjun 已提交
106

D
duangavin123 已提交
107 108
    **Figure  8**  Successful resetting of the WLAN module <a name="fig3327108143016"></a>  
    ![](figure/successful-resetting-of-the-wlan-module.png "successful-resetting-of-the-wlan-module")
W
wenjun 已提交
109

N
NEEN 已提交
110
3.  Run the following AT commands in sequence via the DevEco serial port terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol \(DHCP\).
W
wenjun 已提交
111 112

    ```
N
NEEN 已提交
113 114 115 116 117 118
    AT+STARTSTA                             # Start the STA mode.
    AT+SCAN                                 # Scan for available APs.
    AT+SCANRESULT                           # Display the scanning result.
    AT+CONN="SSID",,2,"PASSWORD"            # Connect to the specified AP. (SSID and PASSWORD represent the name and password of the hotspot to be connected, respectively.)
    AT+STASTAT                              # View the connection result.
    AT+DHCP=wlan0,1                         # Request the IP address of wlan0 from the AP using DHCP.
N
NEEN 已提交
119 120
    ```

N
NEEN 已提交
121
4.  Check whether the WLAN module is properly connected to the gateway, as shown in the following figure.
N
NEEN 已提交
122 123

    ```
N
NEEN 已提交
124 125
    AT+IFCFG                                # View the IP address assigned to an interface of the module.
    AT+PING=X.X.X.X                         # Check the connectivity between the module and the gateway. Replace X.X.X.X with the actual gateway address.
W
wenjun 已提交
126 127
    ```

D
duangavin123 已提交
128 129
    **Figure  9**  Successful networking of the WLAN module<a name="fig7672858203010"></a>  
    ![](figure/successful-networking-of-the-wlan-module.png "successful-networking-of-the-wlan-module")
W
wenjun 已提交
130 131