Page 1 of 1

Using Ethernet on the ESP32

Posted: Wed Feb 05, 2020 1:52 pm
by Maxi
Hello everybody,

I'm using a ESP32 with an LAN8710A-EZC similare to an Olimax board (https://www.olimex.com/Products/IoT/ESP ... e-hardware). On the board is running MicroPython 1.12-137. To initialize the Ethernet connection I use the following code:

Code: Select all

import network
from machine import Pin 

LAN = network.LAN(mdc = Pin(23), mdio = Pin(18), power = None, phy_type = network.PHY_LAN8720, clock_mode=network.ETH_CLOCK_GPIO0_IN, phy_addr=0)
LAN.active(1)
When running the code I can see this on the console:
I (501867) emac: emac reset done
I (501867) ethernet: start
True
>>> I (505867) ethernet: LAN cable connected
I (506897) event: eth ip: 192.168.0.6, mask: 255.255.255.0, gw: 192.168.0.1
I (506897) ethernet: Got IP

And then the esp32 stops running and I have to tipp something in the console the get back in the repl. The board is now connected to the Internet but the following code stops.
Hope someone can help me!

Greetings
Maxi

Re: Using Ethernet on the ESP32

Posted: Thu Feb 06, 2020 1:24 am
by jimmo
Maxi wrote:
Wed Feb 05, 2020 1:52 pm
and I have to tipp something in the console the get back in the repl.
I the problem here that MicroPython prints out the ">>>", but then the IDF prints out the logging message, making it look like you're not at the prompt anymore. i.e. does just pressing enter (which will make MicroPython print the ">>>" again) solve the issue?
Maxi wrote:
Wed Feb 05, 2020 1:52 pm
The board is now connected to the Internet but the following code stops.
What do you mean by "the following code stops"? Does code work if you type it at the REPL?

Re: Using Ethernet on the ESP32

Posted: Thu Feb 06, 2020 9:41 am
by Maxi
With following code I mean code that is in my main.py after LAN.active(1)
for example:

Code: Select all

import network
from machine import Pin 

LAN = network.LAN(mdc = Pin(23), mdio = Pin(18), power = None, phy_type = network.PHY_LAN8720, clock_mode=network.ETH_CLOCK_GPIO0_IN, phy_addr=0)
LAN.active(1)
print('Connected')
The print command is not executed.

Re: Using Ethernet on the ESP32

Posted: Thu Feb 06, 2020 10:28 am
by Maxi
ok, sorry I just dopple checked it and it just work fine :oops: