Do you have enough power to run the ethernet chip ? - I've seen somewhere it takes up to 180mAps of current while operating (crash at eth.begin??) - check your power generators first..
p.
Power should be fine; I had the same circuitry for a 328P-based setup where the same ethernet (wiz820io) module was working fine.
When using a static IP, the atmega does not freeze and I can ping the device from my local PC. The hanging only occurs when calling ethernet.begin() to fetch an IP address from the local DHCP server.
I'm on Arduino 1.0.1 btw.
I spent some more time on it this morning.
I created a small LAN, straight between my laptop (acting as a DHCP server) and the Wiz820io module. I found that the atmega does in fact not hang; it just never receives a DHCP response.
Using WireShark I found that the laptop never receives a DHCP request. I added some Serial.print()'s in the DHCP.cpp code to verify that send_DHCP_MESSAGE() is called and executed.
The Atmega continues within the parseDHCPResponse() function and loops continously within the loop:
while (_dhcpUdpSocket.parsePacket <= 0) { ... }
until the responseTimeout is exceeded. After this, the process happens again, still with no DHCP request sent across the wire.
Further debugging reveals that using a static IP I can:
- ping the Atmega from my laptop
- send UDP packet to my laptop (using my laptop's specific IP)
- send UDP broadcast packet and receive it on the laptop
All verified using Wireshark.
Nothing is transferred when I try to use DHCP. My laptop has a DHCP server running, verified working using another PC.
EDIT: Further debugging. Finally saw DHCP requests coming to the PC. Unfortunately, it seems very shaky and I never had it complete the DHCP negotiation.
EDIT2: After letting it run for an extended period I saw it connect a few times and start to send some UDP packets (I added that in the loop() function). Each time when it has connected, it rebooted after 10-15 seconds.
Could it be an issue with my power supply, noise or something else?
This morning I tried to use a static IP and let it send an UDP broadcast for every second, while also outputting the IP address of the W5200 module.
I noticed that all of a sudden, perhaps after 10-20 seconds, the IP address starts to change sporadically and packets are no longer being transferred. After this, I need to restart the Arduino to get it working again.
I verified my power supply as well. 5.1v being supplied to the atmega1284p (data sheet specifies 4.5-5.5v for 16MHz operation) and 3.28v going to the Wiz820io.
What type of voltage regulator for 3.3V do you use?
It's a LM1117-3.3.