2.5. Setup WiFi#
2.5.1. Overview#
WiFi enabled boards turn on WiFi as part of Linux start up. The AM62x Starter Kit (SK), is a WiFi enabled board.
The ifconfig command can be used to check the available WiFi interfaces in Linux on the SK:
# 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 either the board does not support WiFi, or something is not working correctly.
In the above output, 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. The wlan0 inferface does not have an IP address because it is currently not connected to an Access Point. The wlan1 interface represents the Access Point (AP). The default Processor SDK configuration assigns an IP address of 192.168.43.1 to the AP interface.
2.5.2. Setting Up the Access Point#
The AP on the AM62x Starter Kit behaves just like any other wireless Access Point (examples of other wireless Access Points include the wifi at coffee shops, hot spots, or a home wireless router). Any wireless enabled device (like a phone, tablet, or computer) can connect to the AM62x Starter Kit AP.
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 can run networking commands like ping, iperf, and ssh. Note that the SK will not have internet access, unless internet access has been set up separately. Therefore, the connected device will not be able to access the internet through the SK by default.
Here is an example of pinging a connected device:
# 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 run 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. There
is no display on the Starter Kit, and thus no GUI to enter the SSID and
password to connect to an external Access Point. A file is used to store this
connection information instead. This file,
wificfg
is on the boot partition of an SD Card used to boot the SK. wificfg
can be accessed from Linux running on the SK using the /media/mmcblk1p1
directory. The file can also be accessed by plugging the card into a Linux
development host.
Here is how to view the default contents of the wificfg
file on
an SK running Linux:
# cat /media/mmcblk1p1/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:
demo_enable: change “no” to “yes”.
ssid: set to the SSID of the Access Point to connect to.
password: set to the correct password.
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
If the file is modified using a Linux development host, safely remove the SD card from the Linux Development Host, put the SD card in an SK, and boot the board. If changes were made to the file from the target SK terminal, simply reboot the SK to apply the changes.
Once the board is booted, it should automatically connect to the configured Access Point. The connection can be checked with the below command:
# 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 its SSID “MyHomeWifi”. If the AP is not broadcasting, or if the AP is “hidden”, then 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 ifconfig command:
# 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 run the Matrix Demo using wireless.