Install Sunplus RTL8189ETV WiFi module on SP7021 demo board V2

The goal of this document is to illustrate how to install Sunplus RTL8189ETV WiFi module to Plus 1 demo board V2. Main chip of Sunplus RTL8189ETV WiFi module is Realtek RTL8189ETV which is an SDIO interface WiFi chip.

You need first connect Sunplus WiFi module to Plus 1 demo board V2 by hardware wiring, and then enable support of wireless networking and Realtek RTL8189ETV device driver in Linux kernel. Finally, you need to run user-space utilities to enable net interface wlan0 and connect it to an access-point (AP). Please follow the following steps:

1. Connect Sunplus RTL8189ETV WiFi module to Plus 1 demo board V2.

Pin-headers J2 and J39 of Plus 1 demo board V2 are reserved for connecting to WiFi module. Refer to pin-assignment of J2 and J39.

Number 63 means the pin is connected to pin G_MX63 of SP7021. 64 means the pin is connected to pin G_MX64 of SP7021. The same for other pins. 3.3V means the pin is connected to 3.3V power. G means the pin is connected to ground.

Refer to picture of Sunplus RTL8189ETV WiFi module below.

Connect Sunplus RTL8189ETV WiFi module to Plus 1 demo board V2 as shown in table below.

RTL8189ETV Pins

SP7021 Pins

3.3V

+3.3V

GND

GND

SDIO_D3

G_MX64

-

G_MX63

SDIO_CMD

G_MX62

-

G_MX61

SDIO_D1

G_MX60

SDIO_D2

G_MX59

SDIO_D0

G_MX58

SDIO_CLK

G_MX57

-

G_MX56

-

G_MX55

Refer to picture below:

Sunplus RTL8189ETV WiFi module is connected to Plus 1 demo board V2.

2. Modify device-tree source

WIFI function uses SDIO interface. You need to modify dts node sdio in device-tree source file, linux/kernel/arch/arm/boot/dts/sp7021-demov2.dts, as shown below:

&sdio { max-frequency = <52000000>; pinctrl-names = "default"; pinctrl-0 = <&pins_sdio>; };

Note that sdio is a label to node sdio@9c008400.

Modify device-tree node pinmux_sdio-pins to set pin-ctrl for sdio as below:

pins_sdio: pinmux_sdio-pins { sunplus,pins = < SPPCTL_IOPAD(60, SPPCTL_PCTL_G_PMUX, MUXF_SDIO_D1, 0) SPPCTL_IOPAD(58, SPPCTL_PCTL_G_PMUX, MUXF_SDIO_D0, 0) SPPCTL_IOPAD(57, SPPCTL_PCTL_G_PMUX, MUXF_SDIO_CLK, 0) SPPCTL_IOPAD(62, SPPCTL_PCTL_G_PMUX, MUXF_SDIO_CMD, 0) SPPCTL_IOPAD(64, SPPCTL_PCTL_G_PMUX, MUXF_SDIO_D3, 0) SPPCTL_IOPAD(59, SPPCTL_PCTL_G_PMUX, MUXF_SDIO_D2, 0) >; };

Note that first line of pin-ctrl setting sunplus,pins is for signal SDIO_D1 which is connected to pin G_MX60 in hardware. So it is set to number 60. The same for other pins. You should give different pin-ctrl settings if you have your own hardware connections.

Please note that to comply with Linux rules, after version 5.10.59, 4 property-names of pin node of SP7021 are changed as shown in table below:

5.4.35

5.10.59

5.4.35

5.10.59

sppctl,function

function

sppctl,groups

groups

sppctl,pins

sunplus,pins

sppctl,zero_func

sunplus,zerofunc

3. Enable networking support

Run make kconfig in project top directory and go to “Networking support”, and then “Wireless”, and then enable “cfg80211 – wireless configuration API”, “cfg80211 wireless extension compatibility” and “Generic IEEE 802.11 Networking Stack (mac80211)”. Refer to picture below:

4. Enable Realtek RTL8189E drivers

Go to “Device Drivers” and then “Network device support” and then “Wireless LAN”, and then enable “Realtek devices” and “Realtek 8189E SDIO WiFi”.

Finally, save configuration.

5. Build Linux image

Run make all to build Linux image.

6. Boot Linux

Boot Linux with the built image. During Linux booting, you will see log, which is showing RTL8189ETV is probing, as below:

: (some lines are deleted here to save space)

7. Check report of net-interface devices

After Linux boots up, run ifconfig –a to show report of status of all net interface devices.

Note that wireless net-interface device wlan0 is shown in the report. MAC address is 58:B3:FC:5A:8C:74.

8. Check status of wireless devices

Run iwconfig to show report of status of wireless devices:

Note that wireless device wlan0 is Not-Associated to any access point (AP) and ESSID is not yet set.

Run iwlist wlan0 channel to show supported channels & frequencies of wireless device wlan0.

Run iwlist wlan0 scanning to show available APs nearby.

…… (some lines are deleted here to save space)

…… (some lines are deleted here to save space)

9. Connect wireless device

Run sudo iwconfig wlan0 essid “HTC U12 life” to connect wireless device wlan0 to access-point “HTC U12 life” and run iwconfig wlan0 to show report.

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

Note: 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.

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

Note that ip address of local host is set to 192.168.43.115.

10. Test wireless device

Run ping -c 3 google.com.tw to ping google.