Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect clock selection #16

Closed
EchterAgo opened this issue Jan 28, 2025 · 5 comments
Closed

Incorrect clock selection #16

EchterAgo opened this issue Jan 28, 2025 · 5 comments

Comments

@EchterAgo
Copy link

The change in #14 is not correct. The previous code was using ETH_CLOCK_GPIO0_IN which is the default. Changing it to ETH_CLOCK_GPIO17_OUT will leave the ESP MAC running off a different clock than the LAN8720, which still runs off the external oscillator.

Using ETH_CLOCK_GPIO17_OUT does initially seem to work but it causes periodic packet loss because the two oscillators are not in sync.

GPIO17 is routed to the TX LED / Pin, so you can see the LED glow faintly. It seems to me that ETH_CLOCK_GPIO0_IN matches the ESP-IDF example code in README.md.

@EchterAgo
Copy link
Author

@ProgrammingJohn

@egnor
Copy link
Owner

egnor commented Jan 28, 2025

What would you say the correct settings are?

@EchterAgo
Copy link
Author

ETH.begin(ETH_PHY_LAN8720, 1, 23, 18, 16, ETH_CLOCK_GPIO0_IN)

or in the version of the ESP32 Arduino framework still in use by PlatformIO (< v3.0):

ETH.begin(1, 16, 23, 18, ETH_PHY_LAN8720, ETH_CLOCK_GPIO0_IN);

Alternatively you can use:

#define ETH_PHY_POWER 16
ETH.begin()

or:

pinMode(16, OUTPUT);
digitalWrite(16, HIGH);
ETH.begin()

@ProgrammingJohn
Copy link

ProgrammingJohn commented Jan 29, 2025

Apologies with that oversight. Thank you for finding a correction. I simply ran with what worked after looking at some other documentation online but honestly didn't know the effect of the ETH_CLOCK_GPIO0_IN argument. I will switch back to IN within my code.

Regardless my main fix was the updated positional arguments for ETH.begin

Thanks again!

egnor added a commit that referenced this issue Jan 30, 2025
@EchterAgo
Copy link
Author

Looks good, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants