Custom board with G120, ENC28J60 chip not working

Hello we just made a custom board using the G120.
We are testing the network with the ENC28J60 right now and cannot see any network activity.
I can open the interface ([em]ethernet_ENC28.Interface.Open();[/em]) with the following code, but I don’t get any CableConnect or Disconnect events.
Also the network activity leds doesn’t blink.
The same code work with a G120HDR+ENC28J60 gadgeteer module, I receive the cable connected/disconnected events, and the networks activity leds blinks.

Is it because I need to initialize the ENC28J60 chip once ?
Or from factory, the chip should be able to communicate throught SPI?

For my program, I used a FezCobra2 Gadgeteer MainBoard with an ENC28J60 gadgeteer module connected to port 6 (which has exactly same pinout on our board)
It’s not a FezCobraII board but it should be essentially the same hardware-wise.


namespace TestEthernet {
    public partial class Program {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted() {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            
            ethernet_ENC28.Interface.CableConnectivityChanged += new EthernetENC28J60.CableConnectivityChangedEventHandler(Interface_CableConnectivityChanged);

            ethernet_ENC28.Interface.NetworkAddressChanged += new NetworkInterfaceExtension.NetworkAddressChangedEventHandler(Interface_NetworkAddressChanged);

            if (!ethernet_ENC28.Interface.NetworkInterface.IsDhcpEnabled) {
                ethernet_ENC28.Interface.NetworkInterface.EnableDhcp();
            }

            if (!ethernet_ENC28.Interface.IsOpen) {
                ethernet_ENC28.Interface.Open();
            }


        }

        void Interface_NetworkAddressChanged(object sender, EventArgs e) {
            Debug.Print("AddressChanged:" + e.ToString());
        }

        void Interface_CableConnectivityChanged(object sender, EthernetENC28J60.CableConnectivityEventArgs e) {
            Debug.Print("NetworkConnectChanged:" + e.IsConnected);

        }

    }

Exact part for the Ethernet chip ENC28J60
http://www.digikey.ca/product-detail/en/ENC28J60-I%2FSO/ENC28J60-I%2FSO-ND/1680060

Do you have a G120 board and our ENC28 module? It is easier to start with a known working hardware to test your software and setup.

Exactly, I’ve tested it successfully with a G120HDR+ENC28J60 gadgeteer module and the software works.

Then after refering to the FezCobraII+ENC28J60 module schematics, we made our own board using the ENC28J60 chip and G120.
But there is no led activity, and no disconnect/connect events working.

We’re trying to find the cause.
We though maybe theres an initialization routine when ENC28J60 is used for the first time ?
Also in the ENC28J60 datasheet, it says to leave WOL disconnected… but the gadgeteer module use it ? We connected it according to the gadgeteer schematic. Tomorow we’ll try to disconnect the pin, maybe thats the issue ?

Lets skip ENC28 for now, do you have everything else working? Loaded latest firmware and loaded some apps?

Yes sir. Even the wifi chip works!
Tomorow I’ll take a multimeter and test every pins, again.
Just to make sure everything is connected like its supposed to be.

We went over all the schematics to compare between GHI ENC module+FezCobra2 vs our custom board with G120 and ENC chip … everything seems identical on the hardware side.
Anyone could confirm if the ENC28J60 chip should work out of the box ? Or does it require some initialization code first before it starts working ?
According to the datasheet page 34:

[quote]6.5 MAC Initialization Settings
Several of the MAC registers require configuration
during initialization. This only needs to be done once;
the order of programming is unimportant.[/quote]

But I am not sure if maybe GHI driver configure this automatically at startup or not ?
Meanwhile we will order the DIP package style of the ENC28J60 and test with a G120HDR

It should work with nothing special

I would hack in our ethernet module on your design to isolate the problem

Ok thanks for the suggestions.
We will try hacking the ethernet module directly to G120.
Also try to put the ethernet connect, ENC DIP chip on a proto board, and connect it to G120HDR
Thanks again Gus

We made the axact same Thing:
Put G120 on a custom board with ENC28J60. We also took COBRA II and ENC28 Module schematics as reference.
We did not have to do any one time initialization and it works without any issues.

@ reinhard
Thanks for the confirmation. We just ordered every parts fron digikey but DIP through hole, so we can test everything on a breadboard first.

So just tested everything on a breadboard.
The LEDs still does not blink when connecting a network cable (and it does with the ENC gadgeteer module).
I tried putting VCC manually on the leds to make them lit up, and they do.

Then I tried hacking the RJ45 connector from the gadgeteer ENC module (soldered wires from the module connector to breadboard), still no blink and no activity.

I still think the module need to be initialized in some way at first start ? I read many posts using this chip that the first time it is connected, it needs a series of first-time initialization… Does GHI driver does this transparently ?

Unless anyone can give me some hints, here’s my next step:
Order a SSOP28 to DIP converter, desolder the ENC28J60 from the gadgeteer module, and solder it on the adapter.
This would prove that there needs to be an initialization before using the chip ?

Maybe there’s an initialization routine, it’s just that how my program is made, it does not call it ?

The search continues …

There is some code but that is the code you already have, nothing special.

If it’s not too much to ask, which package type did you use ? Is it the same one as the Gadgeteer module ?
0.65mm pitch ENC28J60/SS-ND ?

Could it be that different packaging have different firmwares ?

Ok new test today.
I plugged the ethernet cable into my PoE connector, then routed more wires to the Gadgeteer ENC module by bypassing it.
And the Gagdeteer module’s led blinks!
So I know my connector is OK, but all my breadboard circuitry is bypassed this way (VCC and GND not plugged), only TD+,TD-,RD+RD-,TCT are wired.

I’ve checked every parts again and again that might be different from the FEZCobraII or ENC28 module datasheet … everything is the same…

FIXED!
I disconnected the two capacitors for the crystal oscillator, and voila it worked,

There was a mistake in our PCB: We used 2uF Capacitors for the 25mhz crystal, and it needed 39pF or less.
Thanks for the help, more testing to come to confirm that everything is good.

Congratulations :slight_smile:

Well done !