On the Raptor board, using a G400 module, how do I reset the ENC28J60 Ethernet module? I tried this, but calling new OutputPort(ResetPin, true) throws an exception. The ENC28 is plugged in to socket #3.
just a housekeeping request. Please don’t double post. Your other post was in a G120 thread, so was misplaced because your question was about G400 / Raptor. Plus, that thread was months old; and not related to your issue at all. A single new thread is always a much better idea unless you have a 100% match of the situation
The Gadgeteer Designer in Visual Studio creates the file Program.Generated.cs, and this code is written for me:
this.ethernetENC28 = new GTM.GHIElectronics.EthernetENC28(3);
The parameter 3 is the socket number the ENC28 module is plugged into on the Raptor board. There is no way to pass Cpu.Pin.GPIO_NONE. Or I am missing something.
@ dspacek - As RoSchmi said, If you use the Gadgeteer designer, there is no way to not pass the reset pin since we manage it all in the Gadgeteer driver. If you create the GHI.Networking.EthernetENC28 object yourself you can pass GPIO_None for the reset pin. https://www.ghielectronics.com/docs/30/networking might be helpful.
I commented out the ethernetENC28 construction in the program.generated.cs:
//this.ethernetENC28 = new GTM.GHIElectronics.EthernetENC28(3);
In my application thread, I created my new EthernetENC28J60 object for the Raptor board with a ENC28 module plugged into socket #3:
//eth = _ethernet_ENC28.NetworkInterface; //Normally use the Gadgeteer module
//This object needed so I can control the reset pin to the ENC28
eth = new GHINET.EthernetENC28J60(SPI.SPI_module.SPI1, G400.PA28, G400.PB1, Cpu.Pin.GPIO_NONE); //Used by Raptor ENC28 ethernet module in socket 3
ni = null;
Then I tried calling my function to reset the ENC28, and it throws an exception.
Yes, it Is possible to reset the module without exception before I create the instance of the EthernetENC28J60 Class. But after I create the EthernetENC28J60 class, and dispose of it, and do a Garbage Collection, when I run OutputPort reset = new OutputPort(G400.PC23, true); an exception ex2 is thrown: