Debugging Issues with W5500/LAN8720 Communication with STM32 and Gigabit Switch Chips

Debugging Issues with W5500/LAN8720 Communication with STM32 and Gigabit Switch ChipsDebugging Issues with W5500/LAN8720 Communication with STM32 and Gigabit Switch Chips

The premise is that the hardware circuit is basically designed according to the official recommendations, and the software is also ported from the official demo.

1. First, check if the crystal oscillator is oscillating. The oscilloscope should show a DC bias of about 1.5V and an AC amplitude of approximately 0.5V with a 25MHz oscillation signal; the waveform does not need to be a perfect sine wave.

2. Check if the pins between the microcontroller and W5500 are consistent with those initialized in the program, including which SPI port is used. The three pins of the SPI port should be set to AF_SPIx. It is recommended to use SPI1, which has a higher clock frequency. If the SPI lines are long, do not set the speed too high; the GPIO pin speed of the microcontroller should not be set to 100MHz (this can easily lead to SPI communication failures, which is a hard lesson learned). Set it to 50MHz instead.

3. Can the W5500 connect to the gigabit Ethernet chip? How to connect?

The answer is yes! It can definitely connect. Generally, gigabit switch chips support automatic polarity reversal for pin levels and transceiver ports, known as MDIX. Use the first two pairs of pins from the gigabit switch to communicate with the TXP/N and RXP/N of the W5500. It is recommended to use a network transformer; direct connection is also possible, but you need to determine if they are of the same type (either voltage-driven or current-driven). If they are inconsistent, the capacitive isolation and pull-up resistors on both sides need to be designed according to the original Ethernet port matching circuit. However, for safety, using one network transformer is sufficient, and there is no need to use two.

4. When using a network debugging assistant to receive UDP data, data cannot be received unless a message is sent from the computer first.

This situation is due to the computer’s firewall being enabled. You need to turn off the firewall for the public network, and the result is immediate!

5. When debugging the gigabit Ethernet chip, there may be a situation where it does not start. Excluding fundamental issues, check if there are any capacitors or resistors soldered incorrectly. The author once soldered a 2.49K resistor incorrectly as a capacitor, leading to incorrect voltage at MDIREF, causing the gigabit Ethernet chip to not function, which was quite frustrating! I spent several days doubting my life choices.

Currently, everything is working well! Connecting to the public network is no longer a concern, and data communication is solid!

6. Of course, besides using the W5500, the LNA8720 is also fine, but it requires porting the LWIP stack, which is not a big issue. When performing UDP communication with the LWIP stack, to communicate with multiple UDP sockets, do not bind the target address; otherwise, communication with multiple sockets will not be possible!

Debugging Issues with W5500/LAN8720 Communication with STM32 and Gigabit Switch Chips

Source:

Statement: We respect originality and emphasize sharing; the copyright of text and images belongs to the original author. The purpose of reprinting is to share more information and does not represent the position of this account. If your rights are infringed, please contact us promptly, and we will delete it as soon as possible. Thank you!

Original link:

https://blog.csdn.net/maum61/article/details/119799012

Leave a Comment