Ideas to fault find W5500 / ATmega 32U4 (Arduino Leonardo)

Hello,
I’ve a custom build of an Arduino (ATmega 32U4-MU & W5500). Using a simple Arduino sketch, I can detect the W5500, however, I can’t establish a link. I have two PCBs that exhibit the same problem, so I assume it’s a design fault - however I can’t locate the issue … any ideas / suggestions would be welcome.

I’ve attached the schematic of the Ethernet section of the circuit (since I can detect the W5500, I assume the problem is somewhere in this section).

Arduino sketch:

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 1, 177);

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Ethernet.begin(mac, ip);

  if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    Serial.println("Ethernet shield was not found.");
  }
  else if (Ethernet.hardwareStatus() == EthernetW5100) {
    Serial.println("W5100 Ethernet controller detected.");
  }
  else if (Ethernet.hardwareStatus() == EthernetW5200) {
    Serial.println("W5200 Ethernet controller detected.");
  }
  else if (Ethernet.hardwareStatus() == EthernetW5500) {
    Serial.println("W5500 Ethernet controller detected.");
  }
}
void loop () {
delay(1000);

  if (Ethernet.linkStatus() == Unknown) {
    Serial.println("Link status unknown. Link status detection is only available with W5200 and W5500.");
  }
  else if (Ethernet.linkStatus() == LinkON) {
    Serial.println("Link status: On");
  }
  else if (Ethernet.linkStatus() == LinkOFF) {
    Serial.println("Link status: Off");
  } 
}

Many thanks in advance.

I do not immediately see anything wrong with the circuit diagram.
Some pins are missing in the package, in particular AGND and AVDD?

Otherwise you must check the following:

  1. Depending on what you connect to, W5500 does not support MDIX. Try both switch/hub connection or direct connect with the PC, see if any of these work.
  2. Check all the values of the components. Check twice to ensure they all are correct (and you did not accidentally used 49.9k resistors).
  3. measure XTAL frequency, it must be stable 25 MHz.
  4. read PHYCFGR, then, if PHY is not in reset state, set its reset bit and see if it clears shortly.

It is also a good practice to reset W5500 using its RESET pin before you use the chip (see the datasheet for timing).

Hi
Thank you for your pointers.
When I originally designed the PCB, I checked the ‘missing’ pins, they are a ‘feature’ of the KiCAD library symbol that I used, and did appear to be connected appropriately. I’ll double check.

I’ll check the other points and report back

Thanks

  1. Tried a small 8 port switch. Tried direct connect to PC. No signs of life.

  2. Checked components. Resistors appear correct.

  3. There appears to be a stable clock (test equipment is a 20MHz analogue Hameg 'scope),

  4. Using the Ethernet3 library, PHYCFGR reports 186 (0b10111010)

Any thoughts?

Arduino sketch to read PHYCFGR:


#include <SPI.h>
#include <Ethernet3.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);
IPAddress gateway(192,168, 1, 1);
IPAddress subnet(255, 255, 255, 0);


uint8_t phyState(); // returns the PHYCFGR
uint8_t link(); // returns the linkstate, 1 = linked, 0 = no link
const char* linkReport(); // returns the linkstate as a string
uint8_t speed(); // returns speed in MB/s
const char* speedReport(); // returns speed as a string
uint8_t duplex(); // returns duplex mode 0 = no link, 1 = Half Duplex, 2 = Full Duplex
const char* duplexReport(); // returns duplex mode as a string

void setup() {
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }  
  
  // initialize the ethernet device
  Ethernet.begin(mac, ip, subnet, gateway);

  delay(1000);

  Serial.println("Starting up ...");
  delay(1000);
}

void loop() {

  Serial.print("Link report : ");
  Serial.println(Ethernet.linkReport()); 

  Serial.print("phyState (PHYCFGR) : ");
  Serial.println(Ethernet.phyState()); 
  
  Serial.print("Linkstate : ");
  Serial.println(Ethernet.link());
  
  delay(2000);  
  Serial.println("Read again ... ");  

}

KiCAD PCB layout:

There should be no magic. Something is wrong with the circuit, or another circuit supplying power to it. What’s about power supply? Use scope to measure the voltage/current after power on. did you check all the components (not only resistors)? How can you use 20 MHz scope to measure 25 MHz clock? Do you perform chip RESET after powering it on?

Probing around. The TX side appears to be generating a waveform which seems to be creating eye patterns on the cat5 cable.

The W5500 is reset along with the ATmega.

The Hameg 'scope sees the 25MHz clock, it triggers, etc, just fine. However, the signal is beyond its calibrated range.

I’m struggling to read the capacitors whilst they are in circuit.

However, I think I may have found a miss fitted resistor. I need to replace the parts. It will take a few days to order the replacement parts.

I’ll update the thread when I’ve eliminated this.

Thanks for your help.

Fault found. As you suggested … mis-fitted component.

Seems to be working.

Thanks for your assistant.

1 Like