WIFI AP
1. Document Introduction1.1 Core Significance of WIFI AP ModeThe core value of WIFI AP (Access Point) mode is to transform a device (such as an embedded development board) into a wireless access point, enabling centralized connection and network intercommunication of multiple wireless devices. For EASY-EAI series development boards, this mode eliminates the need for a router, directly providing wireless networking capabilities for devices like mobile phones, PCs, and tablets. It supports scenarios such as data sharing, remote debugging, and collaborative work between devices, and is particularly suitable for temporary networking in router-free environments or wireless management requirements of embedded devices.
1.2 Basic Concepts of WIFI APA WIFI AP (Wireless Access Point) is a device that converts wired network signals into wireless network signals (e.g., 802.11g/n/ac). In embedded development scenarios, when a development board enables AP mode, it acts as the central node of the wireless network, broadcasts the SSID (Wireless Network Name) externally, and ensures connection security through encryption methods such as WPA2.
2. WIFI AP Mode Configuration2.1 Enable the wlan1 Interface- Execute the following command to create the wlan1 interface for AP mode deployment:
sudo echo "Featureid0 create wlan1 ap" > /sys/ccsys/ccpriv2. Check the status of the wlan1 interface:
- Execute
ifconfig; ifwlan1is displayed, the interface is enabled. - If not displayed, execute
ifconfig -a; ifwlan1exists, it means the interface is not activated.
3. Activate the wlan1 interface (execute only if it is not activated):
sudo ifconfig wlan1 upNote: Use ADB or serial port debugging for subsequent operations to avoid SSH connection interruption due to network configuration changes.
2.2 Configure the hostapd Servicehostapd is the core service for implementing AP mode, responsible for managing parameters such as the wireless network's SSID, encryption method, and channel.
Create a directory for storing the hostapd configuration file (if it does not exist):
- Create a directory for storing the hostapd configuration file (if it does not exist):
sudo mkdir -p /etc/wireless2. Edit the hostapd configuration file:
sudo vim /etc/wireless/hostapd.conf3. Write the following configuration content (key parameters are annotated):
4. Save the configuration file and exit Vim (press ESC, enter :wq and press Enter)
udhcpd is a lightweight DHCP server used to automatically assign IP addresses to devices connected to the AP, ensuring network intercommunication between devices.
Edit the udhcpd configuration file:
- Edit the udhcpd configuration file:
sudo vim /etc/wireless/udhcpd.conf2. Write the following configuration content (the IP segment can be adjusted as needed):
3. Configure a static IP for wlan1 (must be in the same network segment as the DHCP address pool):
Note: The static IP must be outside the DHCP range to avoid IP conflicts.
2.4 Start the WIFI AP ServiceStart the hostapd service in the background (& means running in the background):
- Start the hostapd service in the background (
&means running in the background):
sudo hostapd /etc/wireless/hostapd.conf &2. Start the udhcpd service (-S means running in the foreground for easy log viewing):
sudo udhcpd -S /etc/wireless/udhcpd.conf3. To run the udhcpd service in the background, execute the following command:
sudo udhcpd /etc/wireless/udhcpd.conf &3. Function Testing3.1 Basic Connection Test- Enable the WIFI function on wireless devices such as mobile phones and PCs.
- Search for the SSID (EASY-EAI-TEST in this example).
- Enter the configured password (12345678 in this example).
- Verify the connection: After successful connection, the device will obtain an IP address in the 192.168.123.x network segment; try pinging each other to confirm connectivity.
Development board side: Create a test file in the /userdata directory
- Development board side: Create a test file in the
/userdatadirectory
sudo echo "WIFI AP Test File" > /userdata/test_ap.txt2. Client side (e.g., PC): Connect to the development board via SSH or SCP
scp root@192.168.123.1:/userdata/test_ap.txt ./3. Reverse test: Upload a file from the client to the development board to verify normal two-way communication.
3.3 NotesTo modify the SSID or password, restart the service after modifying hostapd.conf:
- To modify the SSID or password, restart the service after modifying
hostapd.conf:
sudo pkill hostapd && sudo hostapd /etc/wireless/hostapd.conf &2. After the development board restarts, you need to re-execute the startup commands (you can write a startup script for automatic execution on boot).
3. Avoid enabling multiple wireless services at the same time to prevent interface conflicts.
4. If using the 5GHz frequency band (hw_mode=a), confirm that the development board hardware supports this frequency band.






Comments