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

Wiring #1

Open
igrowagarden opened this issue Aug 11, 2021 · 9 comments
Open

Wiring #1

igrowagarden opened this issue Aug 11, 2021 · 9 comments

Comments

@igrowagarden
Copy link

Your approach is awesome! How did you wire it compared to the other 10mbps approach? Did you remove the crystal from the lan8720 board and then generate a clock from the pico directly? If so, what frequency? If you could clarify your approach that would be great. I'm looking forward to testing your implementation. Thanks!

@messani
Copy link
Owner

messani commented Aug 11, 2021

Hi,
there is no need to do any changes to wiring. LAN8720 is running at 50MHz and Pico is overclocked at 250MHz. Pico is able to safely process 4 instructions per single LAN8720 cycle. So it is asynchronous compared to 10MBit approach (in 10MBit approach they underclock Pico to 50MHz so it is synchronous with LAN8720)

I think that this information is written in README.md.

But this is only example implementation. It is neccessarry to tune it and fix possible bugs.
I know that for example using function sys_timeout in lan8720.c is not correct because I did not increased timer count in LWIP configuration (I figured it out later after this project).

This project is only way, how to solve 100MBit ethernet with pico. It has not been used anywhere so there can be a lot of bugs.

It is good that you are going to test it. If there are some problems, let me know. I can fix it in this repo so other people will be able to run it.

@dave-online
Copy link

dave-online commented Nov 4, 2021

we need a version for the new Zero 2 W working with generic pikvm as their image doesn't know the new radio & so cant ever connect wirelessly to actually use it... local 172.0.0.2 comes up so there's that for LAN8720/pico to pin passthrough to a z2w header

@PaulskPt
Copy link
Contributor

PaulskPt commented Nov 15, 2021

Hi, first of all thank you for publishing this repo!
Two remarks :
a) I cloned it and tried to build it, but the make step revealed line-ending (CRLF) errors in both the .pio files. I changed them to LF line-endings only. Then the build process proceeded without error;

b) in the CMakeLists.txt was missing activation for USB output (or UART). I added the following lines:
pico_enable_stdio_usb(${name} 1)
pico_enable_stdio_uart(${name} 0)
It built and flashed successfully. In both MS Windows 10 as in a Raspberry Pi O.S. there were respectively a COM-port device and a /dev/ttyACM0 device visual. Using minicom in the Raspberry Pi OS but no output from the RPi Pico. Visual observations: the Amber LED of the LAN8720 is steady ON. The green LED is blinking in an irregular rhythm.
In file lan8720.c line 32, I un-commented "#define ENABLE_LOG". This had a positive effect. In minicom I now see output as "netif status changed 192.168.1.89", "sending packet", "valid packet received".

The central router of the LAN in this house is reporting the new IPv4 wired device as 192.168.1.89. The device has no HOSTNAME (yet).

Greetings,
Paulus

@messani
Copy link
Owner

messani commented Nov 16, 2021

@dave-online: But I do not know what to do with this information. This code is probably useless for you.

Hi @PaulskPt.
Please, do a pull request for a).
ad b) This is your setting. I used RX and TX pins for debugging so current state is good for me. Are you telling me that it is not working when debug messages are disabled?

@PaulskPt
Copy link
Contributor

PaulskPt commented Nov 16, 2021

Hi @messani, created a branch put in that branch the changes mentioned under a) and b) and created a PR.
OK about using the RX and TX pins for debugging. I own a Segger BASE compact which I can connect to the SWO pins of the Pico (did not do that yet with this setup. As for your last question: I don't know. I will put the ENABLE_LOG 'out of service' again and see what happen, then I'll report back to you. --

There are two more things that I noticed. The setup received an IP address from the router; then the router reports the device being connected (see image in other answer below) but shortly after the router reports that the device is disconnected.

Using WireShark I see packets from a device with IP-address 0.0.0.0, sometimes shown with a resolved name "Raspberr_85:74:33" and a MAC of b8:27:eb:85:74:33. See the screenshot below from WireShark.

2021-11-16_12h24_RPiPico_Lan8720_packets_monitored_by_WireShark

@PaulskPt
Copy link
Contributor

PaulskPt commented Nov 16, 2021

You wrote: "Are you telling me that it is not working when debug messages are disabled?".
My answer: "Yes".
When ENABLE_LOG is commented-out, there is no serial output.
Below an image of my test setup.

IMG_3167

@PaulskPt
Copy link
Contributor

Below a screenshot of the serial output after boot:

2021-11-16_12h46PT_RPi_Pico_w_LAN8720_serial_output_at_boot

Next image: the RPi Pico listed by the router (edited screenshot) (texts in Portuguese, but you'll understand):
RPi_Pico_w_LAN8720_module_listed_in_router

@messani
Copy link
Owner

messani commented Nov 16, 2021

Ok, lets make it clear.
Purpose of this project is not to write anything to serial port. Purpose of this project is to transmit and receive packets. So I will ask you again. Can you see packets when ENALBE_LOG is disabled? (You wrote "When ENABLE_LOG is commented-out, there is no serial output.")

Wireshark shows DHCP discover and DHCP offer packets. This is IMHO correct because DHCP client is enabled.
You can try to ping it:
ping 192.168.1.89

or you can try to open example page in web browser:
http://192.168.1.89

It is long time ago when i commited this project. But I remember that ICMP PING and HTTP server worked.

If it really does not work, can you send me packets of communication which does not work (eg. wireshark screenshot)?

@PaulskPt
Copy link
Contributor

PaulskPt commented Nov 16, 2021

Yes, the RPi Pico with the LAN8720 module are sending and receiving packets. See the attached screenshot showing the ping challenge and reply in Wireshark and the ping command in a Windows Terminal / bash (WSL1) session.
Also the router showed, for less than a minute, that the RPi Pico was connected. The ping command worked 15 times in a row then hang because the RPi was not anymore connected. Because of this the browser test failed.
OK Messani, thank you again for this repo and your responses. I am now able to go on with it.
Greetings, Paulus.

2021-11-16_16h26PT_RPi_Pico_w_LAN8720_ping_challenge_and_reply

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

4 participants