ENC28 Cerberus hardware error

I re-installed the 4.1 SDK, 4.2 SDK, and installed the GHI Software Package from November to get the WinUSB driver and the GHI Current module driver, those both seem good but now my ENC28 isn’t working and I am not sure what else to check. I have redeployed the Ethernet firmware, I also tried manually setting the IP through MFDeploy. In code I have tried setting the IP and not setting the IP. Right now it is erroring in MultiSPI.cs line 97

_SPIDevice = new SPI(this._Configuration);

and in the output window I get:

A first chance exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll
An unhandled exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll

The callstack shows that the line of code in my program is my first line:

Networking.Adapter.Start(new byte[] { 0x5c, 0x86, 0x4a, 0x00, 0x00, 0xde }, "mip", Networking.InterfaceProfile.Cerberus_Socket6_ENC28);

I have not made any changes to MultiSPI or NetworkingService so they are the same as what is on CodePlex (http://mip.codeplex.com/) which I just downloaded a few days ago. I have built a brand new project to rule out any other references and I still get the error.

I would appreciate any suggestions.

I am confused. You want to use the Ethernet firmware or mip stack? One replaces the other.

Feel free to assume I am totally confused because I am. My goal is to serve up an XML file I am dynamically creating (no problem creating the XML string), and hopefully to somehow receive short commands, either query strings from a get or maybe XML or form fields from a post. I have a Cerberus and an ENC28. I am not currently able to serve up any pages because the project error’s out. I have tried lots of things to solve it. I don’t care if I use the mIP project or stock functionality, but I get errors either way. I did not realize that the mIP project and Ethernet firmware are an XOR, but I tried the mIP with the non-Ethernet firmware and it doesn’t seem to make any difference as I still get the same error.

I managed to find a post for the Ethernet firmware route with Cerberus and so I removed the mIP & NetworkService projects and references and tried the code below, but it blows up trying to start the web server with “An unhandled exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll”.

            string ip = "";
            Debug.Print("Network Startup");
            NetworkInterface[] ethintf = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface nif in ethintf)
                Debug.Print("Intf: " + nif.IPAddress);
                ip = nif.IPAddress;
            if (ip == "")
                Debug.Print("ERROR: No ethernet found!");
            WebServer.StartLocalServer(ip, 80);

            Debug.Print("Program Started");

The best way is to concentrate on one of the options. mIP maybe easier to debug as it is 100% C# and works on the non-ethernet firmware.

If you want to load the ethernet firmware, then mIP can NOT be used.

Once you decide which one you want to use, then you can start looking for example. The author of mIP provided many examples before and has been very helpful.

Ok, so I am back to where I was in the first post (with mIP). It throws the error I specified originally. I am on the non-Ethernet firmware that I started with (loading the Ethernet firmware in the first place was troubleshooting). The same code works in the sample project and the only difference I see is that (I think) the sample is non-Gadgeteer and I am trying with a Gadgeteer project.

Using a breakpoint on the line that has the error in the (new SPI) I checked the configuration being used and it is the same in both projects. I’m not sure what else to check or change.

BusyPin: -1
BusyPin_ActiveState: false
ChipSelect_ActiveState: false
ChipSelect_HoldTime: 0
ChipSelect_Port: 13
ChipSelect_SetupTime: 0
Clock_Edge: true
Clock_IdleState: false
Clock_RateKHz: 8000
SPI_mod: 0

Ok, I have no clue why, but it seems to now be working, though I don’t know what I changed. Hopefully it stays working.

Figured out the problem, looks like it was a bad module cable either shorting or breaking and sometimes making the ENC28 not respond. Guess it was a hardware problem.