1284p Calunium + W5200 freezes

I built a Calunium 1284p-based board and loaded it with optiboot. It’s running at 16MHz with an oscillator.

I attached a WIZ820io (W5200-based) ethernet connector such that the pins are connected like so:

Atmega1284p <-> WIZ820io
5 (PB4, D10, PWM/SS) <-> 5 (nSS)
6 (PB5, D11, MOSI) <-> 3 (MOSI)
8 (PB7, D12, PWM/SCK) <-> 4 (SCLK)
7 (PB5, D12, PWM/MISO) <-> 7 (MISO)

I tried to make the following corrections in In w5100.h:

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
inline static void initSS()    { DDRB  |=  _BV(4); };


#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__)
  inline static void initSS()    { DDRB  |=  _BV(4); };

When I call Ethernet.begin the Atmega1284p simply freezes.

The w5100.h I use has previously been tested with an Atmega328p on a breadboard together with the same Wiz820io that I use now.

Any suggestions on what I could try?

The W5100 does not have PWRDN. Do you have PWRDN connected to ground?

What IDE version are you using?
Are you using a W5200 version of the W5100 library?

edit: I submitted one to the Arduino crew here:

Note that you must change a define in that code to use the w5200.

Im using Arduino 1.0.1. Yes, I am using a W5200-version of w5100.h/.cpp. The library has been working fine on my 328p-based setup.

I just tried downloading the Ethernet and w5100 files that was attached to the issue on the issue tracker, but it did not change anything for me. The atmega still freezes.


Not sure if this has been answered before, but I've been successfully using the complete W5200 library from Bitbucket This is basically a copy of the arduino Ethernet library from IDE 1.0.1, with the W5100 files replaced by the correct 5200 files and other changes made to make it work with the ATMega1284P and WIZ820io. This is working with a board I've been working on from http://max1284.homelabs.org.uk/.

The examples are all update to use library Ethernet52 instead of Ethernet. This approach means that the original Ethernet library is still available for W5100 based board if like me you work on multiple projects at the same time. I have been looking at a combined library but time pressures have meant this has not progressed far.



Thanks for your answer Andy.

My board is now able to retrieve an IP using DHCP consistently.
However, I still experience issues with it.

When I start to write data using client.println() to the Wiz820io, it looses the IP address and thus the data is not transferred.

Every once in a while it seems that it successfully transfers the data. From a bit of testing it appears that if I only call client.println() once during a request it succeeds consistently.