1284, mighty-1284 1.6.3 and w5100 mini trouble

Howdy,

I seem to be having some trouble getting the ethernet to work on this 1284 (not p) using mighty-1284 1.6.3.

I have it hooked up as
Chip Ethernet
PB4/D4 --> SS
PB5/D5 --> MOSI
PB6/D6 --> MISO
PB7/D7 --> SCK

As far as I can tell the wiring is correct, but as soon as the program hits any ethernet function after ethernet.begin(mac, IP); it stalls

here is some code I used to display the set mac/ip and what the w5100 thinks its ip is

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
byte ip[] = { 192, 168, 0, 2 }; //failover IP

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
//  pinMode(4,OUTPUT);
//  digitalWrite(4, LOW );
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
Serial.print("server mac is set to ");
  for (int x = 0; x <= 5; x++){
  Serial.print(mac[x],HEX);
  if (x < 5)
  Serial.print(":");
  }
  Serial.println("");
  Serial.print("server ip is set to ");
  for (int x = 0; x <= 3; x++){
	  
  Serial.print(ip[x], DEC);
  if (x < 3)
  Serial.print(".");

  }
  Serial.println();
  Serial.print("this is what it thinks its IP is  ");
  Serial.println(Ethernet.localIP());
}


void loop() {

}

this is my typical output

server mac is set to DE:AD:BE:EF:FE:ED

server ip is set to 192.168.0.2

this is what it thinks its IP is 128.0.0.0 <----NOTE this number randomly seems to change mostly to a 128.x.x.x IP

If anyone has any idea as to why this isn't working I would love to hear from you. Everything else works on the chip including i2c, its just the ethernet/spi stuff that seems to be having issues

Which ethernet board are you using?

edit: This is from w5100.h. If the mighty-1284 uses "AVR_ATmega1280", then it should work ok. If not, it will use the wrong slave select. You can try moving the slave select to PB2 just as a test. That is the default if none of the processor types match. It should print which processor it is using during the compile. Those are the "#pragma message" lines.

private:
#if defined(ARDUINO_ARCH_AVR)
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#pragma message ("Mega 2560")
  inline static void initSS()    { DDRB  |=  _BV(4); };
  inline static void setSS()     { PORTB &= ~_BV(4); };
  inline static void resetSS()   { PORTB |=  _BV(4); };
#elif defined(__AVR_ATmega32U4__)
#pragma message ("32U4")
  inline static void initSS()    { DDRB  |=  _BV(6); };
  inline static void setSS()     { PORTB &= ~_BV(6); };
  inline static void resetSS()   { PORTB |=  _BV(6); }; 
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
#pragma message ("AT90")
  inline static void initSS()    { DDRB  |=  _BV(0); };
  inline static void setSS()     { PORTB &= ~_BV(0); };
  inline static void resetSS()   { PORTB |=  _BV(0); }; 
#else
#pragma message ("Default")
  inline static void initSS()    { DDRB  |=  _BV(2); };
  inline static void setSS()     { PORTB &= ~_BV(2); };
  inline static void resetSS()   { PORTB |=  _BV(2); };
#endif
#endif // ARDUINO_ARCH_AVR
};

w5100 mini like this one
http://www.ebay.com/itm/Mini-W5100-LAN-Ethernet-Shield-Network-Module-board-for-Arduino-high-quality-/141353577912

It also works fine if I move it back to my 328p (also on a minimal board)

When the sketch compiles, which processor is it showing?

Which board do you select in the IDE for that mighty-1284?

edit: It should show "Mega 2560" or "Default" in the orange lines above the compile info. If it shows "Default", it is using the wrong pin for the slave select.

I select the "maniacbug" mighty 1284p with jtag disabled and a 20mhz full swing oscillator.

here is the output on my ide (I use atmel studio 6.2)

I have attached the compiler output

compiler output.txt (11.7 KB)

no dice on moving to PB2, however the ip it thinks it has went to 0.0.0.0 and stayed there, so that's different, but not working

I can't help you there. I see no pragma output from the w5100 compile using that compiler.

ok, let me recompile using the arduinoIDE

I still don’t see any pragma though, I have the compiler output on verbose and looking for all warnings

arduino ide compiler output.txt (33.6 KB)

I don't see any compile of w5100.h there either. I did see this:

Multiple libraries were found for "Ethernet.h"
Used: C:\Users\cgriffin\Documents\Arduino\hardware\mighty-1284\avr\libraries\Ethernet
Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet

It is using its own version of the ethernet library.

yep, its part of the core files that get installed with the mighty 1284 1.6.3 package, it apparently contains support for the 1284p, while I using the 1284, I think the only difference between them is the picopower options that I am not using