Now of course I’m doing something stupid (my speciality) but really ‘This should never happen!’, sounds more like a personal challenge then an error message and I love challenges.
What I’m looking to do is fudge a basic network reset and based on the error message I’m thinking this isn’t how to do it.
ethernet_J11D.Interface.Close();
ethernet_J11D.Interface.Open(); <- blows here
ethernet_J11D.UseDHCP();
This works better and doesn’t raise an error, but its maybe not as much of a ‘reset’ as I’d like, but for now I’m going with it.
I wonder which of the EthernetENC28J60 Class methods: Constructor, Close, Dispose, or Open toggles the RESET pin?
One workaround is to Close the Driver (But of course this might trigger: ‘This should never happen!’), then toggle the GPIO pin connected to the RESET pin, which happens to be Pin.P1_14 for my G120HDR. The same is true for Cobra II.
One final important question:
As customers/owners of GHI Premium product, do we have access to the source code of GHI.Premium Library?
From what I gathered online, the answer is No! But I could be wrong!
As I am always curious to take an inside peek, I’ll soon be checking out this product:
I used RedGate Reflector a while ago.
Now I’m using ReSharper, which can do the same for you, and way more.
It’s a little more expensive, but it’s absolutely worth the money.
You could also apply for a free license if you work on a open source project.
The point I was trying to make was this: most of the “interesting” stuff is done in native code. So there is no much use of ReSharper or Reflector. Most of the time you will end up at [em]MethodImplOptions.InternalCall[/em]
You both mean that neither one will show the code in C at least?
In the long gone past, I was able to find a few compiler errors by looking at their generated assembly code but I would definitely prefer C at this age of mine!
You will get C# code from both.
But a lot of the C# methods are just representations for the C methods inside the firmware.
Everything inside the firmware is coded in native C (may be C++) and is therefor not decompilable in the same way as C#.
There might be some tolls which give you assembler code, but that’s really hard to read if you not an CPU junky with a lot of experience.
@ Cowboy - This makes sense when closing/disposing the device.
But for initialization it is most likely, that if one call fails, the next one will too.
As Reinhard indicated, I was trying to alert in a question form that it doesn’t make sense to try to do anything after the failure of ‘new’ or ‘.Open()’ statement! This is not really critical since the following statements will also fail but the code looked awkward to me!
The funny thing, as I was testing different fail scenarios with my ENC28 module, all the initialization code shown above did NOT fail when I unplugged the ENC28 module and started the system! However, if it’s plugged in and the cable is not connected or disconnected after start-up, I’m able to detect that!
The code is in fact awkward, but the reason to do that is awkward too.
I have IP stack failure, and the only way to restore the network is resetting the network module and without a clean “Reset” method, it was the only way I found.
Since the title of this thread is for a different subject, maybe we should start an new one entitled: “Resetting ENC28 network module after IP stack failure”.
I am sure not what’s the best way to do this other than creating a new topic with above title and mention that its a continuation to what was started in this thread.
If someone has a better suggestion please take the lead. Otherwise, I’ll go ahead and do it myself after 30 minutes or so.