opened
XenGi
username_0
```

I hope someone with more knowledge about the underlying C code or the harware can shine some light on this.

[esp32-gateway]: https://github.com/OLIMEX/ESP32-GATEWAY/raw/master/HARDWARE/Hardware%20revision%20C/ESP32-GATEWAY_Rev_C_Color.pdf
[esp32-evb]: https://github.com/OLIMEX/ESP32-EVB/raw/master/HARDWARE/REV-D/ESP32-EVB_Rev_D.pdf
[esp32-poe]: https://github.com/OLIMEX/ESP32-POE/raw/master/HARDWARE/ESP32-PoE-hardware-revision-C/ESP32-PoE_Rev_C_Color.pdf
[demo]: https://github.com/OLIMEX/ESP32-POE/tree/master/SOFTWARE/ESP-IDF/ESP32_PoE_Ethernet
Ethernet support on the Olimex ESP32-POE
issue
created
readylan
username_1
Hello ! 
I have the same problem. I have contacted with Olimex support and they have send me this line of code:
```
lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), power = machine.Pin(17), phy_type = network.PHY_LAN8720, phy_addr=0)
```
but it doesn't work. They told me to than t is better to post in the MicroPython’s forums since here, the team members are familiar with their boards ..
comment
created
YonasJ
username_2
`

This, open issue, seems related as well. 

https://github.com/micropython/micropython-esp32/issues/239

And, this seems to be a solution on the C side, but as far as I can tell it should be implemented.

https://github.com/OLIMEX/ESP32-EVB/issues/11
comment
created
YonasJ
username_2
This must be related to something I am doing, when I try it with: esp32-20190113-v1.9.4-779-g5064df207.bin I am able to get it to work. But based on my own build from the trunk, it does not work.
comment
created
petrkr
username_3
I (19581) event: eth ip: 10.200.0.137, mask: 255.255.255.0, gw: 10.200.0.1
I (19581) network: event 24
```

I can provide current mater BIN for your test (if you want) and will try implement configuration option for this parameter and will try do Pull Request whenever I will get time. Meanwhile hard-coded version for me is enough :)

Petr
comment
created
petrkr
username_3
And I forgot. Here is patch

```
diff --git a/ports/esp32/network_lan.c b/ports/esp32/network_lan.c
index fba4de73a..258c6f3fd 100644
--- a/ports/esp32/network_lan.c
+++ b/ports/esp32/network_lan.c
@@ -146,6 +146,9 @@ STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
     config.gpio_config = init_lan_rmii;
     config.tcpip_input = tcpip_adapter_eth_input;
 
+    // Hard coded test for GPIO17 clock output
+    config.clock_mode = 3;
+
     if (esp_eth_init(&config) == ESP_OK) {
         self->active = false;
         self->initialized = true;
```
comment
created
readylan
username_1
Ok, very good, I will try it soon and tell you what happens. Thank you!
comment
created
petrkr
username_3
you can try that PR already (if you are able compile it yourself). https://github.com/username_3/micropython/commit/472c5a2937f01fa5543b3caeefc6e0a838080c7f
comment
created
readylan
username_1
Hello, I'm interested in that way ..
comment
created
petrkr
username_3
Can you try https://username_3.net/micropython-v1.10-108-gbd1b537be-dirty-build-username_3-LANclock.bin
It's latest `master` with that mine PR, version with optional `power` too. Since you using internal clock, you do not need use power at all, and specify `power = None` is littlebit useless I think, so I made it as default if not specified

Also you have to try if your phy is 0 or 1, for example mine wavewhare module is 1
comment
created
readylan
username_1
Hello, thank you for your help but my board doesn't work:
(phy_addr=0/1)

```
lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), phy_type = network.PHY_LAN8720, phy_addr=1)
lan.active(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: ethernet enable failed
```
I don't know if (or how) can provide more information.
comment
created
petrkr
username_3
You should specify also clock_mode parameter. I guess in your board case it would be:

`lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), phy_type = network.PHY_LAN8720, phy_addr=1, clock_mode=network.ETH_CLOCK_GPIO17_OUT)`

or `phy_mode=0`
comment
created
readylan
username_1
Tested without luck, I don't know what to do ..
comment
created
petrkr
username_3
Regards to schematic (if you have Olimex PoE board) they also have "power" pin at GPIO12. So try

`lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), power=machine.Pin(12), phy_type = network.PHY_LAN8720, phy_addr=0, clock_mode=network.ETH_CLOCK_GPIO17_OUT)`
comment
created
readylan
username_1
I can not get it to work but there are news: the board has link status, its ethernet leds (green and yellow) are active. I've noticed that after unplug from usb and replug again. But I get the same error when trying to activate from the python shell.
comment
created
petrkr
username_3
Maybe you can try skip power= and power-up that module by yourself before lan instance by something like

```
lan_power = machine.Pin(12, machine.Pin.OUT)
lan_power.value(1)
```

and then without `power`
```
lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), phy_type = network.PHY_LAN8720, phy_addr=0, clock_mode=network.ETH_CLOCK_GPIO17_OUT
```

you have to determine if lan_power is value 1 or 0 to power-up that module. As you wrote, you have to see link/activity LED's lighting

also now I check datasheet, that module is 8710, not 8720, can be that also problem? Have you tried some other example? Like from Arduino-C?
comment
created
readylan
username_1
First, I confirm lan_power on 1 power-up the board and leds, otherwise they remain off.
The sketch in Arduino that works for me is [this](https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/ETH_LAN8720_internal_clock/ETH_LAN8720_internal_clock.ino).
(changing mdc/mdio pins)
comment
created
petrkr
username_3
One more question, on Micropython, do you have some `boot.py` or `main.py` which can sits on Ethernet GPIO pins ? For me onetime I had problem my old code in boot.py initialized one of PHY pin to OUTPUT and as HIGH or something...

Also when you try different `lan = network.LAN()` you have to reboot board (full, not just CTRL+D) because that old configuration will stay used (like phy_addr, clock mode,etc). If you play with network, it's better always do hard-reboot to be sure all MCU state was reset to default state.

you can use either `machine.reset()` or unplug/replug power
comment
created
readylan
username_1
('192.168.1.170', '255.255.255.0', '192.168.1.1', '192.168.1.1')
```
It is important for me since this board is quite good price and being PoE It is very suitable for my projects.
Thank you again !
comment
created
petrkr
username_3
Good, since you already made it work, you can now also test that if `power=` option will work instead that separated `lan_power`. So you do not need do extra steps...

Regards, also thanks for test
comment
created
readylan
username_1
('192.168.1.170', '255.255.255.0', '192.168.1.1', '192.168.1.1')
```
Regards,
comment
created
coon42
username_4
Works fine with Olimex ESP32-POE :). Thanks for the patch!
comment
created
XenGi
username_0
Nice work guys. Thx to all of you. I'm getting more of the ESP32-POEs now. :)
comment
closed
dpgeorge
username_5
issue
created
dpgeorge
username_5
The `clock_mode` parameter was added in 7d8c71c222ed7793c99792eb15966504e039dae4
comment
created
adrian-vlad
username_6
E (29017) emac_esp32: emac_esp32_init(308): reset timeout
E (29017) esp_eth: esp_eth_driver_install(198): init mac failed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: esp_eth_driver_install failed
```

How can I use the wired LAN on this board without rebuilding the firmware myself?
comment
created
petrkr
username_3
I made issue for that on espressif long time ago as they drop this change from runtime and kept only during build time

https://github.com/espressif/esp-idf/issues/6564

But they already closed that issue, so now it's about integrate to micropython build and use this SDK which supports that
comment
created
hagenbuch
username_7
but I only get the error

Attribute Error: 'module' object has no attribute 'ETH_CLOCK_GPIO17_OUT

Where did I go wrong?

I'm installing with Thonny on Linux Mint 20.3, went fine as far as I can see.
Andreas
comment