summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-09-26 11:50:28 -0700
committerKeith Packard <keithp@keithp.com>2011-10-07 08:37:02 -0600
commitfba1d605a627d03f9587ec060c45fb5d3e96aaeb (patch)
tree659246179f88135833460d5e1ac4b3a191293e6b
parentfc4173ff882dd9718f34ed043276ef612783dfe0 (diff)
altos: Delay reboot by a second to avoid re-entering idle mode
TM and Tm go into idle mode if they receive a packet after boot time. When tebooting the device over the packet link, the packet master would be (rapidly) polling the device for additional data and so the device would invariably receive a packet during bootup and go into idle mode again. Delay the reboot by a second to give the controller time to disable the master end of the packet link. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/ao_cmd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ao_cmd.c b/src/ao_cmd.c
index 1442ebea..8037195a 100644
--- a/src/ao_cmd.c
+++ b/src/ao_cmd.c
@@ -208,6 +208,13 @@ ao_reboot(void)
ao_cmd_white();
if (!ao_match_word("eboot"))
return;
+
+ /* Delay waiting for the packet master to be turned off
+ * so that we don't end up back in idle mode because we
+ * received a packet after boot.
+ */
+ flush();
+ ao_delay(AO_SEC_TO_TICKS(1));
WDCTL = WDCTL_EN | WDCTL_MODE_WATCHDOG | WDCTL_INT_64;
ao_delay(AO_SEC_TO_TICKS(2));
ao_panic(AO_PANIC_REBOOT);