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, ensure that the serial port terminal is displayed properly. 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_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. 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci **Figure 1** Successful resetting of the Hi3861 WLAN module 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci  15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci3. Run the following AT commands in sequence to enable the STA mode, connect to the specified AP, and enable the DHCP function: 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci ``` 19e41f4b71Sopenharmony_ci AT+STARTSTA # Start the STA mode. 20e41f4b71Sopenharmony_ci AT+SCAN # Scan for available APs. 21e41f4b71Sopenharmony_ci AT+SCANRESULT # Display the scanning result. 22e41f4b71Sopenharmony_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.) 23e41f4b71Sopenharmony_ci AT+STASTAT # View the connection result. 24e41f4b71Sopenharmony_ci AT+DHCP=wlan0,1 # Request the IP address of wlan0 from the AP using DHCP. 25e41f4b71Sopenharmony_ci ``` 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci4. Check whether the Hi3861 WLAN module is properly connected to the gateway, as shown in the following figure. 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci ``` 30e41f4b71Sopenharmony_ci AT+IFCFG # View the IP address assigned to an interface of the module. 31e41f4b71Sopenharmony_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. 32e41f4b71Sopenharmony_ci ``` 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci **Figure 2** Successful networking of the Hi3861 WLAN module 35e41f4b71Sopenharmony_ci  36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci## Verification 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_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: 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci1. Using printf to print logs 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci2. Using ASM files to locate panic issues 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ciAs the example used here is simple, we use the printf method. The following describes the two methods in detail. 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci### Using printf to Print Logs 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ciAdd 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. 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci``` 55e41f4b71Sopenharmony_civoid HelloWorld(void) 56e41f4b71Sopenharmony_ci{ 57e41f4b71Sopenharmony_ci printf("[DEMO] Hello world.\n"); 58e41f4b71Sopenharmony_ci} 59e41f4b71Sopenharmony_ci``` 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ci### Using ASM Files to Locate Issues 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_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. 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ci``` 67e41f4b71Sopenharmony_ci=======KERNEL PANIC======= 68e41f4b71Sopenharmony_ci**Call Stack* 69e41f4b71Sopenharmony_ciCall Stack 0 -- 4860d8 addr:f784c 70e41f4b71Sopenharmony_ciCall Stack 1 -- 47b2b2 addr:f788c 71e41f4b71Sopenharmony_ciCall Stack 2 -- 3e562c addr:f789c 72e41f4b71Sopenharmony_ciCall Stack 3 -- 4101de addr:f78ac 73e41f4b71Sopenharmony_ciCall Stack 4 -- 3e5f32 addr:f78cc 74e41f4b71Sopenharmony_ciCall Stack 5 -- 3f78c0 addr:f78ec 75e41f4b71Sopenharmony_ciCall Stack 6 -- 3f5e24 addr:f78fc 76e41f4b71Sopenharmony_ciCall Stack end*** 77e41f4b71Sopenharmony_ci``` 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_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. 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci1. (Optional) Save the call stack information to a TXT file for editing. 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_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. 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci ``` 86e41f4b71Sopenharmony_ci Call Stack 0 -- 4860d8 addr:f784c -- WadRecvCB 87e41f4b71Sopenharmony_ci Call Stack 1 -- 47b2b2 addr:f788c -- wal_sdp_process_rx_data 88e41f4b71Sopenharmony_ci Call Stack 2 -- 3e562c addr:f789c 89e41f4b71Sopenharmony_ci Call Stack 3 -- 4101de addr:f78ac 90e41f4b71Sopenharmony_ci Call Stack 4 -- 3e5f32 addr:f78cc 91e41f4b71Sopenharmony_ci Call Stack 5 -- 3f78c0 addr:f78ec 92e41f4b71Sopenharmony_ci Call Stack 6 -- 3f5e24 addr:f78fc 93e41f4b71Sopenharmony_ci ``` 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci3. Based on the above call stack information, it can be determined that an exception occurs in the **WadRecvCB** function. 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci  98e41f4b71Sopenharmony_ci 99e41f4b71Sopenharmony_ci4. Check and modify the code. 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci## Execution Result Examination 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_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: 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ci``` 108e41f4b71Sopenharmony_ciready to OS start 109e41f4b71Sopenharmony_ciFileSystem mount ok. 110e41f4b71Sopenharmony_ciwifi init success! 111e41f4b71Sopenharmony_ci[DEMO] Hello world. 112e41f4b71Sopenharmony_ci``` 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ciNext 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ciCongratulations! You have finished all steps! Proceed to develop samples to better familiarize yourself with OpenHarmony development: 117e41f4b71Sopenharmony_ci 118e41f4b71Sopenharmony_ci- [LED Peripheral Control](../guide/device-wlan-led-control.md) 119e41f4b71Sopenharmony_ci 120e41f4b71Sopenharmony_ci- [Third-Party SDK Integration](../guide/device-wlan-sdk.md) 121