OK, here's my new 1-wire + watchdog firmware for Netduino Plus, based on official 4.2.0.1, with CW2's 1-wire, compiled with RVDS 4.1.
Flashing instructions:
- Onboard button is not touched -> boot up with watchdog enabled
- Press the onboard button while connecting the USB -> release the button after the LED turns off but before it starts blinking -> boot up with watchdog disabled -> can use MFDeploy to deploy large applications
- Press and hold the onboard button while connecting the USB until the onboard LED first turns off and then blinks -> boots to TinyBooter for firmware upload and for setting the network configuration
- 'Watchdog.enabled' is not set in the program -> watchdog is active and is automatically fed by the CLR
- 'Watchdog.enabled = false' -> watchdog is explicitly disabled -> same functionality as in the stock firmware
- 'Watchdog.enabled = true' -> watchdog is explicitly enabled and cannot be disabled -> the watchdog must be fed by the application by calling 'Watchdog.enabled = true' periodically. If this is not done, or if the application crashes, a watchdog reset will happen
- Please note that the watchdog is not active when connected to the debugger -> stop debugging and reconnect the USB
- To verify the functionality, comment out the 'Watchdog.enabled' row in FeedWatchdog and see the board doing a reset after a short while
[*]Reset the NetduinoPlus by connecting 3.3V to the golden square
[*]Disconnect and reconnect the USB
[*]Install the TinyBooterDecompressor.bin with SAM-BA
[*]Disconnect the USB cable and reconnect it while PRESSING AND HOLDING THE ONBOARD BUTTON until the onboard LED blinks quickly
[*]Deploy the firmware using MFDeploy
[*]Disconnect and reconnect the USB AGAIN while PRESSING AND HOLDING THE ONBOARD BUTTON until the onboard LED blinks quickly
[*]Set the network configuration with MFDeploy
[*]Disconnect and reconnect the USB (don't press the button), and you're done
[/list]
The Tinybooter has three modes:
The watchdog also has three modes on the application
A sample application
using System;using System.Net;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;namespace WatchdogDemo{ public class Program { static void FeedWatchdog(object o) { // Each time the watchdog is enabled, it's also fed // This is a bit of a workaround, but at least it didn't // require any interface changes Watchdog.Enabled = true; } public static void Main() { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); // When the watchdog is enabled, it also must be fed from the managed app Watchdog.Enabled = true; Timer WatchdogTimer = new Timer(new TimerCallback(FeedWatchdog), null, 1000, 1000); while (true) { Thread.Sleep(50); led.Write(!led.Read()); } } }}
The firmware source code is here: https://github.com/T...tduino-watchdog