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, choose **PROJECT TASKS** > **Monitor** to start the serial port terminal. 9 10 **Figure 1** Starting the serial port terminal 11 12 ![quickstart-ide-3861-running-mirror](figures/quickstart-ide-3861-running-mirror.png) 13 142. 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. 15 16 **Figure 2** Successful resetting of the Hi3861 WLAN module 17 18 ![quickstart-ide-3861-running-restart](figures/quickstart-ide-3861-running-restart.png) 19 203. 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). 21 22 ``` 23 AT+STARTSTA # Start the STA mode. 24 AT+SCAN # Scan for available APs. 25 AT+SCANRESULT # Display the scanning result. 26 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.) 27 AT+STASTAT # View the connection result. 28 AT+DHCP=wlan0,1 # Request the IP address of wlan0 from the AP using DHCP. 29 ``` 30 314. Check whether the Hi3861 WLAN module is properly connected to the gateway, as shown in the following figure. 32 33 ``` 34 AT+IFCFG # View the IP address assigned to an interface of the module. 35 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. 36 ``` 37 38 **Figure 3** Successful networking of the Hi3861 WLAN module 39 40 ![quickstart-ide-3861-running-success](figures/quickstart-ide-3861-running-success.png) 41 42 43## Verification 44 45When 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: 46 471. Using printf to print logs 48 492. Using ASM files to locate issues 50 51In simple use cases, as in this example, use the **printf** method. The following describes the two methods in detail. 52 53 54### Using printf to Print Logs 55 56Add 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**: 57 58 59``` 60void HelloWorld(void) 61{ 62 printf("[DEMO] Hello world.\n"); 63} 64``` 65 66 67### Using ASM Files to Locate Issues 68 69If 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. 70 71``` 72=======KERNEL PANIC======= 73**Call Stack* 74Call Stack 0 -- 4860d8 addr:f784c 75Call Stack 1 -- 47b2b2 addr:f788c 76Call Stack 2 -- 3e562c addr:f789c 77Call Stack 3 -- 4101de addr:f78ac 78Call Stack 4 -- 3e5f32 addr:f78cc 79Call Stack 5 -- 3f78c0 addr:f78ec 80Call Stack 6 -- 3f5e24 addr:f78fc 81Call Stack end*** 82``` 83 84To 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. 85 861. (Optional) Save the call stack information to a TXT file for editing. 87 882. 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. 89 90 ``` 91 Call Stack 0 -- 4860d8 addr:f784c -- WadRecvCB 92 Call Stack 1 -- 47b2b2 addr:f788c -- wal_sdp_process_rx_data 93 Call Stack 2 -- 3e562c addr:f789c 94 Call Stack 3 -- 4101de addr:f78ac 95 Call Stack 4 -- 3e5f32 addr:f78cc 96 Call Stack 5 -- 3f78c0 addr:f78ec 97 Call Stack 6 -- 3f5e24 addr:f78fc 98 ``` 99 1003. Based on the above call stack information, it can be determined that an exception occurs in the **WadRecvCB** function. 101 102 ![hi3861-test](figures/hi3861-test.png) 103 1044. Check and modify the code. 105 106 107## Execution Result Examination 108 109After the sample code is compiled, burnt, run, and debugged, restart the development board. If the following messages are displayed, the image is running correctly: 110 111 112``` 113ready to OS start 114FileSystem mount ok. 115wifi init success! 116[DEMO] Hello world. 117``` 118 119 120## Next 121 122Congratulations! You have finished all steps! Proceed to develop samples to better familiarize yourself with OpenHarmony development: 123 124- [LED Peripheral Control](https://gitee.com/openharmony/docs/blob/master/en/device-dev/guide/device-wlan-led-control.md) 125 126- [Third-Party SDK Integration](https://gitee.com/openharmony/docs/blob/master/en/device-dev/guide/device-wlan-sdk.md) 127