Main Site Documentation

G400hdr enc28j60


I’ve tried to get the ENC28J60 running on socket #6 of the G400HDR using:
static EthernetENC28J60 Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, Pin.PC22, Pin.PC31, Pin.PA5);
No luck yet.
Anyone else got the ENC running?


I used the codeshare version
I also tried other versions that work on G120 etc., all end with a dump, after which the module has to be rebooted from scratch:
pc =0x201e073e
lr =0x201e07e8
sp =0x003076d0


@ Lurch

Try to use SPI.SPI_module.SPI2


@ Lurch - Out of interest, did you try the ENC28 using the Gadgeteer Mainboard in code share. I have tested the SPI and it works (as mentioned by Aron you should be using SPI2) so it should work for the ENC28 as well, unfortunately I do not have an ENC28 to test to confirm the non-SPI pins are working, but I expect that It should work just fine.

If you do not want to use the Gadgeteer mainboard, you can still use the code as a reference of the pins and the peripheral mappings. If you check the code in H400HDR_42.cs for Socket 6 you can see there that it is tied to SPI2 for example.

 #region Socket 6
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new char[] { 'S', 'U', 'Y' };
            socket.CpuPins[3] = GHI.Hardware.G400.Pin.PC31;         // PC31 (FIQ)
            socket.CpuPins[4] = GHI.Hardware.G400.Pin.PA5;          // TXD1
            socket.CpuPins[5] = GHI.Hardware.G400.Pin.PA6;          // RXD1
            socket.CpuPins[6] = GHI.Hardware.G400.Pin.PC22;         // PC22 (LCDDAT22)
            socket.CpuPins[7] = GHI.Hardware.G400.Pin.PA22;         // SPI1_MOSI
            socket.CpuPins[8] = GHI.Hardware.G400.Pin.PA21;         // SPI1_MISO
            socket.CpuPins[9] = GHI.Hardware.G400.Pin.PA23;         // SPI1_SPCK

            // S
            socket.SPIModule = SPI.SPI_module.SPI2;

            // U
            socket.SerialPortName = "COM3";

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            #endregion Socket 6


@ taylorza
just got back from a trip … and saw the other post where you stated that socket #6 is SPI2. I was fooled by the labeling into thinking it was SPI1. Will try later.
For the moment: Thanks for the help.


@ Lurch - When I did the first version of the G400HDR Gadgeteer Mainboard I did exactly the same thing, that label is very confusing. In fact, it was you that reported that SPI was not working and when I tested it I discovered my mistake.


OK, tried it with those parameters and it worked fine. I’m using the Gadgeteer Mainboard from code share. Just as with the G120HDR mainboard, you can’t pull the ENC28J60 module from the Toolbox with the G400HDR mainboard either (“The Module could not be added” “- A required library could not be found”) so I add it as the one-liner
static EthernetENC28J60 Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, Pin.PC22, Pin.PC31, Pin.PA5);

Works with the G120 code fine.
So, most everything I can test seems to be OK now.
Again, thanks for the great contributions. Makes my day!