Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabling MICROPY_PY_LWIP breaks MICROPY_PY_WIZNET5K #4651

Closed
diginfo opened this issue Mar 28, 2019 · 19 comments
Closed

enabling MICROPY_PY_LWIP breaks MICROPY_PY_WIZNET5K #4651

diginfo opened this issue Mar 28, 2019 · 19 comments

Comments

@diginfo
Copy link

diginfo commented Mar 28, 2019

Just confirmed this:

MICROPY_PY_LWIP + MICROPY_PY_WIZNET5K

import network, socket
net = network.WIZNET5K(pyb.SPI(1), pyb.Pin('X5'), pyb.Pin('X4'))
net.active(True)
net.ifconfig(('192.168.0.18','255.255.255.0','192.168.0.1','8.8.8.8'))
while not net.isconnected():
	pass
net.ifconfig()
socket.getaddrinfo('micropython.org',80)

Fails:

('192.168.0.18', '255.255.255.0', '192.168.0.1', '8.8.8.8')
Traceback (most recent call last):
  File "<stdin>", line 9, in <module>
OSError: -2

MICROPY_PY_WIZNET5K only - success

>>> socket.getaddrinfo('micropython.org',80)
[(2, 1, 0, '', ('176.58.119.26', 80))]

So it looks like MICROPY_PY_LWIP somehow is breaking MICROPY_PY_WIZNET5K

In both cases ifconfig returns the correct IP, however when using LWIP the device cannot be pinged and is unable to access the network.

@diginfo
Copy link
Author

diginfo commented Mar 28, 2019

I can run the simple webserver example and it does not error during startup, but are unable to connect to it.

Also, I have found that I can ping the device, but that's all.

socket.getaddrinfo('micropython.org',80)

Fails every time, not sure what other info I can provide ?

@dpgeorge
Copy link
Member

The lwIP mode works for me, using a PYBv1.0+Wiz550io. The following is enough for it to work, using DHCP by default:

import network, socket
lan = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
lan.active(1)
while not lan.isconnected():
    pass
print(lan.ifconfig())
print(socket.getaddrinfo('micropython.org', 80))

It also seems to work fine for me using a static IP address.

Also, I have found that I can ping the device, but that's all.

If you can ping it then the physical connection is there, it has an IP address, and the lwIP stack is working. So it should then be able to do everything else.

Make sure you use the latest, unmodified code from this repo.

@pacmac
Copy link

pacmac commented Apr 5, 2019

Hi Damien;

I am still having problems with the wiznet module on the PYBOARD11.

The current problem is that the wiznet module retains it's first DHCP configuration and does not appear to get a new lease when connecting to a completely different network.

Is there a way to force it to renew it's DHCP lease ?

Thanks

@dpgeorge
Copy link
Member

dpgeorge commented Apr 5, 2019

Is there a way to force it to renew it's DHCP lease ?

Try lan.ifconfig('dhcp')

@pacmac
Copy link

pacmac commented Apr 5, 2019

Thanks I am getting a :

OSError: timeout waiting for DHCP to get IP address

And after switching back to manual config:

import socket as s
s.getaddrinfo('micropython.org',80)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: -2

This combined with the previous issue where it is unable to resolve dns leads me to believe that there may some problem with UDP packets ??

In order to eliminate hardware issue, I ordered and just received a bunch of new WIZNET devices, however I am getting the same results on the old and new hardware ?

@pacmac
Copy link

pacmac commented Apr 5, 2019

I can connect to the device from a browser using a simple web server, but it looks like outbound connections have a problem ?!

@dpgeorge
Copy link
Member

dpgeorge commented Apr 5, 2019

In order to eliminate hardware issue, I ordered and just received a bunch of new WIZNET devices, however I am getting the same results on the old and new hardware ?

What are the model numbers of these, is it a 5500 chip?

@pacmac
Copy link

pacmac commented Apr 5, 2019

Yes, both old and new are 5500 - would you like to login ? - I can set that up

@dpgeorge
Copy link
Member

dpgeorge commented Apr 5, 2019

Please contact me by email (see git log for it).

@pacmac
Copy link

pacmac commented Apr 5, 2019

I am having problems connecting the PYBOARD to the ubuntu machine for you to login to:

dmesg
[   86.174022] usb 2-2-port1: attempt power cycle
[   88.154102] usb 2-2.1: new full-speed USB device number 10 using uhci_hcd
[   88.180832] usb 2-2.1: device descriptor read/8, error 2
[   88.313327] usb 2-2.1: device descriptor read/all, error 8

Have you seen this issue before ? - it is a fresh install of UBU18

@dpgeorge
Copy link
Member

dpgeorge commented Apr 5, 2019

Have you seen this issue before ? - it is a fresh install of UBU18

The USB port could be overloaded (power wise). Or the USB Linux driver has gotten into a strange state and no longer works, and the machine must be rebooted (this happens to me sometimes, especially with many repeated pyboard plug/unplug cycles).

@pacmac
Copy link

pacmac commented Apr 5, 2019

Solved it by using a USB hub, just refused to enumerate otherwise.

Sent you an email with the login details

@dpgeorge
Copy link
Member

dpgeorge commented Apr 5, 2019

The issue was that the Wiznet device didn't have a MAC address assigned. This case is now handled by fd523c5; see also 4f936af

@dpgeorge dpgeorge closed this as completed Apr 5, 2019
@pacmac
Copy link

pacmac commented Apr 5, 2019

Probably all of these $5.00 China WIZ devices don't have mac addresses assigned.

@LukeB1675
Copy link

Hello all,

I have just started looking into micropython for development. I recently began working with the WIZ820io off a PYBV1.1. I am having all the exact same problems as Diginfo had plus the attempt below. If I build firmware using only the MICROPY_PY_WIZNET5K=5200 option all seems to work fine. Except "socket" doesn't allow for the method "makefile" used in the server example in the docs. I am running out of ideas to get around this. Any help would be greatly appreciated!

import network, socket
lan = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
lan.active(1)
wiznet5k_lwip_poll: fatal error len=482 ret=-1001
wiznet5k_send_ethernet: fatal error -7
wiznet5k_send_ethernet: fatal error -7
wiznet5k_send_ethernet: fatal error -7
wiznet5k_send_ethernet: fatal error -7
wiznet5k_send_ethernet: fatal error -7

-Thank you in advance, Luke.

@dpgeorge
Copy link
Member

I recently began working with the WIZ820io

The 5500 module has better support than the 5200, so you might want to try that instead.

@eslamdiab400
Copy link

i need to connect enc28j60 with esp32 but i dont find WIZNET5K in network.
what should i do??

@dpgeorge
Copy link
Member

i need to connect enc28j60 with esp32 but i dont find WIZNET5K in network.
what should i do??

Wiznet is only supported on the stm32 port at the moment, not esp32. On esp32 you can use network.LAN instead.

@eslamdiab400
Copy link

eslamdiab400 commented Mar 11, 2021 via email

tannewt pushed a commit to tannewt/circuitpython that referenced this issue Apr 30, 2021
…-fixes

Minor docs fixes in displayio.Bitmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants