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

Automatic Recovery


  • Please log in to reply
18 replies to this topic

#1 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 21 November 2010 - 06:48 AM

Is there any way to program the Netduino, N+, etc. to automatically reboot if the code crashes rather than just sitting there waiting for a debugger to connect?

#2 VincentA

VincentA

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts
  • LocationIndia

Posted 21 November 2010 - 09:58 AM

I havent got my hands on DNMF yet...but cant you use a global try-catch and on error clean up all resources and restart all the methods ?? (I know you might have thought about it...) So is there any hardware way to reset device? like raising reset(if any) pin to 1 ?

#3 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 21 November 2010 - 03:08 PM

What about this error? http://forums.netdui...-5-serious-bug/ I was hoping for something that could reboot on all errors, not just managed exceptions... Like a watchdog timer. The AT91SAM7X512 has a hardware watchdog timer... Anyone know how to enable it?

#4 VincentA

VincentA

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts
  • LocationIndia

Posted 21 November 2010 - 05:17 PM

a stupid idea..... How about connecting reset pin to one of the general IO pin and upon error setting it high? will it work? :blink: :blink: :blink: ( now i am being impatient...cant wait to get my netduino plus :( :( :( )

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 21 November 2010 - 05:53 PM

Vincent, To reset the Netduino/Netduino Plus/Netduino Mini, drive the /RESET line to ground. If you hook up a GPIO to the reset line, create an OutputPort, and set it to false...that should work. Creating a global exception handler (or an exception handling thread) could work too. We could also add a Reset feature to a future firmware release. The function is already built into the firmware...we'd just have to create a wrapper for it. You could also create one and build it into your own custom firmware. The firmware could also be tweaked to activate the hardware reset function in case an exception occurred. Lots of options. Chris

#6 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 21 November 2010 - 10:42 PM

I havent got my hands on DNMF yet...but cant you use a global try-catch and on error clean up all resources and restart all the methods ?? (I know you might have thought about it...)

So is there any hardware way to reset device? like raising reset(if any) pin to 1 ?


How exactly does one clean up resources in C#??? I can't fine any good way to destroy an object or deallocate memory.

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 21 November 2010 - 11:01 PM

How exactly does one clean up resources in C#??? I can't fine any good way to destroy an object or deallocate memory.


It happens automatically. C# uses garbage collection to clean up resources when memory gets low.

If an object has a Dispose method, you can call it to mark it for cleanup. Also, Debug.GC(true) will clean up any free-able memory.

Chris

#8 cross6

cross6

    Member

  • Members
  • PipPip
  • 11 posts

Posted 13 November 2011 - 09:53 PM

It happens automatically. C# uses garbage collection to clean up resources when memory gets low.

If an object has a Dispose method, you can call it to mark it for cleanup. Also, Debug.GC(true) will clean up any free-able memory.

Chris



Does the netduino actually run the .net runtime and do things like garbage collection? That seems like a lot to fit on the mcu, I assumed it just boiled down the .net CIL to the board's mcu?

#9 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 November 2011 - 11:52 PM

Hi cross6,

Does the netduino actually run the .net runtime and do things like garbage collection? That seems like a lot to fit on the mcu, I assumed it just boiled down the .net CIL to the board's mcu?

The .NET is a full .NET IL interpreter. It includes a .NET runtime, garbage collection, threading, hardware abstraction, etc. It is a lot to fit on an MCU; it's pretty cool :)

The code that you're running on the Netduino is compact MSIL, interpreted at runtime by .NET MF.

Chris

#10 cross6

cross6

    Member

  • Members
  • PipPip
  • 11 posts

Posted 14 November 2011 - 12:35 AM

Hi cross6,

The .NET is a full .NET IL interpreter. It includes a .NET runtime, garbage collection, threading, hardware abstraction, etc. It is a lot to fit on an MCU; it's pretty cool :)

The code that you're running on the Netduino is compact MSIL, interpreted at runtime by .NET MF.

Chris


Very cool! Thanks.

#11 Dixon

Dixon

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 16 November 2011 - 07:34 AM

We could also add a Reset feature to a future firmware release. The function is already built into the firmware...we'd just have to create a wrapper for it. You could also create one and build it into your own custom firmware.

The firmware could also be tweaked to activate the hardware reset function in case an exception occurred. Lots of options.


Hi Chris,

Did you manage to include the Reset function within the firmware? if not, how can we tweak it to activate the reset without need to use a GPIO?
Can the firmware be tweaked to just reset the TCP/IP stack?

#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 November 2011 - 12:41 PM

Hi Dixon,

Did you manage to include the Reset function within the firmware? if not, how can we tweak it to activate the reset without need to use a GPIO?
Can the firmware be tweaked to just reset the TCP/IP stack?

Have you tried PowerState.RebootDevice?
http://msdn.microsof...y/ee435764.aspx

The firmware could be tweaked to just reset the TCP/IP stack and the Ethernet PHY, but that might be quite a bit of work.

Chris

#13 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 16 November 2011 - 03:17 PM

Hi Dixon,

Have you tried PowerState.RebootDevice?
http://msdn.microsof...y/ee435764.aspx

The firmware could be tweaked to just reset the TCP/IP stack and the Ethernet PHY, but that might be quite a bit of work.

Chris


Actually, resetting the TCP/IP stack could be quite useful. Along with a watchdog timer and an RTC, but I digress...

-Valkyrie-MT

#14 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 November 2011 - 03:29 PM

Actually, resetting the TCP/IP stack could be quite useful. Along with a watchdog timer and an RTC, but I digress...

A bit of info...we're working on an external RTC to plug into the Netduino. Still working out the details.

Chris

#15 Arbiter

Arbiter

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationBrisbane, Australia

Posted 28 January 2012 - 02:36 PM

Along with a watchdog timer and an RTC
-Valkyrie-MT


I use a GPS shield to set the system clock. I've got an object wrapped around the serial port listening to NMEA sentences and updating properties. The first time it sets the DateTime, it also sets the system clock. I don't bother with anything but UTC on a logger; localisation to a timezone is a problem for UI code running on a full scale workstation.

I'm a bit surprised at the lack of a watchdog timer but it's not hard to do; you could knock up something with a MAX6814 to reset the Netduino and keep restarting it from a thread in your program. If the Netduino locks up it will fail to reset the watchdog, so the watchdog will reset the Netduino. I imagine Chris has something like this in mind for the RTC/watchdog he mentions.Of course if Chris does it, the heartbeat thread will probably be neatly hidden in the run-time so that we can all code away in blissful ignorance of occasional inexplicable lockups.
One day, all this too shall parse.

#16 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 28 January 2012 - 05:35 PM

I'm a bit surprised at the lack of a watchdog timer

The Netduino microcontroller has only one watchdog timer and that is used by the .NET MF runtime itself, so it is not available for user applications.

#17 Arbiter

Arbiter

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationBrisbane, Australia

Posted 31 January 2012 - 01:48 PM

Well there you go. No watchdog did seem unlikely. If it's used by the runtime then I take it framework lockups trigger reset. If so, that's perfect and I'll stop fretting about lockups in the field.
One day, all this too shall parse.

#18 Netd

Netd

    New Member

  • Members
  • Pip
  • 4 posts

Posted 10 April 2012 - 12:15 PM

Hello! Is it possible to reset the Netduino Plus with a watchdog? I would like to increase the reliability of a heating system, if the code crashes. Is it possible with the internal watchdog, or an external watchdog must be installed?

#19 Gorf

Gorf

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 10 April 2012 - 12:45 PM

I'm rebooting my ND+ whenever it fails to connect to its ethernet socket. This is something of a legacy, because it used to hang the whole unit if the connection failed more than a couple of times. Use
PowerState.RebootDevice(true);





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.