2.5. Setup WiFi

2.5.1. Overview

WiFi enabled boards, like the AM64x Starter Kit (SK), turn on WiFi as part of Linux start up.

../_images/sk-am64-angled-wifi_tiny.png

The following command and output can be used to check the available WiFi interfaces in Linux on the SK:

root@am64xx-evm:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.2.19  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::f684:4cff:fef9:7c17  prefixlen 64  scopeid 0x20<link>
        ether f4:84:4c:f9:7c:17  txqueuelen 1000  (Ethernet)
        RX packets 8  bytes 1046 (1.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 67  bytes 10018 (9.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500  metric 1
        ether 70:ff:76:1d:f1:a3  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536  metric 1
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 82  bytes 6220 (6.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 82  bytes 6220 (6.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500  metric 1
        ether 38:0b:3c:f1:bc:79  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.43.1  netmask 255.255.255.0  broadcast 192.168.43.255
        inet6 fe80::3a0b:3cff:fef1:bc7a  prefixlen 64  scopeid 0x20<link>
        ether 38:0b:3c:f1:bc:7a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 43  bytes 5962 (5.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

If running the command above does not show any “wlanx” interfaces, it is likely that the board does not support WiFi or it is not working correctly.

As the output shows, there are two WiFi interfaces present, wlan0 and wlan1. The wlan0 interface represents the wireless station (sta) capability of the TI WiLink device that is on the board. As the output shows, it does not have an IP address as it is currently not connected to an Access Point. The wlan1 interface represents the Access Point (AP). The default SDK configuration assigns the IP address of 192.168.43.1 to this interface.

2.5.2. Setting Up the Access Point

Like any other wireless Access Point that users may be familiar with, coffee shop hot spots or even their wireless routers at home, the AP on the AM64x Starter Kit can be connected to by any wireless enabled device like a phone, tablet, or computer.

Here are the details needed to connect:

  • SSID - AM64xSK-AP_nnnnnn (where nnnnnn is unique for each AP)
  • Password - tiwilink8

Once connected, the device that connected to the AP should have an IP address of 192.168.43.xx. The SDK includes a DHCP server configured to serve IP addresses to devices that connect to the AP. This process is very similar to a wireless router. The connected device should be able to make IP connections like ping, iperf, and ssh. Please note that the SK does not likely have internet access, unless that has been set up separately. Therefore, the connected device will only be able to access the SK.

Here is an example of running the ping command to the connected device:

root@am64xx-evm:~# ping 192.168.43.20
PING 192.168.43.20 (192.168.43.20): 56 data bytes
64 bytes from 192.168.43.20: seq=0 ttl=64 time=49.868 ms
64 bytes from 192.168.43.20: seq=1 ttl=64 time=74.097 ms
64 bytes from 192.168.43.20: seq=2 ttl=64 time=97.936 ms
64 bytes from 192.168.43.20: seq=3 ttl=64 time=18.742 ms
64 bytes from 192.168.43.20: seq=4 ttl=64 time=43.313 ms
64 bytes from 192.168.43.20: seq=5 ttl=64 time=80.561 ms
64 bytes from 192.168.43.20: seq=6 ttl=64 time=191.995 ms
^C
--- 192.168.43.20 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 18.742/79.501/191.995 ms

Now that wireless is setup, feel free to try to run the Benchmark Demo or the Matrix Demo using wireless.

2.5.3. Connecting to an Access Point from the Starter Kit using Station Mode

Using the station capability of the TI WiLink device on the Starter Kit is similar to connecting a phone, tablet, or PC to a home wireless router or hot spot. Since there is not display on the Starter Kit, and thus no GUI to enter the SSID and password to connect to, a file is used to store this information. This file, wificfg is on the boot partition of an SD Card used to boot the SDK. This file can be accessed from Linux running on the SK using the /media/mmcblk1p1 directory. It could also be accessed by plugging the card into a Linux Development Host.

Here are some example commands to view the default contents of the file from an SK running Linux:

root@am64xx-evm:/boot# cat wificfg
# This file is used for configuring the credentials required when the
# board is acting as a WiFi station.
# Customize this as per your need
# Set the demo_enable to yes so that the board connects to the AP automatically
# after the boot

[Wifi-STA]
demo_enable = no
ssid = homewifi
password = password123

In order to have the SK attempt to connect to an Access Point as a station, make the following changes:

  • Change demo_enable = no, to “yes”.
  • Set ssid to the SSID of the Access Point to connect to.
  • Set password to the correct value.

Here is an example of a file modified to connect to “MyHomeWifi” using password “Password123”.

# This file is used for configuring the credentials required when the
# board is acting as a WiFi station.
# Customize this as per your need
# Set the demo_enable to yes so that the board connects to the AP automatically
# after the boot

[Wifi-STA]
demo_enable = yes
ssid = MyHomeWifi
password = Password123

Once the appropriate changes have been made, either safely remove the card from the Linux Development Host and put it in an SK and boot the board or simply reboot the SK if the changes were made on the target.

Once the board is booted, it should automatically connect to the configured Access Point. The connection can be checked with the below command:

root@am64xx-evm:~# iw wlan0 link
Connected to f4:f2:6d:2d:64:35 (on wlan0)
        SSID: MyHomeWifi
        freq: 2462
        RX: 11555 bytes (55 packets)
        TX: 6050 bytes (37 packets)signal: -50 dBm
        rx bitrate: 39.0 MBit/s MCS 4
        tx bitrate: 65.0 MBit/s MCS 7

        bss flags:       short-preamble short-slot-time
        dtim period:     0
        beacon int:      100

Note

If there is trouble connecting to the Access Point, please make sure the AP is broadcasting it’s SSID “MyHomeWifi”. If it is not broadcasting, or is “hidden”, this simple connection method will not work and there will be no connection made.

The IP address of the connection can be checked with the below commands:

root@am64xx-evm:~# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.200.164  netmask 255.255.255.0  broadcast 192.168.200.255
        inet6 fe80::3a0b:3cff:fef1:bc79  prefixlen 64  scopeid 0x20<link>
        ether 38:0b:3c:f1:bc:79  txqueuelen 1000  (Ethernet)
        RX packets 2658  bytes 679188 (663.2 KiB)
        RX errors 0  dropped 15  overruns 0  frame 0
        TX packets 66  bytes 9622 (9.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

With the IP address, a simple ping command is a good way to validate connectivity. With connectivity established, feel free to try to run the Benchmark Demo or the Matrix Demo using wireless.