Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Reset ethernet port

reset ethernet port no act led

  • Please log in to reply
1 reply to this topic

#1 RonZon

RonZon

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationWaukesha, WI

Posted 02 January 2013 - 02:47 AM

I received my Netduino Plus 2 about 1 week ago, and I have really enjoyed experimenting with it so far.  What a great little board !!

 

But, I had found an issue that kinda drove me crazy....

Working on an ethernet type of app, I ended up finding out that the ethernet did not seem to initialize (show ACT LED) when power had been removed for 15 or more seconds (i.e. first Power Up). I found that simply pressing the onboard button to reset, or even just unplug it again quickly then reconnect would resolve the issue.

 

For reliability though, this bothered me. For instance:  what if a device lost power,  it would not reset itself until YOU push the button.  Not good.

I found all sorts of issues posted here but couldn't find anything that sounded like my issue.

I also had tried using the power management command to cycle power to the ethernet chip,  no go...

Doing a hardware reboot via software ( PowerState.RebootDevice(false); ) alone, did not solve the issue either.

 

FINALLY today,  I found that if I send a reset to the ethernet IC, THEN reboot, VOILA !!  it finally works :)

The reset "/ENC_RESET" comes out on pin 54 from the Micro, and relates to (Cpu.Pin)50.  It is normally HIGH.

 

private static OutputPort resetEthernetPort = new OutputPort((Cpu.Pin)50, true); //0x32 hex

 

I cycle it low, sleep 50ms, then back high and RebootDevice:

 

  resetEthernetPort.Write(false);   Thread.Sleep(50);   resetEthernetPort.Write(true);

  PowerState.RebootDevice(false);

 

Just wanted to share,  if this helps anyone else out.

 

Here is the section of code:

 

private static OutputPort resetEthernetPort = new OutputPort((Cpu.Pin)50, true); //0x32 hexpublic static bool DHCP = false;// if DHCP set to true, these two values dont matter.   Subnet mask is set to: 255.255.255.0public static string myIPaddress = "192.168.137.10";public static string myGatewayAddress = "192.168.137.1";private static void resetEthernet()        {            resetEthernetPort.Write(false);            Thread.Sleep(50);            resetEthernetPort.Write(true);        }private static void rebootME()        {            resetEthernet();            PowerState.RebootDevice(false);        }private static void checkIP()        {            NetworkInterface NI;            if (DHCP)            {                Debug.Print("Setting to DHCP.");                NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();            }            else            {                Debug.Print("Setting to static IP address.");                NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP(myIPaddress, "255.255.255.0", myGatewayAddress);            }            int countTry = 1;            while (true)            {                NI = NetworkInterface.GetAllNetworkInterfaces()[0];                if (NI.IPAddress != "0.0.0.0")                {                    Debug.Print("IP Address Obtained: " + NI.IPAddress);                    break;                }                else                {                    Debug.Print("Try #" + countTry + ". No IP Address ...");                    Thread.Sleep(2000);                }                countTry++;                if (countTry == 6)                {                    Debug.Print("Failure after 5 tries.  Rebooting device...");                    rebootME();                }            }        }

 

I was hoping that just doing a quick reset at the beginning of the program would also work, but for some reason it doesn't. It seems to need the Reboot Device, also.

Oh...  and I DO have the current firmware, v4.2.1.2 :D

 

-Ron



#2 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 02 January 2013 - 03:17 AM

Just wanted to chime in and point out some code I wrote up a while ago, to manage the power of the onboard peripherals such as the ethernet controller.


When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 






Also tagged with one or more of these keywords: reset, ethernet, port, no, act, led

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.