• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Running an Image
2
3
4## Networking Configuration
5
6After you have completed building and burning, perform the following to connect the Hi3861 WLAN module to the Internet.
7
81. While the Windows workbench is connected to the Hi3861 WLAN module, ensure that the serial port terminal is displayed properly.
9
102. 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.
11
12   **Figure 1** Successful resetting of the Hi3861 WLAN module
13
14   ![quickstart-pkg-3861-running-restart](figures/quickstart-pkg-3861-running-restart.png)
15
163. Run the following AT commands in sequence to enable the STA mode, connect to the specified AP, and enable the DHCP function:
17
18   ```
19   AT+STARTSTA                             # Start the STA mode.
20   AT+SCAN                                 # Scan for available APs.
21   AT+SCANRESULT                           # Display the scanning result.
22   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.)
23   AT+STASTAT                              # View the connection result.
24   AT+DHCP=wlan0,1                         # Request the IP address of wlan0 from the AP using DHCP.
25   ```
26
274. Check whether the Hi3861 WLAN module is properly connected to the gateway, as shown in the following figure.
28
29   ```
30   AT+IFCFG                                # View the IP address assigned to an interface of the module.
31   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.
32   ```
33
34   **Figure 2** Successful networking of the Hi3861 WLAN module
35   ![quickstart-pkg-3861-running-success](figures/quickstart-pkg-3861-running-success.png)
36
37
38## Verification
39
40When 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:
41
421. Using printf to print logs
43
442. Using ASM files to locate panic issues
45
46As the example used here is simple, we use the printf method. The following describes the two methods in detail.
47
48
49### Using printf to Print Logs
50
51Add the printf function to the code, which helps print data to the serial port. You can add log printing in key service paths or service exception locations, as shown in the following figure.
52
53
54```
55void HelloWorld(void)
56{
57    printf("[DEMO] Hello world.\n");
58}
59```
60
61
62### Using ASM Files to Locate Issues
63
64If 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.
65
66```
67=======KERNEL PANIC=======
68**Call Stack*
69Call Stack 0 -- 4860d8 addr:f784c
70Call Stack 1 -- 47b2b2 addr:f788c
71Call Stack 2 -- 3e562c addr:f789c
72Call Stack 3 -- 4101de addr:f78ac
73Call Stack 4 -- 3e5f32 addr:f78cc
74Call Stack 5 -- 3f78c0 addr:f78ec
75Call Stack 6 -- 3f5e24 addr:f78fc
76Call Stack end***
77```
78
79To 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.
80
811. (Optional) Save the call stack information to a TXT file for editing.
82
832. 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.
84
85   ```
86   Call Stack 0 -- 4860d8 addr:f784c -- WadRecvCB
87   Call Stack 1 -- 47b2b2 addr:f788c -- wal_sdp_process_rx_data
88   Call Stack 2 -- 3e562c addr:f789c
89   Call Stack 3 -- 4101de addr:f78ac
90   Call Stack 4 -- 3e5f32 addr:f78cc
91   Call Stack 5 -- 3f78c0 addr:f78ec
92   Call Stack 6 -- 3f5e24 addr:f78fc
93   ```
94
953. Based on the above call stack information, it can be determined that an exception occurs in the **WadRecvCB** function.
96
97   ![hi3861-test](figures/hi3861-test.png)
98
994. Check and modify the code.
100
101
102## Execution Result Examination
103
104After the sample code is compiled, burnt, run, and debugged, restart the development board. If the following messages are displayed, the image is running correctly:
105
106
107```
108ready to OS start
109FileSystem mount ok.
110wifi init success!
111[DEMO] Hello world.
112```
113
114Next
115
116Congratulations! You have finished all steps! Proceed to develop samples to better familiarize yourself with OpenHarmony development:
117
118- [LED Peripheral Control](../guide/device-wlan-led-control.md)
119
120- [Third-Party SDK Integration](../guide/device-wlan-sdk.md)
121