G120 Network with ENC28

Hi,
I am trying to get a g120hdr board working with the ENC28 board - what is the process to make this work? Where do i plug it in on the hdr board and what libraries etc should i be using?
Is there a working example?

Thanks

Hi Michaelo, welcome to the forums.

G120HDR needs manual wiring of the user sockets to wire up the S socket - see GHI Electronics – Where Hardware Meets Software for the information you need.

You should also have a look here.
http://www.tinyclr.com/forum/topic?id=9396
Read through the whole thread to see sample for ENC28

In short:
You can connect to where you like. You specify the channel in the constructor.
Initialize it as seen in link above.
Works perfect for me (G120HDR + ENC28)

hi guys,
Well i have pulled my hair out trying to get the g120 working with the enc28 …and still no go.

I have tried various bits of code etc etc etc and I kept on getting errors saying t

I have wired up the enc28 as per instructions at:

I am using an extender board (1.3).

the instructions at GHI Electronics – Where Hardware Meets Software state that you dont need a connecton for 3.3v, 5v or gnd. If i do this then I get a not supported exception on this line:
Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, G120.Pin.P1_17, G120.Pin.P0_5, G120.Pin.P1_14);
Also none of the leds on the enc28 ever flicker…so I thought this must be wrong and I have plugged in an extender wire (that runs from the user1 or user2 on the G120 to the extender board which is in turn connected to the ENC28. Once i plug this in then I get the lights flickering on the enc28 when the board is powered up…all looks happy…
However, now I cannot deploy my code to the g120 - if i unplug the user1 (or user2 I have tried both) then I can deploy but then the network doesnt work.

Here is the output from the deploy window:

Found debugger!

Create TS.

Loading start at a0e00000, end a0e0fc38

Assembly: mscorlib (4.2.0.0) Assembly: Microsoft.SPOT.Native (4.2.0.0) Assembly: Microsoft.SPOT.Hardware (4.2.0.0)
Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1) Loading Deployment Assemblies.

Attaching deployed file.

Assembly: Microsoft.SPOT.Graphics (4.2.0.0) Resolving.

GC: 1msec 276828 bytes used, 8111376 bytes available

Type 0F (STRING ): 24 bytes

Type 15 (FREEBLOCK ): 8111376 bytes

Type 17 (ASSEMBLY ): 8220 bytes

Type 1E (BINARY_BLOB_HEAD ): 268512 bytes

Type 34 (APPDOMAIN_HEAD ): 72 bytes

GC: performing heap compaction…

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

Cannot find any entrypoint!

Done.

Waiting for debug commands…

‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.2\Assemblies\le\mscorlib.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Native.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll’, Symbols loaded.
‘Microsoft.SPOT.Debugger.CorDebug.dll’ (Managed): Loaded ‘C:\Program Files\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Graphics.dll’, Symbols loaded.
The program ‘[20] Micro Framework application: Managed’ has exited with code 0 (0x0).


There is an entry point (remember if I unplug user1 or user2 (which is powering the extender board that the enc28 is connected to) then it will deploy and i can get it to startup and hit a break point…plug the enc28 power back in and then i cant deploy again (because of error above)…weird

I know other people have these going - but this really is starting to drive me nuts, I’m about to lose company backing on this project as we cant continue to waste time on it.

Any suggestions welcome :slight_smile:

NOTE: Im convinced its not the code - pretty sure its something to do with how the device is connected or something along those lines.

Michaelo -

I’d suggest wiring up the ENC28 as described at GHI Electronics – Where Hardware Meets Software (see note below) and then take the code I posted at http://www.tinyclr.com/forum/topic?id=9929. Except for the exceptions thrown when the network cable is unplugged i works just fine.

Note that I used different pins for one or two things so the pins I passed to the EthernetENC28J60 constructor are a little different than the wireup above. I used: RST, CS, SCK, MISO, MOSI and INT#. MISO goes to MISO on the uC. MOSI goes to MOSI on the uC. That is, don’t cross them.

You clearly need to power the ENC28 so if not through the gadgeteer port then otherwise.

You might try using the firmware updater to erase your program from the module first.

I had no end of problems, lockups, etc. because I got a few wires wrong initially. Problems don’t manifest in the way you might expect. For example at one point the module would lock up and be unable to accept a program download or debugger attach unless I powered it off and then on and used the firmware updater to erase my program in the 1-2 seconds after the module was detected by my system. If I waited any longer than that it was wadded up. All is good now though. It was just a mistmatch between my wiring and the code.

Good luck,

Matt

@ andre.marschalek - Hi - I have checked the wiring several times…so pretty sure its right, however I will get a colleague to run a 2nd set of eyes over it also…

@ MattRedmond - Hi Matt, Thats what i based the code on, its also the wiring table that I used…Im really starting to wonder if i have a dead unc28 or something?

Any chance of a photo of how you have it wired up?

I will post my wiring when I get home later tonight. I am doing some Christmas rat-killing.

Edit: ah of course you meant michaelo… I’ll post mine too.

Hi Guys,
Well in desperation I tried to erase the device and reload it…now thats not really working also.

I connect the various pins etc and power up the g120 and it identifies it is bootloader mode and it lets me select the files and then I press UPDATE. It all seems to run throgh ok until it gets the end after writing the update and it tries to reboot the device…then it comes back after a pause and says:

No response from device

thinking this is weird , i tried several times all with the same results…so this then raises a question.

After I connect the 3 wires to the board to initiate a reload - do i leave them in or disconnect them after it starts up (prior to writing the update)…at what time do i disconnect them?

NOTE: Even though it says "No response from device " if i unplug and reconnec the device and then open visual studio and select usb again then it can see the g120. It also allows me to erase it again …but nothing works I am stuck in an endless cycle.

I’m really cautious of saying this because I know that GHI is trying - however the documentation on these products is lacking - the information is scattered all over the place and you need to piece it together from various posts in the forums etc etc.

It is now after midnight and I have been trying for days to make this work … but I seriously am close to giving up on it, i have until friday (tomorrow) to make this work - otherwise the plug will be pulled.

I have used other ghi boards (this is the only g120hdr I have though) and had none of these issues…any guidance would be appreciated.

Is there a page that i can go to where it lists the most recent versions (and where to check them) of each board (e.g. G120/panda/cobra…we have them all)

I have great hopes for this board and based on the specs know it will do the job I need - but i just cant get past this intial stage after many days of effort :frowning:

Hi Michaelo,

Sorry to hear your frustrations.
Are you using the auto updater included with the latest release?
Using this i had no trouble updating both my boards - i think from memory after step 4 the wires were left in.
After it was finished then they were removed and a reboot and away they went.
Hope this helps.
Justin

Michaelo -

Seriously, these problems sound exactly like what I was facing when my wiring didn’t match my code. I had one wire (don’t remember which) wrong and the thing locked up, didn’t respond to VS or the programming app, etc.

I keep meaning to post a photo but I’m only on my iPad durng the day and my photos (which are on my pad here) can’t be uploaded to the forum. I’m not sure how much help they’ll be anyway because there is pretty dense wiring on my G120’s headers. If you shoot me an email to mdredmond at Google’s email service domain name then I’ll reply with pics.

Michaelo, if you can’t see the device at some point in the firmware update process, you need to show us the device manager information. You need to see what device is visible and if the driver is showing as working.

Hi Brett,
In device manager it shows up as 2 things depending on what part of the process I am at. When I start loading it (which is when it can connect) it appears as something like G120 boot loader (cant recall exactly - am not in front of my dev machine). After it cant load and I have to reset it then it appears as G120.

pictures tell a much better story. when you get to your machine capture screenshots as you go.

hi guys,
I reflashed this and it solved my problems…weird - its happened twice on the g120 now.