1e41f4b71Sopenharmony_ci# Running an Image
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Networking Configuration
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciAfter you have completed building and burning, perform the following to connect the Hi3861 WLAN module to the Internet.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci1. While the Windows workbench is connected to the Hi3861 WLAN module, choose **PROJECT TASKS** > **Monitor** to start the serial port terminal.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci     **Figure 1** Starting the serial port terminal 
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci   ![quickstart-ide-3861-running-mirror](figures/quickstart-ide-3861-running-mirror.png)
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci2. Reset the Hi3861 WLAN module. The message **ready to OS start** is displayed on the **TERMINAL** panel, indicating that the WLAN module is started successfully.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci     **Figure 2** Successful resetting of the Hi3861 WLAN module 
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci   ![quickstart-ide-3861-running-restart](figures/quickstart-ide-3861-running-restart.png)
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci3. Run the following AT commands in sequence via the serial port terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol (DHCP).
21e41f4b71Sopenharmony_ci   
22e41f4b71Sopenharmony_ci   ```
23e41f4b71Sopenharmony_ci   AT+STARTSTA                             # Start the STA mode.
24e41f4b71Sopenharmony_ci   AT+SCAN                                 # Scan for available APs.
25e41f4b71Sopenharmony_ci   AT+SCANRESULT                           # Display the scanning result.
26e41f4b71Sopenharmony_ci   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.)
27e41f4b71Sopenharmony_ci   AT+STASTAT                              # View the connection result.
28e41f4b71Sopenharmony_ci   AT+DHCP=wlan0,1                         # Request the IP address of wlan0 from the AP using DHCP.
29e41f4b71Sopenharmony_ci   ```
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci4. Check whether the Hi3861 WLAN module is properly connected to the gateway, as shown in the following figure.
32e41f4b71Sopenharmony_ci   
33e41f4b71Sopenharmony_ci   ```
34e41f4b71Sopenharmony_ci   AT+IFCFG                                # View the IP address assigned to an interface of the module.
35e41f4b71Sopenharmony_ci   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.
36e41f4b71Sopenharmony_ci   ```
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci   **Figure 3** Successful networking of the Hi3861 WLAN module 
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci   ![quickstart-ide-3861-running-success](figures/quickstart-ide-3861-running-success.png)
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci## Verification
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ciWhen the burning and networking are complete, you can use either of the following methods to debug and verify whether the source code has been burnt correctly:
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci1. Using printf to print logs
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci2. Using ASM files to locate issues
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ciIn simple use cases, as in this example, use the **printf** method. The following describes the two methods in detail.
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci### Using printf to Print Logs
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ciAdd the **printf** function to a key service path or where an exception occurs. The logs will be displayed through the serial port. The following is a code snippet of how to add **printf**:
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci```
60e41f4b71Sopenharmony_civoid HelloWorld(void)
61e41f4b71Sopenharmony_ci{
62e41f4b71Sopenharmony_ci    printf("[DEMO] Hello world.\n");
63e41f4b71Sopenharmony_ci}
64e41f4b71Sopenharmony_ci```
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci### Using ASM Files to Locate Issues
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ciIf the system exits abnormally, the call stack information about the abnormal exit is displayed on the serial port. Analyze the displayed information to troubleshoot and pinpoint issues.
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci```
72e41f4b71Sopenharmony_ci=======KERNEL PANIC=======
73e41f4b71Sopenharmony_ci**Call Stack*
74e41f4b71Sopenharmony_ciCall Stack 0 -- 4860d8 addr:f784c
75e41f4b71Sopenharmony_ciCall Stack 1 -- 47b2b2 addr:f788c
76e41f4b71Sopenharmony_ciCall Stack 2 -- 3e562c addr:f789c
77e41f4b71Sopenharmony_ciCall Stack 3 -- 4101de addr:f78ac
78e41f4b71Sopenharmony_ciCall Stack 4 -- 3e5f32 addr:f78cc
79e41f4b71Sopenharmony_ciCall Stack 5 -- 3f78c0 addr:f78ec
80e41f4b71Sopenharmony_ciCall Stack 6 -- 3f5e24 addr:f78fc
81e41f4b71Sopenharmony_ciCall Stack end***
82e41f4b71Sopenharmony_ci```
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ciTo analyze the call stack information, the **Hi3861_wifiiot_app.asm** file is required. This file records the symbol addresses of the functions in the code in the flash memory and the disassembly information. The ASM file is built and output together with the version software package and is stored in the **./out/wifiiot/** directory.
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci1. (Optional) Save the call stack information to a TXT file for editing.
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci2. Open the ASM file, search for the function address in each call stack, and list the corresponding function. Generally, you only need to find the functions matching the first several stacks to locate issues.
89e41f4b71Sopenharmony_ci   
90e41f4b71Sopenharmony_ci   ```
91e41f4b71Sopenharmony_ci   Call Stack 0 -- 4860d8 addr:f784c -- WadRecvCB
92e41f4b71Sopenharmony_ci   Call Stack 1 -- 47b2b2 addr:f788c -- wal_sdp_process_rx_data
93e41f4b71Sopenharmony_ci   Call Stack 2 -- 3e562c addr:f789c
94e41f4b71Sopenharmony_ci   Call Stack 3 -- 4101de addr:f78ac
95e41f4b71Sopenharmony_ci   Call Stack 4 -- 3e5f32 addr:f78cc
96e41f4b71Sopenharmony_ci   Call Stack 5 -- 3f78c0 addr:f78ec
97e41f4b71Sopenharmony_ci   Call Stack 6 -- 3f5e24 addr:f78fc
98e41f4b71Sopenharmony_ci   ```
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci3. Based on the above call stack information, it can be determined that an exception occurs in the **WadRecvCB** function.
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci   ![hi3861-test](figures/hi3861-test.png)
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci4. Check and modify the code.
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci## Execution Result Examination
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ciAfter the sample code is compiled, burnt, run, and debugged, restart the development board. If the following messages are displayed, the image is running correctly:
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci```
113e41f4b71Sopenharmony_ciready to OS start
114e41f4b71Sopenharmony_ciFileSystem mount ok.
115e41f4b71Sopenharmony_ciwifi init success!
116e41f4b71Sopenharmony_ci[DEMO] Hello world.
117e41f4b71Sopenharmony_ci```
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci## Next
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ciCongratulations! You have finished all steps! Proceed to develop samples to better familiarize yourself with OpenHarmony development:
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ci- [LED Peripheral Control](https://gitee.com/openharmony/docs/blob/master/en/device-dev/guide/device-wlan-led-control.md)
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ci- [Third-Party SDK Integration](https://gitee.com/openharmony/docs/blob/master/en/device-dev/guide/device-wlan-sdk.md)
127