W5500 communication problem Atmega 328 [SOLVED]

Hi all,

I am using a Wiznet W5500 with an Atmega 328 which is programmed over ICSP with the Arduino IDE (328PU like Arduino Uno). While prototyping I used an ethernet shield with Wiznet W5100 and the ethernet.h library and this worked fine. now I designed a PCB with atmega and W5500 but the comms do not work. I changed the library to ethernet2.h already, but it doesn’t help. The SPDLED turns on as soon as the wiznet gets power, and the LINKLED and DUPLED turn on once I plug in an ethernet cable. all LEDS are constantly on, no blinking. the ACT LED does not turn on at all and my software hangs on client.connect(); function. it doesn’t connect to the ethernet.

See schematics below:

anyone got any ideas? I can put the source code in here as well, but since it works with the W5100 and the library is changed to Ethernet2 this should not be the issue, but If anyone says otherwise I will post the code too.

Hi jan-jelle

Can you get the RJ45 part schematic?

Thank you.

Scott

That depends on which chip features you use. I posted an issue at Some common register addresses in W5100.h are incorrect for W5500 · Issue #84 · arduino-libraries/Ethernet · GitHub noting that some common W5500 registers have different addresses than the corresponding W5100 registers.

Ofcourse! apologies I forgot this. The schematics is mainly copied from the Arduino ethernet shield but modified for the correct RJ45 connector I use.

connector used:

Hi Mxyxixptlick

Thanks for the response. in that particular article it doesn’t really tell which library it uses as far as I can see? as far as I understand the conversion for the registers should be solved in the ethernet2.h library. however the issue with client::connect changing to 5ms might be something I could try… see if that will help the issue. my main code does hang in a while() loop until a connection is established though, so I wonder if it shouldn’t just pick it up in a second or third attempt then…

If any other ideas pop up please let me know!

small update.

I just took a scope to measure the SPI signals and conclude that the Slave Select only goes LOW on communication requests. is this usual, or should I pull it low constantly?

furthermore the MOSI is sending out data, (converted from 5V to 3.3V ofcourse) and the MISO is sending data back (just 3.3V since the uC accepts this as logic 1) but the speed in which the slave (W5500) is responding is a lot faster than the master is transmitting, or the bits are more 0 than 1 but that seems unlikely…

in any case, the uC is communicating with the W5500…

Slave Select should only go LOW on comm requests, so that’s good. If you have any other SPI devices connected their slave selects should be pulled high when not in use.

The datasheet says the W5500 is stable at SPI speeds up to 33.3MHz. If you’re running faster you may want to try dialing it back. (ref datasheet 5.5.4 SPI Timing).

That library is the Arduino Ethernet2 library posted at GitHub - arduino-libraries/Ethernet: Ethernet Library for Arduino.

I found that while it has many nice features, it’s not bullet-proof. I particularly had problems with connections. I forked a copy that I modified for my own use and posted it at GitHub - SapientHetero/Ethernet: Ethernet Library for Arduino.

I’m using a W5500 with a Cortex-M4 MCU that has more processor power and RAM than your 328, so my version may not be useful to you as-is. But you may want to fork the official Ethernet2 library and make similar changes to improve reliability.

README.rtf explains the changes I’ve made.

But your problem may have nothing to do with software. Another poster here had issues when his W5500 was overheated when soldering it to his board. Did you comply with the recommendation in Chapter 6 (IR Reflow Temperature Profile (Lead-Free) of the Datasheet when assembling your board?

Another poster had issues with electrical noise causing their W5500 to reset randomly on their custom boards.

Alright, another update. sorry guys at the moment I am messing around with the scope and such. after a few resets (and this happened before as well) suddenly the ACT led also lights up. during this stage I measured the SPI comms again and there is now a constant stream of communication. where in the previous case, there was only communication every 5 seconds (this is the delay between retries in connecting between the uC and W5500). but now, appearantly the connection is established since the rest of my main code is also running. however, the MQTT messages do not process correctly, so I still do not have a proper ethernet connection. also when pinging the W5500 it does not reply as it should in CMD. when pinging, the ACT LED does start blinking more frequently…

so some progress, but still no idea how to proceed… any help is much appreciated!

Hi Mxyxixptlick,

Thanks for the help. I will check the SPI speed but since it is sharing the same CLK signal I recon the MISO and MOSI are running at similar speed, but the bit pattern obviously is different which caught me off guard.

Regarding the soldering, I didn’t necessarily comply to any IR reflow since I soldered by hand. this obviously creates the discussion of possibly overheating however I got quite good at soldering .5mm pitch pretty fast, so I only applied the iron at 400 degrees in under .5s per 2 pins. I seriously doubt that it is fried due to soldering. SPI does seem to function steady, but the messages don’t come through properly. I am seriously questioning the connector I used and how I connected it to the W5500, since it is different than the reference schematics of the W5500. I didn’t notice this before because I went by the Arduino ethernet shield but this is again, a different connector…

Would it be possible for someone to tell me if my RJ45 connector setup in the picture above makes any sense? If I look at the W5500 reference there are 49.9R resistors on the TXP/TXN which I used as well, but I used 10K on RXP/RXN while reference sheet uses 49.9 there as well…

Your remark on the ethernet2.h library is noted, and I will take a look at this as well in the mean time.

furthermore the SPI clock signal shows 1 puls in roughly 100ns, so that would be 10MHz if I am correct… that should be fine then I recon.

Ok guys sorry for all the fuss. I just took my chances and changed out the resistors according to the W5500 reference schematics which eventually turned out to solve the issue. Don’t really understand why the Arduino shield has 10K’s there as per pictures below (R4, R5):


while the W5500 has them like this (R6, R7):

after changing them out it worked instantly.

thanks again for all the help!

So, as we software guys like to say, “it’s probably a hardware problem” :slight_smile:

Haha yeah… wel it was a human problem as most of the time.