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).
#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");
}
}
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.
Tried a small 8 port switch. Tried direct connect to PC. No signs of life.
Checked components. Resistors appear correct.
There appears to be a stable clock (test equipment is a 20MHz analogue Hameg 'scope),
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 ... ");
}
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?