Ethernet not working with newer IDE

I am using an Arduino Mega 2560 r3 with an Arduino Ethernet shield (W5100 chip) as part of a fairly large system with a large software set (Binary sketch size: 157,106 bytes). This system runs fine using the 1.0.5 IDE. When I compile using the latest IDE (1.6.6) the Ethernet does not work using either DHCP or fixed IP. With DHCP the system just hangs at the

if (Ethernet.begin(Mac) == 0) {

statement. If I use Fixed IP the

Ethernet.begin(Mac, Ip, DNSserver, DefGateWay, SubNet);

statement executes but if I query the IP address using

Lcd.print(Ethernet.localIP());

I get a different IP (invalid one).

I updated to the version 1.1.1 from 1.1.0 Ethernet library with no difference. I searched the forum and release notes for any compatibility issues but did not find anything. I also tried reducing my RAM usage to eliminate any possible stack collision issues with no change. Any assistance would be appreciated.

I have also tried just using the DhcpChatServer example code with the 1.6.6 IDE and it also hangs trying to get an IP address.

I used the DhcpAddressPrinter sketch with a Mega2560, ethernet shield, and IDE v1.6.6, and it works ok.

Found that the issue is the SPI clock speed. Using the 1.0.5 IDE I get a 2 MHz clock for Ethernet communications and with the 1.6.6 IDE I get a 4 MHz clock. I have several other devices on the SPI buss so this restricts the speed to 2 MHz. I can look into improving the buffering in my circuitry but would like to make this work as is.

Does anyone know how to control the SPI clock speed for the Ethernet library??

Steve

Found the statements to modify in the “W5100.h” file to reduce the SPI clock speed and all works well now. I don’t like having to modify library files so I might try and fix the circuit loading problem.