Wio RP2040 Module wifi issues

What am I doing wrong here? The 1.15.1 documentation is where I pulled this code from. Is this an issue with the custom firmware?

image

import network
from time import sleep
#import usocket as socket

 
def connect_wifi():
    N1 = network.WLAN_SPI(network.STA_IF)
    N1.active(True)
    connected = False

    while not connected:
        N1.connect("wifissid","ssidpass")
        if N1.isconnected():
            connected = True
        else:
            print("Not Connected, trying again.")
            sleep(1)

    print("Connected! My IP is: {}".format(N1.ifconfig()[0]))

def http_serve():
    html = """<!DOCTYPE html>
    <html>
        <head> <title>Seeed Wio RP2040 Webpage</title> </head>
        <body> <h1>Test Body Header 1</h1>
        </body>
    </html>
    """

    import socket
    addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]

    s = socket.socket()
    s.bind(addr)
    s.listen(1)

    print('listening on', addr)

    while True:
        cl, addr = s.accept()
        print('client connected from', addr)
        cl_file = cl.makefile('rwb', 0)
        while True:
            line = cl_file.readline()
            if not line or line == b'\r\n':
                break
        response = html
        cl.send('HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n')
        cl.send(response)
        cl.close()


connect_wifi()
http_serve()

Hi, I have a similar problem. Did you manage to solve it by any chance?

Hi,
I also encounter this issue when following a similar tutorial, and have tried various micropython versions to no avail.
There are suggestions on this forum that the source for the Wio RP2040 micropython implementation is here: https://github.com/IsQianGe/rp2040-spi

Looking at the code for the socket class in the “modusocket.c” file the whole “bind” and “listen” methods are commented out. If I am looking at this correctly it will explain why the “no attribute ‘bind’” error is thrown.

Really hope Seeed can update this so we can use the full potential of this little board.

Hi, I just got a new WIO RP2040 module and have problems with using sockets. I am running the latest 1.5.3 version of the firmware downloaded directly from the Seeed Wiki Page.

There no issue to connect to the Access Point but I am no to able to send / receive any data through the TCP socket (BTW. Never tried the UDP but at the moment it is not my use case).

  1. Is there any newer firmware than the 1.5.3 available?
  2. If someone manage to use TCP with this module could you please share the example code?
  3. Do they have any support team - not only voluntary users help?

Thanks you