USB Wifi Example

In this notebook, a wifi dongle has been plugged into the board. Specifically a RALink wifi dongle commonly used with Raspberry Pi kits is connected into the board. Using Linux calls and Python functions, we will determine the unique name of the dongle and then create a network entry for a known ssid/password pair. This demo was first done using an iPhone hotspot wireless connection.

References
http://www.canakit.com/raspberry-pi-wifi.html

1. Create USB WIFI instance

Make sure the USB WIFI module has been plugged in, and the base overlay is loaded.


In [1]:
from pynq import Overlay
from pynq.drivers import Usb_Wifi

Overlay("base.bit").download()
port = Usb_Wifi()

Type in the SSID and password as instructed. It may take a while to establish the connection.


In [2]:
ssid = input("Type in the SSID:")
pwd = input("Type in the password:")
port.connect(ssid, pwd)


Type in the SSID:Visitor
Type in the password:47937061

3. Test connection

Ping 10 packets, then the following cell stops automatically.


In [3]:
! ping xilinx.com -c 10


PING xilinx.com (172.19.127.11) 56(84) bytes of data.
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=1 ttl=60 time=0.893 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=2 ttl=60 time=0.544 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=3 ttl=60 time=0.647 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=4 ttl=60 time=0.722 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=5 ttl=60 time=0.532 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=6 ttl=60 time=0.405 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=7 ttl=60 time=0.687 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=8 ttl=60 time=0.341 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=9 ttl=60 time=0.429 ms
64 bytes from xsj-pvapcs202.xilinx.com (172.19.127.11): icmp_seq=10 ttl=60 time=0.636 ms

--- xilinx.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 8995ms
rtt min/avg/max/mdev = 0.341/0.583/0.893/0.160 ms

4. Reset connection


In [4]:
port.reset()