WIZnet5K use DHCP ?

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

WIZnet5K use DHCP ?

Post by water » Fri Sep 11, 2020 3:35 pm

Can I configure WIZnet5K use DHCP ?
If not, how to set the network parameter ?
I try to use

Code: Select all

nic.ifconfig(('192.168.1.103', '255.255.255.0', '192.168.1.1', '8.8.8.8'))
(e.g. my router IP address is '192.168.1.1')

but can't not connect to internet, WIZnet5K device can't detect on router (it should be detected).

I use adafruit_wiznet5k library on CircuitPython success to connect to internet, so the hardware is correct.
https://circuitpython.readthedocs.io/pr ... t/api.html

How should I configure WIZNET5K correctly on MicroPython ?

Stevo52
Posts: 38
Joined: Sun Feb 03, 2019 10:28 pm

Re: WIZnet5K use DHCP ?

Post by Stevo52 » Thu Sep 24, 2020 3:44 am

You haven't shown how you set up the WIZnet5k device?

This section of Micropython documentation might be worth reading, to help you figure it out...

http://docs.micropython.org/en/latest/l ... NET5K.html

acute
Posts: 6
Joined: Sat Jan 23, 2021 10:59 pm

Re: WIZnet5K use DHCP ?

Post by acute » Sun Jan 24, 2021 4:50 am

Stevo52 wrote:
Thu Sep 24, 2020 3:44 am
You haven't shown how you set up the WIZnet5k device?

This section of Micropython documentation might be worth reading, to help you figure it out...

http://docs.micropython.org/en/latest/l ... NET5K.html
That section doesn't mention DHCP at all. So I tried to build firmware for my PyBoard like this:

Code: Select all

make BOARD=PYBV11 MICROPY_PY_WIZNET5K=5500 MICROPY_PY_LWIP=1
(PYBV11 for PyBoard v1.1 in my case), and it helped, so apparently DHCP is implemented in lwIP.

User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

Re: WIZnet5K use DHCP ?

Post by water » Wed Jan 27, 2021 8:39 pm

That section doesn't mention DHCP at all. So I tried to build firmware for my PyBoard like this:

Code: Select all

make BOARD=PYBV11 MICROPY_PY_WIZNET5K=5500 MICROPY_PY_LWIP=1
(PYBV11 for PyBoard v1.1 in my case), and it helped, so apparently DHCP is implemented in lwIP.
Good, it works.
I think the lwIP module already enabled by default when build firmware with 'MICROPY_PY_WIZNET5K=5500' before, so, that means if not specific:

Code: Select all

MICROPY_PY_LWIP=1
when build the firmware, the WIZnet5K module has nothing practical implication?
:)

acute
Posts: 6
Joined: Sat Jan 23, 2021 10:59 pm

Re: WIZnet5K use DHCP ?

Post by acute » Wed Jan 27, 2021 10:36 pm

Without explicitly enabling lwIP — no, W5x00 module driver is being built, but it only accepts static IPv4 configuration for ifconfig() method; and it changes its behavior when built with lwIP.
UPD0: actually, you can still use the interface without DHCP, so if you can configure everything without DHCP and use it as you expected, then there's no need in that. Sockets work, the HTTP example from the manual works, for instance.

Post Reply