Hi. Thanks for the help. ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12)
The thing is, I don’t really think that the LED’s are the problem as much as they’re probably the symptom of a larger issue with which I hoped someone here would be familiar with.
After the initialization the contents of the PHYCFGR are 0b10111010 which seems to indicate HalfDuplex, 100 Mbps and Link down.
I’m guessing this means that the W5500 tries to establish a link but doesn’t seem to be able too? I’m guessing that the period where the LED’s are ON is the period where the W5500 tries to establish the link.
Would that be a correct assesment?
I’m really pulling my hair here. It feels like I’m missing something really crucial in the initialization procedure but I can’t figure out exactly what. If there’s a problem with the PCB layout, then I’m seriously screwed.
This is the raw init routine code. Am I doing anything exceedingly stupid?
The parameters for w5500_SendCommand are (in order):
- Address
- Socket (or common)
- R/W
- Data from which to read or where to write
- Number of bytes to r/w
[code] // Reset W5500
one_data[0] = 0x80;
w5500_SendCommand(MODE, CMN, WRITE, one_data, 1);
// WoL disabled, disable ping block, disable PPPoE
// Force ARP disabled
one_data[0] = 0x00;
w5500_SendCommand(MODE, CMN, WRITE, one_data, 1);
// 1. Set Default Gateway address
w5500_SendCommand(GATEWAY_ADDR, CMN, WRITE, def_gateway, 4);
// 2. Set Subnet Mask
w5500_SendCommand(SUBNET_MASK, CMN, WRITE, subnet_mask, 4);
// 3. Set Source IP (set on router using MAC)
w5500_SendCommand(IP_ADDR, CMN, WRITE, ip_addr, 4);
// 4. Set Source MAC Address
w5500_SendCommand(MAC_ADDR, CMN, WRITE, mac_addr, 6);
// 5. Set Retry Count to 170
one_data[0] = 0xAA;
w5500_SendCommand(RETRY_COUNT_REG, CMN, WRITE, one_data, 1);
// 6. Set Socket S0 Mode - Enable Multicasting, UDP mode
one_data[0] = 0x80;
w5500_SendCommand(MODE, S0, WRITE, one_data, 1);
// 7. Set source port number of S0
one_data[0] = 0x00;
one_data[1] = 0x1A;
w5500_SendCommand(SOCK_SR_PORT, S0, WRITE, one_data, 2);
// 8. Set Destination Mac Address SOCK_DEST_MAC
w5500_SendCommand(SOCK_DEST_MAC, S0, WRITE, mac_addr_dest, 6);
// 9. Set Destination IP Address SOCK_DEST_IP
w5500_SendCommand(SOCK_DEST_IP, S0, WRITE, ip_addr_dest, 4);
// 10. Set Destination Port Address
one_data[0] = 0x00;
one_data[1] = 0x1A;
w5500_SendCommand(SOCK_DEST_PORT, S0, WRITE, one_data, 2);
// 11. Initialize RX/TX Buffer Sizes
one_data[0] = 0x02;
w5500_SendCommand(RX_BUF_SIZE, S0, WRITE, one_data, 1);
w5500_SendCommand(TX_BUF_SIZE, S0, WRITE, one_data, 1);
// 12. Set TimToLive parameter
one_data[0] = 0x40;
w5500_SendCommand(TTL, S0, WRITE, one_data, 1);[/code]