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

PowerState.RebootDevice & Ethernet circuitry

Ethernet reboot reset

Best Answer Pyt, 01 January 2014 - 05:38 PM

Hello,

 

For the record, I finally got it to work... The trick,for some reason that you may understand better than I do, is to change the network configuration before the RebootDevice(). It then works like a charm.

 

Thanks for time.

Pyt.

Go to the full post


  • Please log in to reply
4 replies to this topic

#1 Pyt

Pyt

    Member

  • Members
  • PipPip
  • 18 posts

Posted 31 December 2013 - 09:05 AM

Hello,

 

I wrote a very small web server for the Netduino Plus 2; the only purpose of the server is to give the user the ability to change the IP configuration of the board (enable DHCP or set a static address).

 

At the beginning of my Main() routine is a piece of code that retrieves the IP configuration from SD (if any, otherwise, it uses defaults), programs the network interface accordingly, and then starts the web server.

 

Once the user has entered the new configuration, I store it to the SD card, then reboot the device with [font="'courier new', courier, monospace;"]PowerState.RebootDevice(false)[/font]. The [font="'courier new', courier, monospace;"]Main()[/font] routine restarts, but then the Netduino card cannot be accessed from the network ; it just does not answer ; for the rest, it appears to be alive and well. I have to remove and re-apply power to get it back to responding to the network.

 

I tried RonZon's approach to hard reset the Ethernet chip (http://forums.netdui...+ethernet +port), but that apparently does not change anything (though I'm not sure what I'm really doing as I'm kind of working blindfolded, not havving an oscilloscope to put on the /ENC_RESET signal...).

 

Any idea how to change the IP configuration on the fly without powering off the Netduino ?

 

BTW, this is with the .Net MF 4.3 and the 4.3 beta 1 SDK.

 

Thanks,

Pyt.

 



#2 wendo

wendo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 31 December 2013 - 08:02 PM

The code you link to is sending the wrong value on the pin at the very least, use Aaron's code linked in the reply here

 

http://forums.netdui...ripheral-power/



#3 Pyt

Pyt

    Member

  • Members
  • PipPip
  • 18 posts

Posted 01 January 2014 - 09:02 AM

The code you link to is sending the wrong value on the pin at the very least, use Aaron's code linked in the reply here

 

http://forums.netdui...ripheral-power/

 

Hmm, I believe the value was right (the signal is active low), but anyway, thanks for the hint. I tried to enhance my reboot routine :

public static void Reboot() {    OutputPort ethResetN = new OutputPort((Cpu.Pin)50, true); // reset signal for Eth chip, active low    OutputPort powerEnableN = new OutputPort((Cpu.Pin)47, false); // power enable for Eth chip, actie low    ethResetN.Write(false); // reset Eth chip    Thread.Sleep(50); // sleep 50ms    powerEnableN.Write(true); // turn power off    Thread.Sleep(1000); // sleep 1s    powerEnableN.Write(false); // turn power back on    Thread.Sleep(100);    ethResetN.Write(true); // release reset signal    PowerState.RebootDevice(false); // hard reboot}

but to no avail. This is still not equivalent to unplugging/replugging the netduino device. My guess is there must be some part of the very early Ethernet chip initiallization which is not re-run when PowerState.RebootDevice() is called. Or maybe I just goofed somewhere...

 

The overall logic of my program is as follows :

public static void Main() {    // This is where the IP configuration gets set according    // to information stored in the SD the last time around.    NetConfig.Initialize();    // Start the web server in a separate thread    // (prompts the user for a new IP address)    new Thread(WebServer.Run).Start();    // More logic here to spy on the switch and reboot when it    // has been pressed for more than 3 secondss.    // The reboot can also be triggered by an action through the    // web server}

Chris, any hint ? (Happy new year by the way, and thanks for staying on line at this time of year...)

 

Thanks,

Pyt.



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 01 January 2014 - 09:59 AM

Hi Pyt, The hard reset should--literally--do a hard reset on the board. Which should be equivalent to pressing the reset button or powering down/up the board. It's possible that there's a timing issue somewhere in the core NETMF ENC28J60 driver which is occurring in conjunction with or because of the power-down/power-up sequence. In theory...if you shut off the ENC28J60's power and wait a few moments--and then simply do a hard reset--the board and initialization sequence should behave exactly like they do when you plug in a board. BTW, tiny differences in resistors and capacitors (within their +/- % tolerance ratings) could cause something to work perfectly on a board even though there was a timing issue--while not succeeding on another board. Chris

#5 Pyt

Pyt

    Member

  • Members
  • PipPip
  • 18 posts

Posted 01 January 2014 - 05:38 PM   Best Answer

Hello,

 

For the record, I finally got it to work... The trick,for some reason that you may understand better than I do, is to change the network configuration before the RebootDevice(). It then works like a charm.

 

Thanks for time.

Pyt.







Also tagged with one or more of these keywords: Ethernet, reboot, reset

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.