Install Realtek 802.11n (RTL8188E) WiFi USB dongle on SP7021 demo board

The goal of this document is to illustrate how to setup and activate Realtek 802.11n (RTL8188E) WiFi USB dongle on SP7021 demo boards. The Realtek RTL8188E is an 802.11b/g/n 2.4G single-chip IC which integrates wireless LAN and an USB controller. It combines a MAC, a 1T1R capable baseband, and RF in a single chip. The RTL8188E is suitable for high performance and low power consumption integrated wireless LAN devices.

We need to build Linux driver of Realtek RTL8188E, and necessary wireless protocols support modules. Please follow the following steps:

1. Enable wireless protocols support

Run make kconfig in project top folder (or go to linux/kernel folder and run make menuconfig). When “Linux/arm 5.4.35 Kernel Configuration” menu pops up, please use arrow key to move cursor down to “Networking support”. Refer to screenshot below, cursor was moved to “Networking support” menu item:

Press <SPACE> to enable it and then press <Enter> to enter “Networking support” sub-menu. Again, use arrow key to move cursor down to “Wireless” menu item. Refer to screenshot below, cursor was moved to “Wireless”:

Press <Enter> to enter “Wireless” sub-menu. Enable “cfg80211 – wireless configuration API” as module, enable “support CRDA” and “cfg80211 wireless extension compatibility”, and enable “Generic IEEE 802.11 Networking Stack (mac80211)” as module. Refer to screenshot “Wireless” sub-menu below:

Note that [*] means be included in kernel, <M> means be compiled as dynamic load module, whereas [ ] means does not include.

2. Enable Realtek 8188E USB WiFi driver

Move cursor to go to “Device Drivers” and then “Network device support” and then “Wireless LAN”. Next, enable “Realtek devices”. Enable “Realtek 8188E USB WiFi” as module. Refer to screenshot of “Wireless LAN” sub-menu below:

3. Build Linux image

Go to top folder and run make all to build Linux image.

4. Copy firmware

Copy firmware file rtl8188eufw.bin of RTL8188EU to folder /lib/firmware/rtlwifi.

5. Boot Linux

Boot Linux with the built image.

6. Plug in Realtek 802.11n USB WiFi dongle

Plug in Realtek 802.11n USB WiFi dongle into one of USB (Type-A) socket of a SP7021 demo board. Refer to picture below:

7. Probe WiFi module

Run modprobe 8188eu to probe module 8188eu.ko (RTL8188E USB WiFi driver). Refer to log when 8188eu.ko is probing below:

pi@raspberrypi:~$ sudo modprobe 8188eu pi@raspberrypi:~$ dmesg | tail -n 5 [10124.007709] usb 1-1: new high-speed USB device number 6 using ehci0-sunplus [10124.379130] RTW: rtl8188eu v5.2.2.4_25483.20171222 [10124.429228] RTW: hal_com_config_channel_plan chplan:0x20 [10124.430927] RTW: rtw_regsty_chk_target_tx_power_valid return false for band:0, path:0, rs:0, t:-1 [10124.437068] usbcore: registered new interface driver rtl8188eu pi@raspberrypi:~$

In report of dmesg command, “RTW: rtl8188eu v5.2.2.4_25483.20171222” means RTL8188EU was probed successfully.

8. Check out report of wireless net-interface devices

Run ifconfig wlan0 to check out status reports of net-interface device wlan0. Refer to log below:

pi@raspberrypi:~$ ifconfig wlan0 wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether cc:d2:9b:4b:3d:25 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 605 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 pi@raspberrypi:~$

Net-interface device wlan0 has been created.

Run iwconfig wlan0 to check out status reports of wireless LAN device wlan0. Refer to log below:

pi@raspberrypi:~$ iwconfig wlan0 wlan0 IEEE 802.11 ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=12 dBm Retry short limit:7 RTS thr:off Fragment thr:off Power Management:on pi@raspberrypi:~$

wlan0 is operating at Managed mode and is not yet connected to an access point (AP).

Run iwlist wlan0 channel to check out channel reports of wireless LAN device wlan0. Refer to log below:

wlan0 has 13 channels in total and carrier frequency is 2.412 GHz ~ 2.472 GHz.

Run iwlist wlan0 scanning to show details of all channels of wireless LAN device wlan0. Refer to log below:

9. Connect to WiFi Access Point (AP).

Run sudo iwconfig wlan0 essid “HTC U12 life” to connect to WiFi access-point “HTC U12 life”. Refer to log below:

wlan0 is connected to “HTC U12 life” successfully (No error was reported).

Note that iwconfig only supports WEP encryption. Please use wpa_supplicant if your AP is using WPA or WPA2 encryption.

Run iwconfig wlan0 to show status report of wireless LAN device wlan0. Refer to log below:

Access Point is changed to 76:F6:1C:8F:D6:C9. It is MAC address of the WiFi AP you connected.

Its ESSID is “HTC U12 life”. Protocol is “IEEE 802.11”. Carrier frequency is 2.462 GHz.

Run ifconfig wlan0 to show status report of net interface device wlan0.

Note that ip address of local host is set to 192.168.43.34. netmask is set to 255.255.255.0. broadcast address is set to 192.168.43.255.

10. Test wireless device

Run ping -c 3 google.com.tw to ping google.com.tw. Refer to log below:

Ping google.com.tw successfully.

11. Notes

If you are running on desktop environment, like Debian, Raspbian, and etc., you may need to turn off Network Manager before using networking tools iwconfig in advance. Manual methods iwconfig, etc. are unlikely to work as long as Network Manager is running. Network Manager has taken control and will not respond to another set of hands on the controls. To turn Network Manger off, for example, on Raspbian, please run ps aux to show process id of wpa_supplicant and use sudo kill -9 to terminate it.

Run sudo dhclient wlan0 to get ip addresses of local host, gateway, domain name server, and etc.

If you are going to install 8188eu.ko manually, please copy 8188eu.ko to folder:

/lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtl8188eu

Also, copy firmware file rtl8188eufw.bin to folder: /lib/firmware/rtlwifi

After copy, please run depmod to update kernel dependency files.