LAN-Support with ESP-IDF 4

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
eydam-prototyping
Posts: 8
Joined: Thu Jan 21, 2021 2:18 pm
Contact:

LAN-Support with ESP-IDF 4

Post by eydam-prototyping » Sun Apr 18, 2021 12:46 pm

Hello,

I added LAN-Support in my MicroPython-Fork.

I would like to create a merge request, to make it available for everybody, but I have 3 Problems:
1. I am not completly familiar with Github. Can someone tell me the steps to create a merge request for the main repo? Especially what do I have to consider so that my code will be accepted?
2. I only have an Olimex EVB-Board with a LAN8710-Chip. It works with the LAN8720-Driver, but I don't have an IP101, RTL8201 or DP83848-Chip to test my code. Could someone help me?
3. I am also not completly sure how to test my code in general. I tried to connect to the network, get the current status of the Driver and Ping the Board. What else could I test?

If someone would like to try the code: You can find it here:
https://github.com/eydam-prototyping/mi ... ee/eth-dev

There are also some other changes in this commit, but I could make a new, clean branch for the merge request.

Here is some code to test:

Code: Select all

import network
import machine
import time

print("Initializing LAN")
l = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), phy_type = network.PHY_LAN8720, phy_addr=0)

while l.status() != network.ETH_INITIALIZED:
    print(".")
    time.sleep(1)

print("Done. Starting LAN")
l.active(True)

while (l.status() != network.ETH_STARTED) & (l.status() != network.ETH_CONNECTED):
    print(".")
    time.sleep(1)

print("Done. Waiting for IP")

while l.status() != network.ETH_GOT_IP:
    print(".")
    time.sleep(1)

print("Got IP:      {}".format(l.ifconfig()[0]))
print("    Subnet:  {}".format(l.ifconfig()[1]))
print("    Gateway: {}".format(l.ifconfig()[2]))
print("    DNS:     {}".format(l.ifconfig()[3]))
print("    MAC:     {}".format(":".join(["{:02x}".format(b) for b in l.config("mac")])))
output:

Code: Select all

Initializing LAN
Done. Starting LAN
.
Done. Waiting for IP
.
.
.
.
Got IP:      192.168.178.70
    Subnet:  255.255.255.0
    Gateway: 192.168.178.1
    DNS:     192.168.178.1
    MAC:     24:0a:c4:9e:ec:3f

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: LAN-Support with ESP-IDF 4

Post by pythoncoder » Sun Apr 18, 2021 12:51 pm

A first step is to read the Contributor Guidelines and code conventions.
Peter Hinch
Index to my micropython libraries.

Victor
Posts: 2
Joined: Wed Apr 14, 2021 12:11 pm

Re: LAN-Support with ESP-IDF 4

Post by Victor » Mon Apr 19, 2021 9:26 pm

Hi!
I just compiled with IDF4.0.2 its fork but the network module has no LAN attribute.
I am new to builds.
what am I doing wrong? :?:


REV:


the problem I had was with the esp-idf version.
now it is working perfectly with lan8720 in an industrial environment ...

I congratulate you on this
great contribution!

tangerino
Posts: 17
Joined: Sun Jul 25, 2021 8:34 am

Re: LAN-Support with ESP-IDF 4

Post by tangerino » Mon Aug 16, 2021 5:53 pm

This use to work in v14 but not in V16 anymore.
Any particular reason?

tangerino
Posts: 17
Joined: Sun Jul 25, 2021 8:34 am

Re: LAN-Support with ESP-IDF 4

Post by tangerino » Sat Aug 21, 2021 7:46 am

Victor wrote:
Mon Apr 19, 2021 9:26 pm
Hi!
I just compiled with IDF4.0.2 its fork but the network module has no LAN attribute.
I am new to builds.
what am I doing wrong? :?:


REV:


the problem I had was with the esp-idf version.
now it is working perfectly with lan8720 in an industrial environment ...

I congratulate you on this
great contribution!
Hi, could you give more details on what was done? I don't see it working on my side. Thanks in advance

Post Reply