-
Notifications
You must be signed in to change notification settings - Fork 18
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
Ethernet #79
Comments
Currently only LAN8720 is tested. I made a custom board for that which works well. I think I use gpio16 for the MAC clock out. Also some additional gpio was needed to reset lan8720 after boot to initialize it right with the correct strap options. Not sure how well the other PHYs will work. I think they should work but you'll have to try. |
So e.g. this one would work out of the box? Do you have some more documentation on how you hooked it up? |
I am not at home currently. But I think you could check the default values in menuconfig for LAN8720, these should reflect my setup |
@LeoSum8 Here goes the pinout for LAN8720: ESP32 <--> LAN8720 Also my PHYs LED1 pin is pulled low through a LED + resistor and MDIO is pulled high through a resistor. Not sure how technically skilled you are but here is the schematic: |
As you can only output RMII clock using GPIO0 through APLL you will be restricted to DACs which do not require MCLK or you'll have to choose a LAN8720 board which comes with its own clock source and use IO0 as an input (as I did). There will probably be needed some adjustments to make it work. Probably just disable this part here as it is specific to how I designed my board ( Line 2751 in fd701a1
|
I just saw the board you linked got a oscillator on the bottom. So yes, probably it will work but don't take this for granted |
Thank you so much for all the details! |
Documentation is a bit scarce on some parts so that would be great 👍 |
I also found this problem when designing my board. Basically the ESP32 can only accept the external sync clock from GPIO0, however during boot you are basically playing roulette with half the chance to stuck. I'll try later to tie GPIO5 to the EN pin of the active crystal oscillator. |
Should work if it goes to HIGH Z then |
After checking the datasheet of ESP32 and LAN8720, I just realized I did it wrong and you have used an easier solution. What I'm planning to do is to have an active oscillator (more expensive, requires power and provides What you did, which is to control the I think this also eliminates the need of an active oscillator with |
Works like a charme for me with the crystal :) |
Would a W5500 work or is a lot of coding required to get it running? |
I can't really tell as I only tested lan8720 but it should work. Check out Espressif supports it, I just took their code. |
Hi, Cool. I will get one and give feedback. |
Out of curiosity: Why do you want to go with the W5500 instead of lan8720 if you don't have one laying around already? :) My lan8720 has not yet arrived :/ |
@LeoSum8 ... My EspLouder has PinHoles matching the W5500-Boards so no need for much diy. |
My ETH8720 Board just arrived (yay!) and I am trying to follow your description and schematic to match the correct pins before I hook it up to my ESP32 via jumper wires. So this is what I matched so far:
So it seems that I am missing easy access to ETH_nRESET and nREFCLOCKO_EN pins. I think I am skilled enough to generally read the schematic, but I cannot see these two aspects you describe in the schematic.
|
So you must have Rev. E then. I just checked, mine are D without these PinHoles. |
@LeoSum8 if you want to control it like I do you need those two pins or it won't work Have a look at the datasheet page 6. There you see the pinout. It is pin2 on the LAN8720a which is nREFCLOCKO_EN (LAN8720 LED2/NINTSEL pin) in your table. youll have to find out how it is connected. I guess there is no schematic available for your board? Aslo check TABLE 2-2:
A few commets above a good description of what's happening with this pin is given. The reset pin (pin 15) is also needed for this to work. I'd suggest checking those pins and follow their tracks. Maybe you can remove some resistor and solder a wire instead. Hopwfully you are equipped with a soldering iron :) If you not you are not totally stuck but your only option will be to provide MAC clock from ESP32 --> to LAN8720 and change the code of I2S to use fixed mclk and use sample stuffing for synchronization. Not sure if your board supports clock in for the PHY as it has the oscillator already on it. |
Thank you so much for holding my hand here! Of course I have a soldering iron. I even have soldering tin! :P So I followed PIN2 (nREFCLOCKO_EN) and PIN15 (nRST) and I think I found where they are headed. |
nIntsel seems to be connected to the LED in the RJ45 connector. So this will definitly interfere and I should remove the resistor. If you compare my schematic, I've add a mosfet to enable the LED. This way I can ensure it will be floating at power on and still keep the ethernet LED activation. You will loose this functionallity but I guess this won't be much of a deal breaker. I cant really tell where nRst goes. |
Also I can see a 50MHZ clock there not sure how this is handled by LAN8720a. I have a 25MHz clock on my board. Is this an active oscillator with enable pin or a quarz? |
chapter 3.7.4 in the datasheet discusses clock configuration. You'll need to check how your boards strap options are configured. I fear your's is configured for "REF_CLK In Mode" which could be a bigger problem |
I think I have this board, or at least a clone of it: https://www.waveshare.com/lan8720-eth-board.htm And indeed it looks like nRST is going nowhere. On the PCB it also looks like the line ends shortly behind the resistor I marked. Not sure about what you say about the clock though. |
So this hardware mod would need to be combined with the code changes you described above
right? I'll have a look at the code to see if I can figure out what you mean :) |
No, in main.c there is this section:
Only thing you'll have to change here is to make gpio5 an output and pull it high. I think you won't even need the reset pin if you do it this way. GPIO5 then needs to be connected to your newly created oscillator enable pin on the LAN8720 board. But don't blame me if you brick your board by doing those changes :) |
Oh wow. I'll need to wrap my head around this solution before I execute it. Of course I'll blame you for any damages. I already blame you for buying the wrong board ;) I'll report how it goes! Thank you!! |
I am not sure if there even is any board out there which does it like I did :) Didn't find one when checking... There is a possibility that you'll still need the reset pin, maybe LAN8720a needs a clock during POR, I don't know. |
I can't see any possibilty to grab the clock on your board. Is it routed to the pin header? Also sometimes those oscillators have an enable pin. If you could find out which type it is and it has one you could directly control this pin without much board modification. You could also change the oscillator to something like this (if it fits). First I would try to connect the NC pin of your oscillator to ground and see if it stops operation. |
Ok I googled a bit about those oscillators. So this could be a tri state pin, you think? |
Yes resistor. doesn't really matter which size. everything from 10k to 470k will probably be ok. Yes maybe tristate pin if you are lucky |
That's what I have been talking before. The |
That won't be much of a problem. Should probably be a config option then:) |
@LeoSum8 How is it going? Is this still relevant? |
I am still struggling to find the time for this. But I noticed @whc2001 progress with, at least so it seems, a similar board. |
Alright. Take your time. I've just been curious |
Hi,
is any way of adding Ethernet connection currently supported? I noticed a setting in the menuconfig.
Does anyone have any experience with that?
There are some examples around for connecting w5500 boards to esp32, but I guess that would need to be supported by the firmware.
The text was updated successfully, but these errors were encountered: