Our Latest News

Method of enabling a wireless AP/ wireless access point for embedded Linux devices

Method of enabling a wireless AP/ wireless access point for embedded Linux devices

preface

In this blog post, we share how to enable a Wireless AP/ Wireless Access Point on an embedded Linux device.

When is wireless AP used?

In my recent work, I have used the following two situations:

(1) AP network distribution. Smart hardware is in AP mode. The mobile phone, as STA, connects to smart hardware in AP mode to form a LAN. In this case, the mobile phone can send the ssid and pwd information of the route to be connected to the device to the smart hardware through the LAN. After receiving the information, the smart hardware connects to the router to complete the network distribution.

(2) The unused board is used as the wireless AP to build the LAN communication of each device. For the development of mobile robot, wireless debugging is undoubtedly the most convenient in the actual working process of equipment.

Because the device is always in motion, if the cable is connected, the computer needs to run with the device, which is very inconvenient. When we were debugging, there was a great demand for routers, which were relatively limited, so I used the old boards to match the wireless AP mode.

After measured, the same distance, the old board LAN communication speed is slightly lower than our router, but it does not affect our use as debugging.

For embedded Linux devices, the following four files need to be prepared to enable the wireless access point:

hostapd: A user-mode daemon for AP and authentication servers.

conf: indicates the hostapd configuration file, which contains information such as the name and password of a wireless AP.

udhcpd: dhcp dial-up server.

Udhcpd. conf: indicates the udhcpd configuration file that configures the gateway address and IP address range.

hostapd and udhcpd are included in busybox. Of course, you can also download the source code and compile it yourself, as shown in our previous post:

Remote landing development board: RTL8723 driver transplantation +wpa_supplicant transplantation +SSH transplantation, compilation methods are much the same.

Note: udhcpc and udhcpd tools.

udhcpc is the client for dhcp dialing. When the device functions as a STA, it automatically obtains IP addresses.

udhcpd is the server side of dhcp dialing. When the device functions as an AP, it automatically assigns IP addresses.

Among them, our previous blog how to achieve the program boot from the boot? For this blog post, we use udhcpd.

Here is how to configure the configuration files of hostapd and udhcpd:

hostapd configuration file

There’s a lot of content in there, and we probably won’t need that much configuration in practice, so we can cut it, modify it, and just keep what we need.

After deleting and revising, we get:

Swipe left and right to see all the code >>>

This file mainly configures:

Nic used: wlan0

AP name: LinuxZn_AP

AP password: 12345678

Encryption: WPA2

Frequency band: 2.4GHz

The hostapd.conf configuration file is stored in the /etc directory on the board.

udhcpd configuration file

For udhcpd configuration files, refer to udhcpd source code udhcpd.conf:

Again, we’ll just keep the following:

Swipe left and right to see all the code >>>

This file mainly configures:

The IP addresses that can be assigned range from 192.168.3.2 to 192.168.3.254

Nic port: wlan0

Gateway address: 192.168.3.1

Put the udhcpd.conf configuration file in the /etc directory on the board.

Open hotspot

With the above tools and related configuration files in place, there are a few things we need to do to enable our hot spots, which we will script:

start_ap.sh:

Swipe left and right to see all the code >>>

To enable hot spots:

You can see that the IP address assigned to the mobile phone is 192.168.3.2, which belongs to the range of 192.168.3.2 to 192.168.3.254. Our device hotspot is enabled successfully! Our PC can connect to this hotspot to debug the device.

    GET A FREE QUOTE

    FPGA IC & FULL BOM LIST

    We'd love to

    hear from you

    Highlight multiple sections with this eye-catching call to action style.

      Contact Us

      Exhibition Bay South Squre, Fuhai Bao’an Shenzhen China

      • Sales@ebics.com
      • +86.755.27389663