PYNQ: PYTHON PRODUCTIVITY

WiFi dongle setup

I’m clearly missing something basic, but I’m trying to set up a WiFi dongle so that my PYNQ-Z2 board can connect to my local network. I don’t have an ethernet port on my computer, nor am I able to physically connect the PYNQ board to the router/modem at my location.

So I need a way to configure the WiFi dongle (connect it to the local network), but I cannot do so with the jupyter notebook (e.g as recommended here) because I cannot connect to the PYNQ board in the first place.

I thought that I might be able to run the configuration via a USB-based terminal session. I can connect from my laptop (mac) to the PYNQ board via USB, but get an error in python.

$ screen /dev/tty.usbserial-1234_tul1 115200
xilinx@pynq:~$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pynq.lib import Wifi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pynq/__init__.py", line 31, in <module>
    from .uio import UioController
  File "pynq/uio.py", line 31, in <module>
    import asyncio
ImportError: No module named asyncio

Is it possible to configure the WiFi dongle without already having the PYNQ-Z2 board on the network?

PYNQ needs Python 3.6, so just change the python command to python3

Cathal

1 Like

Thank you Cathal – that fixed it.

For reference and others’ benefit, here is the full setup that worked for me. I’m on a mac laptop (Catalina). The PYNQ-Z2 board is powered from my laptop via a USB-C to USB-Micro cable.

Step-by-step instructions

  • Start with PYNQ board powered down
  • Ensure the SD card is inserted (I’m using v2.5)
  • Plug in the USB WiFi dongle into the USB-A port on the PYNQ
  • Power up the PYNQ board, wait for LEDs to light up appropriately
  • Establish connection from laptop to PYNQ by opening a Terminal on the mac and typing:
$ screen /dev/tty.usbserial-1234_tul1 115200

(you’ll need to change /dev/tty.... to be whatever the relevant name is on your system)

  • Initially, the Terminal window will be blank, but after hitting “Return”, you’ll see a linux prompt. Then, start python3 (with sudo), and execute the three commands to initialize the WiFi dongle:
xilinx@pynq:~$ sudo python3
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pynq.lib import Wifi
>>> port = Wifi()
>>> port.connect('wifiNetworkNameGoesHere', 'wifiNetworkPasswordGoesHere')

Also, for reference, I tried this with three different WiFi modules.

  • The Wi-Pi from element14 (FCC ID: OYR-COMFAST88) Worked
  • EASTECH Ralink RT5370 Raspberry PI WiFi Adapter. Worked.
  • D-Link Model No.: DWA-131 (FCC ID:KA2WA131A1) Did not work.
    The first two worked, the third did not.

Connecting the WiFi dongle before or after powering up the PYNQ board does not change the outcome either way.

The error message that I got when using the D-Link was:

>>> port = Wifi()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xilinx/pynq/lib/wifi.py", line 84, in __init__
    raise ValueError("No WiFi device found. Re-attach the device "
ValueError: No WiFi device found. Re-attach the device or check compatibility.

If I then replaced the D-Link with the Wi-Pi and re-ran >>> port=Wifi(), it worked.

1 Like

The WIFI module that does not work for you requires some additional kernel configurations; we will resolve this in the next release.

Hi Rock, this is my first post in this forum here. Thank you for your help.

I am using the TP-Link model TL-WN725N Wifi adapter and have the exact same problem, that my PYNQ Z2 board doesn’t find the adapter.

What you recommend me to do?

Thanks again and with best wishes, Lars

I would recommend to use the Raspberry Pi Wifi adpater.

Hi Rock, thank you for your answer, but unfortunately this is not a valid solution, I am sorry.

First, I don’t know which adapter you mean and second there must be some kind of technical procedure to check, why the PYNQ Z2 board doesn’t find my adapter.

Can you help me with this issue please. I really would like to use the PYNQ Z2 board over Wifi using my Wifi adapter.

Thanks again and with best wishes, Lars

Based on:

“If your device is not detected, make sure that your kernel enables CONFIG_RTL8XXXU_UNTESTED”

Right now we have
image

So if you really want to make your WIFI module work, you probably need to adjust the kernel configuration and rebuild the boot partition of the Pynq-Z2 image.

However, I have not tested this.

Hi Rock, thank you for your answer.

Can you help me please with enabling this configuration setting in the kernel please? I have no experience in Linux kernel development, however I have experience in programming various languages.

So, what would be the easiest procedure?

Thanks again and with best wishes, Lars

I think the easiest way is to get one of the wifi modules as some people claimed working before. E.g. EASTECH Ralink RT5370 Raspberry PI WiFi Adapter.

For me, I am using this one without any issue.

If you really need to make your current module work, you will need to adjust the kernel configuration as I said and rebuild at least the boot partition.

Hi Rock, today I changed the Wifi adapter and now I can connect to my local Wifi :slight_smile:

Can you just point me in the right direction, how to store permanent the Wifi credentials on the board, so that it will connect to my local red automatically when booting up?

Thanks again, with best wishes
Lars

I think this might be helpful:Starting PYNQ Programs At Boot
But there could be easier ways. I am guessing in the next release we will add automatic reconnection.

Hey @lindnerlars,

I was able to store the credentials and connect to wifi on boot using this process

@lindnerlars which one did you use? As it might be hard to get the one @rock suggests, I would find another with the same Ralink 5370 chipset so I’d like to know if that worked for you. Thanks.

Hello aripod, I bought mine in a local store and it seems to be a generic one. On the dongle it only says “802.11n”. When I pug the dongle in my PC, I find the following information:

Wifi

I hope, that can help. With best wishes,
Lars

What about when you plug it to the pynq? If you do lsusb , dmesg or lspci | grep -i wireless?

I am sorry aperiod, could you please be more especific.

When you connect to the pynq, how do you do it? those are command lines you can execute on the terminal