EmbeddedRelated.com
Forums
Memfault State of IoT Report

Problem with running when not connected to PC

Started by RyanK February 8, 2011
Dan,

You are right. But for WDTCTL and other registers with "password", there is another wrinkle. Examples:
----
WDTCTL = WDT_MRST_32 + ~WDTHOLD;
is the same as WDTCTL = 0x5983; and will cause a WDT password violation reset.
-----
WDTCTL = ~WDTHOLD;
is the same as WDTCTL = 0xFF7F; and will also cause the same reset.
-----
WDTCTL &= ~(anything);
WDTCTL |= (anything);
will cause reset too, no matter what (anything) is.
-----
WDTCTL ^= 0x3300 | (8_bit_mask);
will flip those (8_bit_mask). Password will be correct.
=====
--OCY

--- In m..., Dan Bloomquist wrote:
>
> Dan Bloomquist wrote:
> > RyanK wrote:
> >
> >> WDTCTL = WDT_MRST_32 + ~WDTHOLD; //WDTPW + /* Enable watchdog */
> >>
> >>
> > Your line is the same as:
> >
> > WDTCTL = ~WDTHOLD;
> >
> >
> And a perfect example of thinking 'or' and using 'plus'. It is the same
> when using 'or'. It is something completely unexpected when using
> 'plus'. I was bit by my warning!
>
> Best, Dan.
>

Beginning Microcontrollers with the MSP430

old_cow_yellow wrote:
> Dan,
>
> You are right. But for WDTCTL and other registers with "password", there is another wrinkle. Examples:
> ----
> WDTCTL = WDT_MRST_32 + ~WDTHOLD;
> is the same as WDTCTL = 0x5983; and will cause a WDT password violation reset.
> -----
> WDTCTL = ~WDTHOLD;
> is the same as WDTCTL = 0xFF7F; and will also cause the same reset.
> -----
> WDTCTL&= ~(anything);
> WDTCTL |= (anything);
> will cause reset too, no matter what (anything) is.
> -----
> WDTCTL ^= 0x3300 | (8_bit_mask);
> will flip those (8_bit_mask). Password will be correct.
> =====>
> --OCY
>
>

Yes OCY,
And I had just read through the watchdog a few weeks ago while working
out the clock sources. Gota use that password. I've only either disabled
the watchdog or set it off for tick interrupts when I have a watch
crystal attached. So I've only set it up at initialization. Ryan, you
may want to consider that, just use the interrupt to check state flags
and work counters. As your project is a refer control and you don't LPM,
just work a counter and leave the watchdog alone. Set it for one second
ticks, (use that crystal), and do a RTC thing. My last project shows
time in the LCD display when powered up, I'm counting seconds, minutes,
hours, days... With power down only the WDT interrupt is hit to keep the
RTC updated. So, if you extend your code for LPM, you pretty much have
that code in place already.

There are lots of ways to get it done. No one way is the 'right' way.
But I'd just let the timer run, set a count down the interrupt will
tick, and handle that counter in the main loop as required.

Best, Dan.

(I've been working on and off with Daniel to get the USB thing working
with launchpad/rf2500/windows. I'm starting to think the easiest way
from here is just use CCS for those boards. I'm about to plunge into the
5100 chip and may learn enough to go back on this. But by then, someone
else may have nailed it. So far, I've only made it work with pure TTY
devices like the ez.

It seems kinda self defeting that TI won't just support a plain windows
driver for third party on the launchpad. After all, I thought they
pushed it for the low end market. But then, that market may find more
than they need with CCS and when they need more, they buy the CCS
license. The way the world works...)


Memfault State of IoT Report