What is basic troubleshooting tips for ethernet hardware? - Page 1
Forum section: electronics / projects

author: HSPalm
author_rank: Regular Contributor
timestamp: February 17, 2018, 12:20:00 am
content: Hi,I designed an arduino using Arduino Leonardo sketch as basis and added an ethernet driver (W5500) and RJ45 with magnetics. But I cannot get the ethernet part to work. I'm not sure where to start troubleshooting on ethernet hardware, what to look for, what LEDs should light at which times (none light at the moment) and so forth. The ethernet part of the schematic I've done used other schematics/shields I've seen using this driver and the RJ45 jack.I've attached the ethernet part of the schematic. I have confirmed the AVR and W5500 is talking to each other on SPI, and I have noticed and corrected the wrong pullup resistor on the reset line. But when I connect an ethernet cable from the router into the board, there is no light in the RJ45 jack (should it be?). Also the arduino hangs somewhere in the code looking for a connection. I am using library Ethernet2 and tried a couple examples accompanying the library.

author: fourtytwo42
author_rank: Super Contributor
timestamp: February 17, 2018, 07:23:28 am
content: A common problem using canned library code is you have no idea what it's doing! Far better to write your own code at the RTL level then you can interrogate the many chip registers and find out what it doesnt like and try different configurations

author: NiHaoMike
author_rank: Super Contributor
timestamp: February 17, 2018, 07:55:34 am
content: Get one of those cheap FX2 logic analyzers and look at what's really going on with the SPI interface.Quote from: fourtytwo42 on February 17, 2018, 07:23:28 amWrite your own Ethernet driver from scratch? There's a good reason even experts tend not to do it if they have a choice.

author: HSPalm
author_rank: Regular Contributor
timestamp: February 17, 2018, 09:30:27 am
content: Quote from: fourtytwo42 on February 17, 2018, 07:23:28 amI managed to debug it some by palcing debugging-printfs inside the library code.Quote from: NiHaoMike on February 17, 2018, 07:55:34 amI was about to say, if I had to write my own driver interface code I would never take upon me this projectI do have a logic analyzer, so I guess I should hook it up then

author: HSPalm
author_rank: Regular Contributor
timestamp: February 17, 2018, 01:18:05 pm
content: So I confirmed with logic analyzer that SPI is healthy and commands run to and forth just fine. So I digged into the library code and outputted the read and write SPI commands that repeats until forever on serial console. Basically what I've found out is that the W5500 does not close socket 0 when asked to. I do not know what this means. I do not know if I must be physically connected to a network to "close a socket". But even physically connected this is where the code stops (hardware fault on diff. bus side?).Sorry that this turned out to be almost a duplicate of my thread over at the Arduino.cc forum. I was hoping to reach the Arduino/SW guys over there, and the HW specialists here.Inline edit: Actually, when I come to think of it; is it not strange that it is first read from status register that socket 0 is closed, then it is requested for socket 0 to close, and then hangs waiting for the socket to close yet again?Code:Trying to open serial portSerial port opened***READ OPERATION*** //Read socket 0 status register. Returns 0 = Socket closedcntl_byte = 8_addr = 3result = 0***WRITE OPERATION*** //Writes 16 (0x10) to Socket 0 cmd register (means "close cocket 0")cntl_byte = 12_addr = 1_data = 16result = 1***READ OPERATION*** //Reads back socket 0 command register, expects 0 when commenad is processed, never happens (still contains command 16 from write operation)cntl_byte = 8_addr = 1result = 16***READ OPERATION*** //Repeats endlessly in the loop because 0 is never returned.cntl_byte = 8_addr = 1result = 16***READ OPERATION***cntl_byte = 8_addr = 1result = 16...and so on.