Reputation: 11
I am trying to build a project using a Raspberry Pi Pico and W5500 shield module with MicroPython. I can't find the proper libraries. From documentation:
class LAN – control an Ethernet module¶
This class allows you to control the Ethernet interface. The PHY hardware type is board-specific.
Example usage:
import network nic = network.LAN(0) print(nic.ifconfig()) # now use socket as usual ...
Which network library to look for and how to install it in Thonny? When in Thonny tools/manage packages/ I search PyPl for "network" there are many libraries but which is the proper one?
Upvotes: 1
Views: 1789
Reputation:
You'll need a MicroPython firmware build that includes support for the Wiznet modules with RP2040 / Pico. There's a guide on the Wiznet GitHub (it also goes on to talk about how to compile it yourself, if you need to go that far). It does look like the support for the W5500 on rp2040 has only just hit the nightly builds of MicroPython (I usually run with the current nightly versions myself, so you could give the latest build direct from micropython.org a try)
Once you have a firmware that includes the right support, the following code should work:
import network
nic = network.WIZNET5K()
nic.active(True)
# to print IP address etc
nic.ifconfig()
Also, the current link to the MicroPython docs on these network adapters is this one, rather than the link you shared to the generic network / LAN class.
Upvotes: 3