← index #15169Issue #15128
Related · high · value 5.030
QUERY · ISSUE

network: wiznet: send_ethernet

openby massimosalaopened 2024-05-30updated 2024-07-13

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues and didn't find any that matched.

Documentation URL

https://docs.micropython.org/en/latest/library/network.WIZNET5K.html

Description

The nic instance has also this method: send_ethernet

It is undocumented.

I tried and it works: it permits to send raw ethernet packets on the wire.

CANDIDATE · ISSUE

network.WIZNET5 : link status; isconnected(): the documentation is incorrect?

openby massimosalaopened 2024-05-26updated 2024-05-26
enhancement

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues regarding this feature, and didn't find any.

Description

On a W5500_EVB_PICO, I see these symbols:

import network
dir(network)
['__class__', '__name__', 'AP_IF', 'STA_IF', 'WIZNET5K', '__dict__', 'country', 'hostname', 'route']
nic = network.WIZNET5K
dir(nic)
['__class__', '__name__', '__bases__', '__dict__', 'active', 'config', 'ifconfig', 'isconnected', 'regs', 'send_ethernet', 'status']

The board is wired to a network switch.

I issue

nic.active(True)

and with Wireshark I see the tcp/ip stack tries to get a lease from a dhcp server.

During this:

nic.isconnected()
False

From the doc
Returns True if the physical Ethernet link is connected and up.

The physical Eth link is running.

Question 1)
is nic.isconnected() not working or is the doc in error?


Polling nic.status(), when it changes from 0 to 2 the nic still isn't configured:

nic.ifconfig()
('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0')

I have to poll with nic.isconnected(); when it changes to True the nic has acquired the dhcp lease:

nic.ifconfig()
('192.168.1.2', '255.255.255.0', '192.168.1.1', '9.9.9.9')

Questions:

  1. Can you add symbols for the current status() return values ?

  2. Can you enhance status() adding the return value STAT_GOT_IP ?
    So it is possible to poll just status(), as with WiFi interfaces.

Code Size

No response

Implementation

  • I intend to implement this feature and would submit a Pull Request if desirable.
  • I hope the MicroPython maintainers or community will implement this feature.
  • I would like to Sponsor development of this feature.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied